1/* Minification failed. Returning unminified contents. 2(14628,62-63): run-time error JS1195: Expected expression: > 3(14628,79-80): run-time error JS1195: Expected expression: ) 4(14630,5-6): run-time error JS1002: Syntax error: } 5(14634,45-46): run-time error JS1004: Expected ';': { 6(14649,19-20): run-time error JS1014: Invalid character: ` 7(14649,20-21): run-time error JS1195: Expected expression: . 8(14649,22-23): run-time error JS1004: Expected ';': { 9(14649,33-34): run-time error JS1014: Invalid character: ` 10(14649,34-35): run-time error JS1195: Expected expression: ) 11(14653,19-20): run-time error JS1014: Invalid character: ` 12(14653,41-42): run-time error JS1014: Invalid character: ` 13(14653,42-43): run-time error JS1004: Expected ';': ) 14(14657,33-34): run-time error JS1197: Too many errors. The file might not be a JavaScript file: ; 15(14646,5-24): run-time error JS1301: End of file encountered before function is properly closed: function collapse() 16(14669,44-45): run-time error JS1195: Expected expression: > 17(14669,46-50): run-time error JS1197: Too many errors. The file might not be a JavaScript file: attr 18 */ 19/* 20 _ _ _ _ 21 ___| (_) ___| | __ (_)___ 22/ __| | |/ __| |/ / | / __| 23\__ \ | | (__| < _ | \__ \ 24|___/_|_|\___|_|\_(_)/ |___/ 25 |__/ 26 27 Version: 1.5.9 28 Author: Ken Wheeler 29 Website: http://kenwheeler.github.io 30 Docs: http://kenwheeler.github.io/slick 31 Repo: http://github.com/kenwheeler/slick 32 Issues: http://github.com/kenwheeler/slick/issues 33 34 */ 35/* global window, document, define, jQuery, setInterval, clearInterval */ 36(function(factory) { 37 'use strict'; 38 if (typeof define === 'function' && define.amd) { 39 define(['jquery'], factory); 40 } else if (typeof exports !== 'undefined') { 41 module.exports = factory(require('jquery')); 42 } else { 43 factory(jQuery); 44 } 45 46}(function($) { 47 'use strict'; 48 var Slick = window.Slick || {}; 49 50 Slick = (function() { 51 52 var instanceUid = 0; 53 54 function Slick(element, settings) { 55 56 var _ = this, dataSettings; 57 58 _.defaults = { 59 accessibility: true, 60 adaptiveHeight: false, 61 appendArrows: $(element), 62 appendDots: $(element), 63 arrows: true, 64 asNavFor: null, 65 prevArrow: '<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>', 66 nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button">Next</button>', 67 autoplay: false, 68 autoplaySpeed: 3000, 69 centerMode: false, 70 centerPadding: '50px', 71 cssEase: 'ease', 72 customPaging: function(slider, i) { 73 return '<button type="button" data-role="none" role="button" aria-required="false" tabindex="0">' + (i + 1) + '</button>'; 74 }, 75 dots: false, 76 dotsClass: 'slick-dots', 77 draggable: true, 78 easing: 'linear', 79 edgeFriction: 0.35, 80 fade: false, 81 focusOnSelect: false, 82 infinite: true, 83 initialSlide: 0, 84 lazyLoad: 'ondemand', 85 mobileFirst: false, 86 pauseOnHover: true, 87 pauseOnDotsHover: false, 88 respondTo: 'window', 89 responsive: null, 90 rows: 1, 91 rtl: false, 92 slide: '', 93 slidesPerRow: 1, 94 slidesToShow: 1, 95 slidesToScroll: 1, 96 speed: 500, 97 swipe: true, 98 swipeToSlide: false, 99 touchMove: true, 100 touchThreshold: 5, 101 useCSS: true, 102 useTransform: false, 103 variableWidth: false, 104 vertical: false, 105 verticalSwiping: false, 106 waitForAnimate: true, 107 zIndex: 1000 108 }; 109 110 _.initials = { 111 animating: false, 112 dragging: false, 113 autoPlayTimer: null, 114 currentDirection: 0, 115 currentLeft: null, 116 currentSlide: 0, 117 direction: 1, 118 $dots: null, 119 listWidth: null, 120 listHeight: null, 121 loadIndex: 0, 122 $nextArrow: null, 123 $prevArrow: null, 124 slideCount: null, 125 slideWidth: null, 126 $slideTrack: null, 127 $slides: null, 128 sliding: false, 129 slideOffset: 0, 130 swipeLeft: null, 131 $list: null, 132 touchObject: {}, 133 transformsEnabled: false,
vendor: 6,056 bytes, lines 134-314
134 unslicked: false 135 }; 136 137 $.extend(_, _.initials); 138 139 _.activeBreakpoint = null; 140 _.animType = null; 141 _.animProp = null; 142 _.breakpoints = []; 143 _.breakpointSettings = []; 144 _.cssTransitions = false; 145 _.hidden = 'hidden'; 146 _.paused = false; 147 _.positionProp = null; 148 _.respondTo = null; 149 _.rowCount = 1; 150 _.shouldClick = true; 151 _.$slider = $(element); 152 _.$slidesCache = null; 153 _.transformType = null; 154 _.transitionType = null; 155 _.visibilityChange = 'visibilitychange'; 156 _.windowWidth = 0; 157 _.windowTimer = null; 158 159 dataSettings = $(element).data('slick') || {}; 160 161 _.options = $.extend({}, _.defaults, dataSettings, settings); 162 163 _.currentSlide = _.options.initialSlide; 164 165 _.originalSettings = _.options; 166 167 if (typeof document.mozHidden !== 'undefined') { 168 _.hidden = 'mozHidden'; 169 _.visibilityChange = 'mozvisibilitychange'; 170 } else if (typeof document.webkitHidden !== 'undefined') { 171 _.hidden = 'webkitHidden'; 172 _.visibilityChange = 'webkitvisibilitychange'; 173 } 174 175 _.autoPlay = $.proxy(_.autoPlay, _); 176 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 177 _.changeSlide = $.proxy(_.changeSlide, _); 178 _.clickHandler = $.proxy(_.clickHandler, _); 179 _.selectHandler = $.proxy(_.selectHandler, _); 180 _.setPosition = $.proxy(_.setPosition, _); 181 _.swipeHandler = $.proxy(_.swipeHandler, _); 182 _.dragHandler = $.proxy(_.dragHandler, _); 183 _.keyHandler = $.proxy(_.keyHandler, _); 184 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 185 186 _.instanceUid = instanceUid++; 187 188 // A simple way to check for HTML strings 189 // Strict HTML recognition (must start with <) 190 // Extracted from jQuery v1.11 source 191 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 192 193 194 _.registerBreakpoints(); 195 _.init(true); 196 _.checkResponsive(true); 197 198 } 199 200 return Slick; 201 202 }()); 203 204 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 205 206 var _ = this; 207 208 if (typeof(index) === 'boolean') { 209 addBefore = index; 210 index = null; 211 } else if (index < 0 || (index >= _.slideCount)) { 212 return false; 213 } 214 215 _.unload(); 216 217 if (typeof(index) === 'number') { 218 if (index === 0 && _.$slides.length === 0) { 219 $(markup).appendTo(_.$slideTrack); 220 } else if (addBefore) { 221 $(markup).insertBefore(_.$slides.eq(index)); 222 } else { 223 $(markup).insertAfter(_.$slides.eq(index)); 224 } 225 } else { 226 if (addBefore === true) { 227 $(markup).prependTo(_.$slideTrack); 228 } else { 229 $(markup).appendTo(_.$slideTrack); 230 } 231 } 232 233 _.$slides = _.$slideTrack.children(this.options.slide); 234 235 _.$slideTrack.children(this.options.slide).detach(); 236 237 _.$slideTrack.append(_.$slides); 238 239 _.$slides.each(function(index, element) { 240 $(element).attr('data-slick-index', index); 241 }); 242 243 _.$slidesCache = _.$slides; 244 245 _.reinit(); 246 247 }; 248 249 Slick.prototype.animateHeight = function() { 250 var _ = this; 251 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 252 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 253 _.$list.animate({ 254 height: targetHeight 255 }, _.options.speed); 256 } 257 }; 258 259 Slick.prototype.animateSlide = function(targetLeft, callback) { 260 261 var animProps = {}, 262 _ = this; 263 264 _.animateHeight(); 265 266 if (_.options.rtl === true && _.options.vertical === false) { 267 targetLeft = -targetLeft; 268 } 269 if (_.transformsEnabled === false) { 270 if (_.options.vertical === false) { 271 _.$slideTrack.animate({ 272 left: targetLeft 273 }, _.options.speed, _.options.easing, callback); 274 } else { 275 _.$slideTrack.animate({ 276 top: targetLeft 277 }, _.options.speed, _.options.easing, callback); 278 } 279 280 } else { 281 282 if (_.cssTransitions === false) { 283 if (_.options.rtl === true) { 284 _.currentLeft = -(_.currentLeft); 285 } 286 $({ 287 animStart: _.currentLeft 288 }).animate({ 289 animStart: targetLeft 290 }, { 291 duration: _.options.speed, 292 easing: _.options.easing, 293 step: function(now) { 294 now = Math.ceil(now); 295 if (_.options.vertical === false) { 296 animProps[_.animType] = 'translate(' + 297 now + 'px, 0px)'; 298 _.$slideTrack.css(animProps); 299 } else { 300 animProps[_.animType] = 'translate(0px,' + 301 now + 'px)'; 302 _.$slideTrack.css(animProps); 303 } 304 }, 305 complete: function() { 306 if (callback) { 307 callback.call(); 308 } 309 } 310 }); 311 312 } else { 313 314 _.applyTransition();
315 targetLeft = Math.ceil(targetLeft); 316 317 if (_.options.vertical === false) { 318 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 319 } else { 320 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 321 } 322 _.$slideTrack.css(animProps); 323 324 if (callback) { 325 setTimeout(function() { 326 327 _.disableTransition(); 328 329 callback.call(); 330 }, _.options.speed); 331 } 332 333 } 334 335 } 336 337 }; 338 339 Slick.prototype.asNavFor = function(index) { 340 341 var _ = this, 342 asNavFor = _.options.asNavFor; 343 344 if ( asNavFor && asNavFor !== null ) { 345 asNavFor = $(asNavFor).not(_.$slider); 346 } 347 348 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 349 asNavFor.each(function() { 350 var target = $(this).slick('getSlick'); 351 if(!target.unslicked) { 352 target.slideHandler(index, true); 353 } 354 }); 355 } 356 357 }; 358 359 Slick.prototype.applyTransition = function(slide) { 360 361 var _ = this, 362 transition = {}; 363 364 if (_.options.fade === false) { 365 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 366 } else { 367 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 368 } 369 370 if (_.options.fade === false) { 371 _.$slideTrack.css(transition); 372 } else { 373 _.$slides.eq(slide).css(transition); 374 } 375 376 }; 377 378 Slick.prototype.autoPlay = function() { 379 380 var _ = this; 381 382 if (_.autoPlayTimer) { 383 clearInterval(_.autoPlayTimer); 384 } 385 386 if (_.slideCount > _.options.slidesToShow && _.paused !== true) { 387 _.autoPlayTimer = setInterval(_.autoPlayIterator, 388 _.options.autoplaySpeed); 389 } 390 391 }; 392 393 Slick.prototype.autoPlayClear = function() { 394 395 var _ = this; 396 if (_.autoPlayTimer) { 397 clearInterval(_.autoPlayTimer); 398 } 399 400 }; 401 402 Slick.prototype.autoPlayIterator = function() { 403 404 var _ = this; 405 406 if (_.options.infinite === false) { 407 408 if (_.direction === 1) { 409 410 if ((_.currentSlide + 1) === _.slideCount - 411 1) { 412 _.direction = 0; 413 } 414 415 _.slideHandler(_.currentSlide + _.options.slidesToScroll); 416 417 } else { 418 419 if ((_.currentSlide - 1 === 0)) { 420 421 _.direction = 1; 422 423 } 424 425 _.slideHandler(_.currentSlide - _.options.slidesToScroll); 426 427 } 428 429 } else { 430 431 _.slideHandler(_.currentSlide + _.options.slidesToScroll); 432 433 } 434 435 }; 436 437 Slick.prototype.buildArrows = function() { 438 439 var _ = this; 440 441 if (_.options.arrows === true ) { 442 443 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 444 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 445 446 if( _.slideCount > _.options.slidesToShow ) { 447 448 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 449 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 450 451 if (_.htmlExpr.test(_.options.prevArrow)) { 452 _.$prevArrow.prependTo(_.options.appendArrows); 453 } 454 455 if (_.htmlExpr.test(_.options.nextArrow)) { 456 _.$nextArrow.appendTo(_.options.appendArrows); 457 } 458 459 if (_.options.infinite !== true) { 460 _.$prevArrow 461 .addClass('slick-disabled') 462 .attr('aria-disabled', 'true'); 463 } 464 465 } else { 466 467 _.$prevArrow.add( _.$nextArrow ) 468 469 .addClass('slick-hidden') 470 .attr({ 471 'aria-disabled': 'true', 472 'tabindex': '-1' 473 }); 474 475 } 476 477 } 478 479 }; 480 481 Slick.prototype.buildDots = function() { 482 483 var _ = this, 484 i, dotString; 485 486 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 487 488 dotString = '<ul class="' + _.options.dotsClass + '">'; 489 490 for (i = 0; i <= _.getDotCount(); i += 1) { 491 dotString += '<li>' + _.options.customPaging.call(this, _, i) + '</li>'; 492 } 493 494 dotString += '</ul>'; 495 496 _.$dots = $(dotString).appendTo(
vendor: 10,228 bytes, lines 497-773
497 _.options.appendDots); 498 499 _.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false'); 500 501 } 502 503 }; 504 505 Slick.prototype.buildOut = function() { 506 507 var _ = this; 508 509 // CUSTOM - change 510 // .children( _.options.slide + ':not(.slick-cloned)') 511 // .children( _.options.slide + ':not(.slick-cloned):not(.callout-item-hover)') 512 _.$slides = 513 _.$slider 514 .children( _.options.slide + ':not(.slick-cloned):not(.callout-item-hover)') 515 .not( 'input' ) 516 .addClass('slick-slide'); 517 518 _.slideCount = _.$slides.length; 519 520 _.$slides.each(function(index, element) { 521 $(element) 522 .attr('data-slick-index', index) 523 .data('originalStyling', $(element).attr('style') || ''); 524 }); 525 526 _.$slider.addClass('slick-slider'); 527 528 _.$slideTrack = (_.slideCount === 0) ? 529 $('<div class="slick-track"/>').appendTo(_.$slider) : 530 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 531 532 _.$list = _.$slideTrack.wrap( 533 '<div aria-live="polite" class="slick-list"/>').parent(); 534 _.$slideTrack.css('opacity', 0); 535 536 if (_.options.centerMode === true || _.options.swipeToSlide === true) { 537 _.options.slidesToScroll = 1; 538 } 539 540 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 541 542 _.setupInfinite(); 543 544 _.buildArrows(); 545 546 _.buildDots(); 547 548 _.updateDots(); 549 550 551 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 552 553 if (_.options.draggable === true) { 554 _.$list.addClass('draggable'); 555 } 556 557 }; 558 559 Slick.prototype.buildRows = function() { 560 561 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 562 563 newSlides = document.createDocumentFragment(); 564 originalSlides = _.$slider.children(); 565 566 if(_.options.rows > 1) { 567 568 slidesPerSection = _.options.slidesPerRow * _.options.rows; 569 numOfSlides = Math.ceil( 570 originalSlides.length / slidesPerSection 571 ); 572 573 for(a = 0; a < numOfSlides; a++){ 574 var slide = document.createElement('div'); 575 for(b = 0; b < _.options.rows; b++) { 576 var row = document.createElement('div'); 577 for(c = 0; c < _.options.slidesPerRow; c++) { 578 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 579 if (originalSlides.get(target)) { 580 row.appendChild(originalSlides.get(target)); 581 } 582 } 583 slide.appendChild(row); 584 } 585 newSlides.appendChild(slide); 586 } 587 588 _.$slider.html(newSlides); 589 _.$slider.children().children().children() 590 .css({ 591 'width':(100 / _.options.slidesPerRow) + '%', 592 'display': 'inline-block' 593 }); 594 595 } 596 597 }; 598 599 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 600 601 var _ = this, 602 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 603 var sliderWidth = _.$slider.width(); 604 var windowWidth = window.innerWidth || $(window).width(); 605 if (_.respondTo === 'window') { 606 respondToWidth = windowWidth; 607 } else if (_.respondTo === 'slider') { 608 respondToWidth = sliderWidth; 609 } else if (_.respondTo === 'min') { 610 respondToWidth = Math.min(windowWidth, sliderWidth); 611 } 612 613 if ( _.options.responsive && 614 _.options.responsive.length && 615 _.options.responsive !== null) { 616 617 targetBreakpoint = null; 618 619 for (breakpoint in _.breakpoints) //CUSTOM 620 { 621 //There's a breakpoint descriptor 622 if (_.breakpoints.hasOwnProperty(breakpoint)) 623 { 624 var breakpointValue = _.breakpoints[ breakpoint ]; 625 //We're using media queries 626 if ( typeof( breakpointValue ) === "string" ) 627 { 628 //Matches our media query 629 if ( matchMedia( breakpointValue ).matches ) 630 { 631 targetBreakpoint = _.breakpoints[ breakpoint ]; 632 break; 633 } 634 } 635 636 //Using pixel values 637 else 638 { 639 if ( _.originalSettings.mobileFirst === false ) 640 { 641 if ( respondToWidth < _.breakpoints[ breakpoint ] ) 642 { 643 targetBreakpoint = _.breakpoints[ breakpoint ]; 644 } 645 } else 646 { 647 if ( respondToWidth > _.breakpoints[ breakpoint ] ) 648 { 649 targetBreakpoint = _.breakpoints[ breakpoint ]; 650 } 651 } 652 } 653 } 654 } 655 656 if (targetBreakpoint !== null) { 657 if (_.activeBreakpoint !== null) { 658 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 659 _.activeBreakpoint = 660 targetBreakpoint; 661 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 662 _.unslick(targetBreakpoint); 663 } else { 664 _.options = $.extend({}, _.originalSettings, 665 _.breakpointSettings[ 666 targetBreakpoint]); 667 if (initial === true) { 668 _.currentSlide = _.options.initialSlide; 669 } 670 _.refresh(initial); 671 } 672 triggerBreakpoint = targetBreakpoint; 673 } 674 } else { 675 _.activeBreakpoint = targetBreakpoint; 676 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 677 _.unslick(targetBreakpoint); 678 } else { 679 _.options = $.extend({}, _.originalSettings, 680 _.breakpointSettings[ 681 targetBreakpoint]); 682 if (initial === true) { 683 _.currentSlide = _.options.initialSlide; 684 } 685 _.refresh(initial); 686 } 687 triggerBreakpoint = targetBreakpoint; 688 } 689 } else { 690 if (_.activeBreakpoint !== null) { 691 _.activeBreakpoint = null; 692 _.options = _.originalSettings; 693 if (initial === true) { 694 _.currentSlide = _.options.initialSlide; 695 } 696 _.refresh(initial); 697 triggerBreakpoint = targetBreakpoint; 698 } 699 } 700 701 // only trigger breakpoints during an actual break. not on initialize. 702 if( !initial && triggerBreakpoint !== false ) { 703 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 704 } 705 } 706 707 }; 708 709 Slick.prototype.changeSlide = function(event, dontAnimate) { 710 711 var _ = this, 712 $target = $(event.target), 713 indexOffset, slideOffset, unevenOffset; 714 715 // If target is a link, prevent default action. 716 if($target.is('a')) { 717 event.preventDefault(); 718 } 719 720 // If target is not the <li> element (ie: a child), find the <li>. 721 if(!$target.is('li')) { 722 $target = $target.closest('li'); 723 } 724 725 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 726 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 727 728 switch (event.data.message) { 729 730 case 'previous': 731 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 732 if (_.slideCount > _.options.slidesToShow) { 733 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 734 } 735 break; 736 737 case 'next': 738 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 739 if (_.slideCount > _.options.slidesToShow) { 740 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 741 } 742 break; 743 744 case 'index': 745 var index = event.data.index === 0 ? 0 : 746 event.data.index || $target.index() * _.options.slidesToScroll; 747 748 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 749 $target.children().trigger('focus'); 750 break; 751 752 default: 753 return; 754 } 755 756 }; 757 758 Slick.prototype.checkNavigable = function(index) { 759 760 var _ = this, 761 navigables, prevNavigable; 762 763 navigables = _.getNavigableIndexes(); 764 prevNavigable = 0; 765 if (index > navigables[navigables.length - 1]) { 766 index = navigables[navigables.length - 1]; 767 } else { 768 for (var n in navigables) { 769 if (index < navigables[n]) { 770 index = prevNavigable; 771 break; 772 } 773 prevNavigable = navigables[n];
774 } 775 } 776 777 return index; 778 }; 779 780 Slick.prototype.cleanUpEvents = function() { 781 782 var _ = this; 783 784 if (_.options.dots && _.$dots !== null) { 785 786 $('li', _.$dots).off('click.slick', _.changeSlide); 787 788 if (_.options.pauseOnDotsHover === true && _.options.autoplay === true) { 789 790 $('li', _.$dots) 791 .off('mouseenter.slick', $.proxy(_.setPaused, _, true)) 792 .off('mouseleave.slick', $.proxy(_.setPaused, _, false)); 793 794 } 795 796 } 797 798 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 799 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 800 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 801 } 802 803 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 804 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 805 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
vendor: 5,198 bytes, lines 806-1006
806 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 807 808 _.$list.off('click.slick', _.clickHandler); 809 810 $(document).off(_.visibilityChange, _.visibility); 811 812 _.$list.off('mouseenter.slick', $.proxy(_.setPaused, _, true)); 813 _.$list.off('mouseleave.slick', $.proxy(_.setPaused, _, false)); 814 815 if (_.options.accessibility === true) { 816 _.$list.off('keydown.slick', _.keyHandler); 817 } 818 819 if (_.options.focusOnSelect === true) { 820 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 821 } 822 823 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 824 825 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 826 827 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 828 829 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 830 $(document).off('ready.slick.slick-' + _.instanceUid, _.setPosition); 831 }; 832 833 Slick.prototype.cleanUpRows = function() { 834 835 var _ = this, originalSlides; 836 837 if(_.options.rows > 1) { 838 originalSlides = _.$slides.children().children(); 839 originalSlides.removeAttr('style'); 840 _.$slider.html(originalSlides); 841 } 842 843 }; 844 845 Slick.prototype.clickHandler = function(event) { 846 847 var _ = this; 848 849 if (_.shouldClick === false) { 850 event.stopImmediatePropagation(); 851 event.stopPropagation(); 852 event.preventDefault(); 853 } 854 855 }; 856 857 Slick.prototype.destroy = function(refresh) { 858 859 var _ = this; 860 861 _.autoPlayClear(); 862 863 _.touchObject = {}; 864 865 _.cleanUpEvents(); 866 867 $('.slick-cloned', _.$slider).detach(); 868 869 if (_.$dots) { 870 _.$dots.remove(); 871 } 872 873 874 if ( _.$prevArrow && _.$prevArrow.length ) { 875 876 _.$prevArrow 877 .removeClass('slick-disabled slick-arrow slick-hidden') 878 .removeAttr('aria-hidden aria-disabled tabindex') 879 .css("display",""); 880 881 if ( _.htmlExpr.test( _.options.prevArrow )) { 882 _.$prevArrow.remove(); 883 } 884 } 885 886 if ( _.$nextArrow && _.$nextArrow.length ) { 887 888 _.$nextArrow 889 .removeClass('slick-disabled slick-arrow slick-hidden') 890 .removeAttr('aria-hidden aria-disabled tabindex') 891 .css("display",""); 892 893 if ( _.htmlExpr.test( _.options.nextArrow )) { 894 _.$nextArrow.remove(); 895 } 896 897 } 898 899 900 if (_.$slides) { 901 902 _.$slides 903 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 904 .removeAttr('aria-hidden') 905 .removeAttr('data-slick-index') 906 .each(function(){ 907 $(this).attr('style', $(this).data('originalStyling')); 908 }); 909 910 _.$slideTrack.children(this.options.slide).detach(); 911 912 _.$slideTrack.detach(); 913 914 _.$list.detach(); 915 916 _.$slider.append(_.$slides); 917 } 918 919 _.cleanUpRows(); 920 921 _.$slider.removeClass('slick-slider'); 922 _.$slider.removeClass('slick-initialized'); 923 924 _.unslicked = true; 925 926 if(!refresh) { 927 _.$slider.trigger('destroy', [_]); 928 } 929 930 }; 931 932 Slick.prototype.disableTransition = function(slide) { 933 934 var _ = this, 935 transition = {}; 936 937 transition[_.transitionType] = ''; 938 939 if (_.options.fade === false) { 940 _.$slideTrack.css(transition); 941 } else { 942 _.$slides.eq(slide).css(transition); 943 } 944 945 }; 946 947 Slick.prototype.fadeSlide = function(slideIndex, callback) { 948 949 var _ = this; 950 951 if (_.cssTransitions === false) { 952 953 _.$slides.eq(slideIndex).css({ 954 zIndex: _.options.zIndex 955 }); 956 957 _.$slides.eq(slideIndex).animate({ 958 opacity: 1 959 }, _.options.speed, _.options.easing, callback); 960 961 } else { 962 963 _.applyTransition(slideIndex); 964 965 _.$slides.eq(slideIndex).css({ 966 opacity: 1, 967 zIndex: _.options.zIndex 968 }); 969 970 if (callback) { 971 setTimeout(function() { 972 973 _.disableTransition(slideIndex); 974 975 callback.call(); 976 }, _.options.speed); 977 } 978 979 } 980 981 }; 982 983 Slick.prototype.fadeSlideOut = function(slideIndex) { 984 985 var _ = this; 986 987 if (_.cssTransitions === false) { 988 989 _.$slides.eq(slideIndex).animate({ 990 opacity: 0, 991 zIndex: _.options.zIndex - 2 992 }, _.options.speed, _.options.easing); 993 994 } else { 995 996 _.applyTransition(slideIndex); 997 998 _.$slides.eq(slideIndex).css({ 999 opacity: 0, 1000 zIndex: _.options.zIndex - 2 1001 }); 1002 1003 } 1004 1005 }; 1006
1007 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 1008 1009 var _ = this; 1010 1011 if (filter !== null) { 1012 1013 _.$slidesCache = _.$slides; 1014 1015 _.unload(); 1016 1017 _.$slideTrack.children(this.options.slide).detach(); 1018 1019 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 1020 1021 _.reinit(); 1022 1023 } 1024 1025 }; 1026 1027 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 1028 1029 var _ = this; 1030 return _.currentSlide; 1031 1032 }; 1033 1034 Slick.prototype.getDotCount = function() { 1035 1036 var _ = this; 1037 1038 var breakPoint = 0; 1039 var counter = 0; 1040 var pagerQty = 0; 1041 1042 if (_.options.infinite === true) { 1043 while (breakPoint < _.slideCount) { 1044 ++pagerQty; 1045 breakPoint = counter + _.options.slidesToScroll; 1046 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1047 } 1048 } else if (_.options.centerMode === true) { 1049 pagerQty = _.slideCount; 1050 } else { 1051 while (breakPoint < _.slideCount) { 1052 ++pagerQty; 1053 breakPoint = counter + _.options.slidesToScroll; 1054 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1055 } 1056 } 1057 1058 return pagerQty - 1; 1059 1060 }; 1061 1062 Slick.prototype.getLeft = function(slideIndex) { 1063 1064 var _ = this, 1065 targetLeft, 1066 verticalHeight, 1067 verticalOffset = 0, 1068 targetSlide; 1069 1070 _.slideOffset = 0; 1071 verticalHeight = _.$slides.first().outerHeight(true); 1072 1073 if (_.options.infinite === true) { 1074 if (_.slideCount > _.options.slidesToShow) { 1075 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 1076 verticalOffset = (verticalHeight * _.options.slidesToShow) * -1; 1077 } 1078 if (_.slideCount % _.options.slidesToScroll !== 0) { 1079 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 1080 if (slideIndex > _.slideCount) { 1081 _.slideOffset = ((_.options.slidesToShow - (sl
vendor: 11,987 bytes, lines 1081-1441
1081ideIndex - _.slideCount)) * _.slideWidth) * -1; 1082 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 1083 } else { 1084 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 1085 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 1086 } 1087 } 1088 } 1089 } else { 1090 if (slideIndex + _.options.slidesToShow > _.slideCount) { 1091 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 1092 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 1093 } 1094 } 1095 1096 if (_.slideCount <= _.options.slidesToShow) { 1097 _.slideOffset = 0; 1098 verticalOffset = 0; 1099 } 1100 1101 // if (_.options.centerMode === true && _.options.infinite === true) { 1102 // _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 1103 // } else if (_.options.centerMode === true) { 1104 // _.slideOffset = 0; 1105 // _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 1106 // } 1107 //CUSTOM 1108 if (_.options.centerMode === true && _.options.infinite === true) { 1109 if (_.slideCount <= _.options.slidesToShow) { 1110 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 1111 } else { 1112 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 1113 } 1114 } else if (_.options.centerMode === true) { 1115 _.slideOffset = 0; 1116 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 1117 } 1118 1119 1120 if (_.options.vertical === false) { 1121 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 1122 } else { 1123 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 1124 } 1125 1126 if (_.options.variableWidth === true) { 1127 1128 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 1129 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 1130 } else { 1131 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 1132 } 1133 1134 if (_.options.rtl === true) { 1135 if (targetSlide[0]) { 1136 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 1137 } else { 1138 targetLeft = 0; 1139 } 1140 } else { 1141 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1142 } 1143 1144 if (_.options.centerMode === true) { 1145 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 1146 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 1147 } else { 1148 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 1149 } 1150 1151 if (_.options.rtl === true) { 1152 if (targetSlide[0]) { 1153 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 1154 } else { 1155 targetLeft = 0; 1156 } 1157 } else { 1158 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1159 } 1160 1161 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 1162 } 1163 } 1164 1165 return targetLeft; 1166 1167 }; 1168 1169 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 1170 1171 var _ = this; 1172 1173 return _.options[option]; 1174 1175 }; 1176 1177 Slick.prototype.getNavigableIndexes = function() { 1178 1179 var _ = this, 1180 breakPoint = 0, 1181 counter = 0, 1182 indexes = [], 1183 max; 1184 1185 if (_.options.infinite === false) { 1186 max = _.slideCount; 1187 } else { 1188 breakPoint = _.options.slidesToScroll * -1; 1189 counter = _.options.slidesToScroll * -1; 1190 max = _.slideCount * 2; 1191 } 1192 1193 while (breakPoint < max) { 1194 indexes.push(breakPoint); 1195 breakPoint = counter + _.options.slidesToScroll; 1196 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1197 } 1198 1199 return indexes; 1200 1201 }; 1202 1203 Slick.prototype.getSlick = function() { 1204 1205 return this; 1206 1207 }; 1208 1209 Slick.prototype.getSlideCount = function() { 1210 1211 var _ = this, 1212 slidesTraversed, swipedSlide, centerOffset; 1213 1214 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 1215 1216 if (_.options.swipeToSlide === true) { 1217 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 1218 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 1219 swipedSlide = slide; 1220 return false; 1221 } 1222 }); 1223 1224 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 1225 1226 return slidesTraversed; 1227 1228 } else { 1229 return _.options.slidesToScroll; 1230 } 1231 1232 }; 1233 1234 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 1235 1236 var _ = this; 1237 1238 _.changeSlide({ 1239 data: { 1240 message: 'index', 1241 index: parseInt(slide) 1242 } 1243 }, dontAnimate); 1244 1245 }; 1246 1247 Slick.prototype.init = function(creation) { 1248 1249 var _ = this; 1250 1251 if (!$(_.$slider).hasClass('slick-initialized')) { 1252 1253 $(_.$slider).addClass('slick-initialized'); 1254 1255 _.buildRows(); 1256 _.buildOut(); 1257 _.setProps(); 1258 _.startLoad(); 1259 _.loadSlider(); 1260 _.initializeEvents(); 1261 _.updateArrows(); 1262 _.updateDots(); 1263 1264 } 1265 1266 if (creation) { 1267 _.$slider.trigger('init', [_]); 1268 } 1269 1270 if (_.options.accessibility === true) { 1271 _.initADA(); 1272 } 1273 1274 }; 1275 1276 Slick.prototype.initArrowEvents = function() { 1277 1278 var _ = this; 1279 1280 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1281 _.$prevArrow.on('click.slick', { 1282 message: 'previous' 1283 }, _.changeSlide); 1284 _.$nextArrow.on('click.slick', { 1285 message: 'next' 1286 }, _.changeSlide); 1287 } 1288 1289 }; 1290 1291 Slick.prototype.initDotEvents = function() { 1292 1293 var _ = this; 1294 1295 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1296 $('li', _.$dots).on('click.slick', { 1297 message: 'index' 1298 }, _.changeSlide); 1299 } 1300 1301 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.options.autoplay === true) { 1302 $('li', _.$dots) 1303 .on('mouseenter.slick', $.proxy(_.setPaused, _, true)) 1304 .on('mouseleave.slick', $.proxy(_.setPaused, _, false)); 1305 } 1306 1307 }; 1308 1309 Slick.prototype.initializeEvents = function() { 1310 1311 var _ = this; 1312 1313 _.initArrowEvents(); 1314 1315 _.initDotEvents(); 1316 1317 _.$list.on('touchstart.slick mousedown.slick', { 1318 action: 'start' 1319 }, _.swipeHandler); 1320 _.$list.on('touchmove.slick mousemove.slick', { 1321 action: 'move' 1322 }, _.swipeHandler); 1323 _.$list.on('touchend.slick mouseup.slick', { 1324 action: 'end' 1325 }, _.swipeHandler); 1326 _.$list.on('touchcancel.slick mouseleave.slick', { 1327 action: 'end' 1328 }, _.swipeHandler); 1329 1330 _.$list.on('click.slick', _.clickHandler); 1331 1332 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 1333 1334 _.$list.on('mouseenter.slick', $.proxy(_.setPaused, _, true)); 1335 _.$list.on('mouseleave.slick', $.proxy(_.setPaused, _, false)); 1336 1337 if (_.options.accessibility === true) { 1338 _.$list.on('keydown.slick', _.keyHandler); 1339 } 1340 1341 if (_.options.focusOnSelect === true) { 1342 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1343 } 1344 1345 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 1346 1347 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 1348 1349 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 1350 1351 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 1352 $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition); 1353 1354 }; 1355 1356 Slick.prototype.initUI = function() { 1357 1358 var _ = this; 1359 1360 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1361 1362 _.$prevArrow.show(); 1363 _.$nextArrow.show(); 1364 1365 } 1366 1367 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1368 1369 _.$dots.show(); 1370 1371 } 1372 1373 if (_.options.autoplay === true) { 1374 1375 _.autoPlay(); 1376 1377 } 1378 1379 }; 1380 1381 Slick.prototype.keyHandler = function(event) { 1382 1383 var _ = this; 1384 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 1385 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 1386 if (event.keyCode === 37 && _.options.accessibility === true) { 1387 _.changeSlide({ 1388 data: { 1389 message: 'previous' 1390 } 1391 }); 1392 } else if (event.keyCode === 39 && _.options.accessibility === true) { 1393 _.changeSlide({ 1394 data: { 1395 message: 'next' 1396 } 1397 }); 1398 } 1399 } 1400 1401 }; 1402 1403 Slick.prototype.lazyLoad = function() { 1404 1405 var _ = this, 1406 loadRange, cloneRange, rangeStart, rangeEnd; 1407 1408 function loadImages(imagesScope) { 1409 $('img[data-lazy]', imagesScope).each(function() { 1410 1411 var image = $(this), 1412 imageSource = $(this).attr('data-lazy'), 1413 imageToLoad = document.createElement('img'); 1414 1415 imageToLoad.onload = function() { 1416 image 1417 .animate({ opacity: 0 }, 100, function() { 1418 image 1419 .attr('src', imageSource) 1420 .animate({ opacity: 1 }, 200, function() { 1421 image 1422 .removeAttr('data-lazy') 1423 .removeClass('slick-loading'); 1424 }); 1425 }); 1426 }; 1427 1428 imageToLoad.src = imageSource; 1429 1430 }); 1431 } 1432 1433 if (_.options.centerMode === true) { 1434 if (_.options.infinite === true) { 1435 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 1436 rangeEnd = rangeStart + _.options.slidesToShow + 2; 1437 } else { 1438 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 1439 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 1440 } 1441 } else {
1442 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 1443 rangeEnd = rangeStart + _.options.slidesToShow; 1444 if (_.options.fade === true) { 1445 if (rangeStart > 0) rangeStart--; 1446 if (rangeEnd <= _.slideCount) rangeEnd++; 1447 } 1448 } 1449 1450 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 1451 loadImages(loadRange); 1452 1453 if (_.slideCount <= _.options.slidesToShow) { 1454 cloneRange = _.$slider.find('.slick-slide'); 1455 loadImages(cloneRange); 1456 } else 1457 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 1458 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 1459 loadImages(cloneRange); 1460 } else if (_.currentSlide === 0) { 1461 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 1462 loadImages(cloneRange); 1463 } 1464 1465 }; 1466 1467 Slick.prototype.loadSlider = function() { 1468 1469 var _ = this; 1470 1471 _.setPosition(); 1472 1473 _.$slideTrack.css({ 1474 opacity: 1 1475 }); 1476 1477 _.$slider.removeClass('slick-loading'); 1478 1479 _.initUI(); 1480 1481 if (_.options.lazyLoad === 'progressive') { 1482 _.progressiveLazyLoad(); 1483 } 1484 1485 }; 1486 1487 Slick.prototype.next = Slick.prototype.slickNext = function() { 1488 1489 var _ = this; 1490 1491 _.changeSlide({ 1492 data: { 1493 message: 'next' 1494 } 1495 }); 1496 1497 }; 1498 1499 Slick.prototype.orientationChange = function() { 1500 1501 var _ = this; 1502 1503 _.checkResponsive(); 1504 _.setPosition(); 1505 1506 }; 1507 1508 Slick.prototype.pause = Slick.prototype.slickPause = function() { 1509 1510 var _ = this; 1511 1512 _.autoPlayClear(); 1513 _.paused = true; 1514 1515 }; 1516 1517 Slick.prototype.play = Slick.prototype.slickPlay = function() { 1518 1519 var _ = this; 1520 1521 _.paused = false; 1522 _.autoPlay(); 1523 1524 }; 1525 1526 Slick.prototype.postSlide = function(index) { 1527 1528 var _ = this; 1529 1530 _.$slider.trigger('afterChange', [_, index]); 1531 1532 _.animating = false; 1533 1534 _.setPosition(); 1535 1536 _.swipeLeft = null; 1537 1538 if (_.options.autoplay === true && _.paused === false) { 1539 _.autoPlay(); 1540 } 1541 if (_.options.accessibility === true) { 1542 _.initADA(); 1543 } 1544 1545 _.$slider.trigger('afterADA', [_, index]); 1546 1547 }; 1548 1549 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 1550 1551 var _ = this; 1552 1553 _.changeSlide({ 1554 data: { 1555 message: 'previous' 1556 } 1557 }); 1558 1559 }; 1560 1561 Slick.prototype.preventDefault = function(event) { 1562 event.preventDefault(); 1563 }; 1564 1565 Slick.prototype.progressiveLazyLoad = function() { 1566 1567 var _ = this, 1568 imgCount, targetImage; 1569 1570 imgCount = $('img[data-lazy]', _.$slider).length; 1571 1572 if (imgCount > 0) { 1573 targetImage = $('img[data-lazy]', _.$slider).first(); 1574 targetImage.attr('src', null); 1575 targetImage.attr('src', targetImage.attr('data-lazy')).removeClass('slick-loading').load(function() { 1576 targetImage.removeAttr('data-lazy'); 1577 _.progressiveLazyLoad(); 1578 1579 if (_.options.adaptiveHeight === true) { 1580 _.setPosition(); 1581 } 1582 }) 1583 .error(function() { 1584 targetImage.removeAttr('data-lazy'); 1585 _.progressiveLazyLoad(); 1586 }); 1587 } 1588 1589 }; 1590 1591 Slick.prototype.refresh = function( initializing ) { 1592 1593 var _ = this, currentSlide, firstVisible; 1594 1595 firstVisible = _.slideCount - _.options.slidesToShow; 1596 1597 // check that the new breakpoint can actually accept the 1598 // "current slide" as the current slide, otherwise we need 1599 // to set it to the closest possible value. 1600 if ( !_.options.infinite ) { 1601 if ( _.slideCount <= _.options.slidesToShow ) { 1602 _.currentSlide = 0; 1603 } else if ( _.currentSlide > firstVisible ) { 1604 _.currentSlide = firstVisible; 1605 } 1606 } 1607 1608 currentSlide = _.currentSlide; 1609 1610 _.destroy(true); 1611 1612 $.extend(_, _.initials, { currentSlide: currentSlide }); 1613
vendor: 12,446 bytes, lines 1614-2011
1614 _.init(); 1615 1616 if( !initializing ) { 1617 1618 _.changeSlide({ 1619 data: { 1620 message: 'index', 1621 index: currentSlide 1622 } 1623 }, false); 1624 1625 } 1626 1627 }; 1628 1629 Slick.prototype.registerBreakpoints = function() { 1630 1631 var _ = this, breakpoint, currentBreakpoint, l, 1632 responsiveSettings = _.options.responsive || null; 1633 1634 if ( $.type(responsiveSettings) === "array" && responsiveSettings.length ) { 1635 1636 _.respondTo = _.options.respondTo || 'window'; 1637 1638 for ( breakpoint in responsiveSettings ) { 1639 1640 l = _.breakpoints.length-1; 1641 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 1642 1643 if (responsiveSettings.hasOwnProperty(breakpoint)) { 1644 1645 // loop through the breakpoints and cut out any existing 1646 // ones with the same breakpoint number, we don't want dupes. 1647 while( l >= 0 ) { 1648 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 1649 _.breakpoints.splice(l,1); 1650 } 1651 l--; 1652 } 1653 1654 _.breakpoints.push(currentBreakpoint); 1655 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 1656 1657 } 1658 1659 } 1660 1661 _.breakpoints.sort(function(a, b) { 1662 return ( _.options.mobileFirst ) ? a-b : b-a; 1663 }); 1664 1665 } 1666 1667 }; 1668 1669 Slick.prototype.reinit = function() { 1670 1671 var _ = this; 1672 1673 _.$slides = 1674 _.$slideTrack 1675 .children(_.options.slide) 1676 .addClass('slick-slide'); 1677 1678 _.slideCount = _.$slides.length; 1679 1680 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 1681 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 1682 } 1683 1684 if (_.slideCount <= _.options.slidesToShow) { 1685 _.currentSlide = 0; 1686 } 1687 1688 _.registerBreakpoints(); 1689 1690 _.setProps(); 1691 _.setupInfinite(); 1692 _.buildArrows(); 1693 _.updateArrows(); 1694 _.initArrowEvents(); 1695 _.buildDots(); 1696 _.updateDots(); 1697 _.initDotEvents(); 1698 1699 _.checkResponsive(false, true); 1700 1701 if (_.options.focusOnSelect === true) { 1702 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1703 } 1704 1705 _.setSlideClasses(0); 1706 1707 _.setPosition(); 1708 1709 _.$slider.trigger('reInit', [_]); 1710 1711 if (_.options.autoplay === true) { 1712 _.focusHandler(); 1713 } 1714 1715 }; 1716 1717 Slick.prototype.resize = function() { 1718 1719 var _ = this; 1720 1721 if ($(window).width() !== _.windowWidth) { 1722 clearTimeout(_.windowDelay); 1723 _.windowDelay = window.setTimeout(function() { 1724 _.windowWidth = $(window).width(); 1725 _.checkResponsive(); 1726 if( !_.unslicked ) { _.setPosition(); } 1727 }, 50); 1728 } 1729 }; 1730 1731 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 1732 1733 var _ = this; 1734 1735 if (typeof(index) === 'boolean') { 1736 removeBefore = index; 1737 index = removeBefore === true ? 0 : _.slideCount - 1; 1738 } else { 1739 index = removeBefore === true ? --index : index; 1740 } 1741 1742 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 1743 return false; 1744 } 1745 1746 _.unload(); 1747 1748 if (removeAll === true) { 1749 _.$slideTrack.children().remove(); 1750 } else { 1751 _.$slideTrack.children(this.options.slide).eq(index).remove(); 1752 } 1753 1754 _.$slides = _.$slideTrack.children(this.options.slide); 1755 1756 _.$slideTrack.children(this.options.slide).detach(); 1757 1758 _.$slideTrack.append(_.$slides); 1759 1760 _.$slidesCache = _.$slides; 1761 1762 _.reinit(); 1763 1764 }; 1765 1766 Slick.prototype.setCSS = function(position) { 1767 1768 var _ = this, 1769 positionProps = {}, 1770 x, y; 1771 1772 if (_.options.rtl === true) { 1773 position = -position; 1774 } 1775 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 1776 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 1777 1778 positionProps[_.positionProp] = position; 1779 1780 if (_.transformsEnabled === false) { 1781 _.$slideTrack.css(positionProps); 1782 } else { 1783 positionProps = {}; 1784 if (_.cssTransitions === false) { 1785 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 1786 _.$slideTrack.css(positionProps); 1787 } else { 1788 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 1789 _.$slideTrack.css(positionProps); 1790 } 1791 } 1792 1793 }; 1794 1795 Slick.prototype.setDimensions = function() { 1796 1797 var _ = this; 1798 1799 if (_.options.vertical === false) { 1800 if (_.options.centerMode === true) { 1801 _.$list.css({ 1802 padding: ('0px ' + _.options.centerPadding) 1803 }); 1804 } 1805 } else { 1806 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 1807 if (_.options.centerMode === true) { 1808 _.$list.css({ 1809 padding: (_.options.centerPadding + ' 0px') 1810 }); 1811 } 1812 } 1813 1814 _.listWidth = _.$list.width(); 1815 _.listHeight = _.$list.height(); 1816 1817 1818 if (_.options.vertical === false && _.options.variableWidth === false) { 1819 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 1820 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 1821 1822 } else if (_.options.variableWidth === true) { 1823 _.$slideTrack.width(5000 * _.slideCount); 1824 } else { 1825 _.slideWidth = Math.ceil(_.listWidth); 1826 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 1827 } 1828 1829 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 1830 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 1831 1832 }; 1833 1834 Slick.prototype.setFade = function() { 1835 1836 var _ = this, 1837 targetLeft; 1838 1839 _.$slides.each(function(index, element) { 1840 targetLeft = (_.slideWidth * index) * -1; 1841 if (_.options.rtl === true) { 1842 $(element).css({ 1843 position: 'relative', 1844 right: targetLeft, 1845 top: 0, 1846 zIndex: _.options.zIndex - 2, 1847 opacity: 0 1848 }); 1849 } else { 1850 $(element).css({ 1851 position: 'relative', 1852 left: targetLeft, 1853 top: 0, 1854 zIndex: _.options.zIndex - 2, 1855 opacity: 0 1856 }); 1857 } 1858 }); 1859 1860 _.$slides.eq(_.currentSlide).css({ 1861 zIndex: _.options.zIndex - 1, 1862 opacity: 1 1863 }); 1864 1865 }; 1866 1867 Slick.prototype.setHeight = function() { 1868 1869 var _ = this; 1870 1871 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 1872 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 1873 _.$list.css('height', targetHeight); 1874 } 1875 1876 }; 1877 1878 Slick.prototype.setOption = Slick.prototype.slickSetOption = function(option, value, refresh) { 1879 1880 var _ = this, l, item; 1881 1882 if( option === "responsive" && $.type(value) === "array" ) { 1883 for ( item in value ) { 1884 if( $.type( _.options.responsive ) !== "array" ) { 1885 _.options.responsive = [ value[item] ]; 1886 } else { 1887 l = _.options.responsive.length-1; 1888 // loop through the responsive object and splice out duplicates. 1889 while( l >= 0 ) { 1890 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 1891 _.options.responsive.splice(l,1); 1892 } 1893 l--; 1894 } 1895 _.options.responsive.push( value[item] ); 1896 } 1897 } 1898 } else { 1899 _.options[option] = value; 1900 } 1901 1902 if (refresh === true) { 1903 _.unload(); 1904 _.reinit(); 1905 } 1906 1907 }; 1908 1909 Slick.prototype.setPosition = function() { 1910 1911 var _ = this; 1912 1913 _.setDimensions(); 1914 1915 _.setHeight(); 1916 1917 if (_.options.fade === false) { 1918 _.setCSS(_.getLeft(_.currentSlide)); 1919 } else { 1920 _.setFade(); 1921 } 1922 1923 _.$slider.trigger('setPosition', [_]); 1924 1925 }; 1926 1927 Slick.prototype.setProps = function() { 1928 1929 var _ = this, 1930 bodyStyle = document.body.style; 1931 1932 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 1933 1934 if (_.positionProp === 'top') { 1935 _.$slider.addClass('slick-vertical'); 1936 } else { 1937 _.$slider.removeClass('slick-vertical'); 1938 } 1939 1940 if (bodyStyle.WebkitTransition !== undefined || 1941 bodyStyle.MozTransition !== undefined || 1942 bodyStyle.msTransition !== undefined) { 1943 if (_.options.useCSS === true) { 1944 _.cssTransitions = true; 1945 } 1946 } 1947 1948 if ( _.options.fade ) { 1949 if ( typeof _.options.zIndex === 'number' ) { 1950 if( _.options.zIndex < 3 ) { 1951 _.options.zIndex = 3; 1952 } 1953 } else { 1954 _.options.zIndex = _.defaults.zIndex; 1955 } 1956 } 1957 1958 if (bodyStyle.OTransform !== undefined) { 1959 _.animType = 'OTransform'; 1960 _.transformType = '-o-transform'; 1961 _.transitionType = 'OTransition'; 1962 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 1963 } 1964 if (bodyStyle.MozTransform !== undefined) { 1965 _.animType = 'MozTransform'; 1966 _.transformType = '-moz-transform'; 1967 _.transitionType = 'MozTransition'; 1968 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 1969 } 1970 if (bodyStyle.webkitTransform !== undefined) { 1971 _.animType = 'webkitTransform'; 1972 _.transformType = '-webkit-transform'; 1973 _.transitionType = 'webkitTransition'; 1974 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 1975 } 1976 if (bodyStyle.msTransform !== undefined) { 1977 _.animType = 'msTransform'; 1978 _.transformType = '-ms-transform'; 1979 _.transitionType = 'msTransition'; 1980 if (bodyStyle.msTransform === undefined) _.animType = false; 1981 } 1982 if (bodyStyle.transform !== undefined && _.animType !== false) { 1983 _.animType = 'transform'; 1984 _.transformType = 'transform'; 1985 _.transitionType = 'transition'; 1986 } 1987 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 1988 }; 1989 1990 1991 Slick.prototype.setSlideClasses = function(index) { 1992 1993 var _ = this, 1994 centerOffset, allSlides, indexOffset, remainder; 1995 1996 allSlides = _.$slider 1997 .find('.slick-slide') 1998 .removeClass('slick-active slick-center slick-current') 1999 .attr('aria-hidden', 'true'); 2000 2001 _.$slides 2002 .eq(index) 2003 .addClass('slick-current'); 2004 2005 if (_.options.centerMode === true) { 2006 2007 centerOffset = Math.floor(_.options.slidesToShow / 2); 2008 2009 if (_.options.infinite === true) { 2010 2011 if (index >
2011= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 2012 2013 _.$slides 2014 .slice(index - centerOffset, index + centerOffset + 1) 2015 .addClass('slick-active') 2016 .attr('aria-hidden', 'false'); 2017 2018 } else { 2019 2020 indexOffset = _.options.slidesToShow + index; 2021 allSlides 2022 .slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2) 2023 .addClass('slick-active') 2024 .attr('aria-hidden', 'false'); 2025 2026 } 2027 2028 if (index === 0) { 2029 2030 allSlides 2031 .eq(allSlides.length - 1 - _.options.slidesToShow) 2032 .addClass('slick-center'); 2033 2034 } else if (index === _.slideCount - 1) { 2035 2036 allSlides 2037 .eq(_.options.slidesToShow) 2038 .addClass('slick-center'); 2039 2040 } 2041 2042 } 2043 2044 _.$slides 2045 .eq(index) 2046 .addClass('slick-center'); 2047 2048 } else { 2049 2050 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 2051 2052 _.$slides 2053 .slice(index, index + _.options.slidesToShow) 2054 .addClass('slick-active') 2055 .attr('aria-hidden', 'false'); 2056 2057 } else if (allSlides.length <= _.options.slidesToShow) { 2058 2059 allSlides 2060 .addClass('slick-active') 2061 .attr('aria-hidden', 'false'); 2062 2063 } else { 2064 2065 remainder = _.slideCount % _.options.slidesToShow; 2066 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 2067 2068 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 2069 2070 allSlides 2071 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 2072 .addClass('slick-active') 2073 .attr('aria-hidden', 'false'); 2074 2075 } else { 2076 2077 allSlides 2078 .slice(indexOffset, indexOffset + _.options.slidesToShow) 2079 .addClass('slick-active') 2080 .attr('aria-hidden', 'false'); 2081 2082 } 2083 2084 } 2085 2086 } 2087 2088 if (_.options.lazyLoad === 'ondemand') { 2089 _.lazyLoad(); 2090 } 2091 2092 }; 2093 2094 Slick.prototype.setupInfinite = function() { 2095 2096 var _ = this, 2097 i, slideIndex, infiniteCount; 2098 2099 if (_.options.fade === true) { 2100 _.options.centerMode = false; 2101 } 2102 2103 if (_.options.infinite === true && _.options.fade === false) { 2104 2105 slideIndex = null; 2106 2107 if (_.slideCount > _.options.slidesToShow) { 2108 2109 if (_.options.centerMode === true) { 2110 infiniteCount = _.options.slidesToShow + 1; 2111 } else { 2112 infiniteCount = _.options.slidesToShow; 2113 } 2114 2115 for (i = _.slideCount; i > (_.slideCount - 2116 infiniteCount); i -= 1) { 2117 slideIndex = i - 1; 2118 $(_.$slides[slideIndex]).clone(true).attr('id', '') 2119 .attr('data-slick-index', slideIndex - _.slideCount) 2120 .prependTo(_.$slideTrack).addClass('slick-cloned'); 2121 } 2122 for (i = 0; i < infiniteCount; i += 1) { 2123 slideIndex = i; 2124 $(_.$slides[slideIndex]).clone(true).attr('id', '') 2125 .attr('data-slick-index', slideIndex + _.slideCount) 2126 .appendTo(_.$slideTrack).addClass('slick-cloned'); 2127 } 2128 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 2129 $(this).attr('id', ''); 2130 }); 2131 2132 } 2133 2134 } 2135 2136 }; 2137 2138 Slick.prototype.setPaused = function(paused) { 2139 2140 var _ = this; 2141 2142 if (_.options.autoplay === true && _.options.pauseOnHover === true) { 2143 _.paused = paused; 2144 if (!paused) { 2145 _.autoPlay(); 2146 } else { 2147 _.autoPlayClear(); 2148 } 2149 } 2150 }; 2151 2152 Slick.prototype.selectHandler = function(event) { 2153 2154 var _ = this; 2155 2156 var targetElement = 2157 $(event.target).is('.slick-slide') ? 2158 $(event.target) : 2159 $(event.target).parents('.slick-slide'); 2160 2161 var index = parseInt(targetElement.attr('data-slick-index')); 2162 2163 if (!index) index = 0; 2164 2165 if (_.slideCount <= _.options.slidesToShow) { 2166 2167 _.setSlideClasses(index); 2168 _.asNavFor(index); 2169 return; 2170 2171 } 2172 2173 _.slideHandler(index); 2174 2175 }; 2176 2177 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 2178 2179 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 2180 _ = this; 2181 2182 sync = sync || false; 2183 2184 if (_.animating === true && _.options.waitForAnimate === true) { 2185 return; 2186 } 2187 2188 if (_.options.fade === true && _.currentSlide === index) { 2189 return; 2190 } 2191 2192 if (_.slideCount <= _.options.slidesToShow) { 2193 return; 2194 } 2195 2196 if (sync === false) { 2197 _.asNavFor(index); 2198 } 2199 2200 targetSlide = index; 2201 targetLeft = _.getLeft(targetSlide); 2202 slideLeft = _.getLeft(_.currentSlide); 2203 2204 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 2205 2206 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 2207 if (_.options.fade === false) { 2208 targetSlide = _.currentSlide; 2209 if (dontAnimate !== true) { 2210 _.animateSlide(slideLeft, function() { 2211 _.postSlide(targetSlide); 2212 }); 2213 } else { 2214 _.postSlide(targetSlide); 2215 } 2216 } 2217 return; 2218 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 2219 if (_.options.fade === false) { 2220 targetSlide = _.currentSlide; 2221 if (dontAnimate !== true) { 2222 _.animateSlide(slideLeft, function() { 2223 _.postSlide(targetSlide); 2224 }); 2225 } else { 2226 _.postSlide(targetSlide); 2227 } 2228 } 2229 return; 2230 } 2231 2232 if (_.options.autoplay === true) { 2233 clearInterval(_.autoPlayTimer); 2234 } 2235
vendor: 9,946 bytes, lines 2236-2566
2236 if (targetSlide < 0) { 2237 if (_.slideCount % _.options.slidesToScroll !== 0) { 2238 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 2239 } else { 2240 animSlide = _.slideCount + targetSlide; 2241 } 2242 } else if (targetSlide >= _.slideCount) { 2243 if (_.slideCount % _.options.slidesToScroll !== 0) { 2244 animSlide = 0; 2245 } else { 2246 animSlide = targetSlide - _.slideCount; 2247 } 2248 } else { 2249 animSlide = targetSlide; 2250 } 2251 2252 _.animating = true; 2253 2254 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 2255 2256 oldSlide = _.currentSlide; 2257 _.currentSlide = animSlide; 2258 2259 _.setSlideClasses(_.currentSlide); 2260 2261 _.updateDots(); 2262 _.updateArrows(); 2263 2264 if (_.options.fade === true) { 2265 if (dontAnimate !== true) { 2266 2267 _.fadeSlideOut(oldSlide); 2268 2269 _.fadeSlide(animSlide, function() { 2270 _.postSlide(animSlide); 2271 }); 2272 2273 } else { 2274 _.postSlide(animSlide); 2275 } 2276 _.animateHeight(); 2277 return; 2278 } 2279 2280 if (dontAnimate !== true) { 2281 _.animateSlide(targetLeft, function() { 2282 _.postSlide(animSlide); 2283 }); 2284 } else { 2285 _.postSlide(animSlide); 2286 } 2287 2288 }; 2289 2290 Slick.prototype.startLoad = function() { 2291 2292 var _ = this; 2293 2294 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 2295 2296 _.$prevArrow.hide(); 2297 _.$nextArrow.hide(); 2298 2299 } 2300 2301 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 2302 2303 _.$dots.hide(); 2304 2305 } 2306 2307 _.$slider.addClass('slick-loading'); 2308 2309 }; 2310 2311 Slick.prototype.swipeDirection = function() { 2312 2313 var xDist, yDist, r, swipeAngle, _ = this; 2314 2315 xDist = _.touchObject.startX - _.touchObject.curX; 2316 yDist = _.touchObject.startY - _.touchObject.curY; 2317 r = Math.atan2(yDist, xDist); 2318 2319 swipeAngle = Math.round(r * 180 / Math.PI); 2320 if (swipeAngle < 0) { 2321 swipeAngle = 360 - Math.abs(swipeAngle); 2322 } 2323 2324 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 2325 return (_.options.rtl === false ? 'left' : 'right'); 2326 } 2327 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 2328 return (_.options.rtl === false ? 'left' : 'right'); 2329 } 2330 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 2331 return (_.options.rtl === false ? 'right' : 'left'); 2332 } 2333 if (_.options.verticalSwiping === true) { 2334 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 2335 return 'left'; 2336 } else { 2337 return 'right'; 2338 } 2339 } 2340 2341 return 'vertical'; 2342 2343 }; 2344 2345 Slick.prototype.swipeEnd = function(event) { 2346 2347 var _ = this, 2348 slideCount; 2349 _.$list.removeClass('dragging') //CUSTOM 2350 _.dragging = false; 2351 2352 _.shouldClick = (_.touchObject.swipeLength > 10) ? false : true; 2353 2354 if (_.touchObject.curX === undefined) { 2355 return false; 2356 } 2357 2358 if (_.touchObject.edgeHit === true) { 2359 _.$slider.trigger('edge', [_, _.swipeDirection()]); 2360 } 2361 2362 if (_.touchObject.swipeLength >= _.touchObject.minSwipe) { 2363 2364 switch (_.swipeDirection()) { 2365 case 'left': 2366 slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide + _.getSlideCount()) : _.currentSlide + _.getSlideCount(); 2367 _.slideHandler(slideCount); 2368 _.currentDirection = 0; 2369 _.touchObject = {}; 2370 _.$slider.trigger('swipe', [_, 'left']); 2371 break; 2372 2373 case 'right': 2374 slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide - _.getSlideCount()) : _.currentSlide - _.getSlideCount(); 2375 _.slideHandler(slideCount); 2376 _.currentDirection = 1; 2377 _.touchObject = {}; 2378 _.$slider.trigger('swipe', [_, 'right']); 2379 break; 2380 } 2381 } else { 2382 if (_.touchObject.startX !== _.touchObject.curX) { 2383 _.slideHandler(_.currentSlide); 2384 _.touchObject = {}; 2385 } 2386 } 2387 2388 }; 2389 2390 Slick.prototype.swipeHandler = function(event) { 2391 2392 var _ = this; 2393 2394 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 2395 return; 2396 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 2397 return; 2398 } 2399 2400 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 2401 event.originalEvent.touches.length : 1; 2402 2403 _.touchObject.minSwipe = _.listWidth / _.options 2404 .touchThreshold; 2405 2406 if (_.options.verticalSwiping === true) { 2407 _.touchObject.minSwipe = _.listHeight / _.options 2408 .touchThreshold; 2409 } 2410 2411 switch (event.data.action) { 2412 2413 case 'start': 2414 _.swipeStart(event); 2415 break; 2416 2417 case 'move': 2418 _.swipeMove(event); 2419 break; 2420 2421 case 'end': 2422 _.swipeEnd(event); 2423 break; 2424 2425 } 2426 2427 }; 2428 2429 Slick.prototype.swipeMove = function(event) { 2430 2431 var _ = this, 2432 edgeWasHit = false, 2433 curLeft, swipeDirection, swipeLength, positionOffset, touches; 2434 2435 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 2436 2437 if (!_.dragging || touches && touches.length !== 1) { 2438 return false; 2439 } 2440 2441 curLeft = _.getLeft(_.currentSlide); 2442 2443 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 2444 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 2445 2446 _.touchObject.swipeLength = Math.round(Math.sqrt( 2447 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 2448 2449 if (_.options.verticalSwiping === true) { 2450 _.touchObject.swipeLength = Math.round(Math.sqrt( 2451 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 2452 } 2453 2454 swipeDirection = _.swipeDirection(); 2455 2456 if (swipeDirection === 'vertical') { 2457 return; 2458 } 2459 2460 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 2461 event.preventDefault(); 2462 } 2463 2464 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 2465 if (_.options.verticalSwiping === true) { 2466 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 2467 } 2468 2469 2470 swipeLength = _.touchObject.swipeLength; 2471 2472 _.touchObject.edgeHit = false; 2473 2474 if (_.options.infinite === false) { 2475 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 2476 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 2477 _.touchObject.edgeHit = true; 2478 } 2479 } 2480 2481 if (_.options.vertical === false) { 2482 _.swipeLeft = curLeft + swipeLength * positionOffset; 2483 } else { 2484 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 2485 } 2486 if (_.options.verticalSwiping === true) { 2487 _.swipeLeft = curLeft + swipeLength * positionOffset; 2488 } 2489 2490 if (_.options.fade === true || _.options.touchMove === false) { 2491 return false; 2492 } 2493 2494 if (_.animating === true) { 2495 _.swipeLeft = null; 2496 return false; 2497 } 2498 2499 _.setCSS(_.swipeLeft); 2500 2501 }; 2502 2503 Slick.prototype.swipeStart = function(event) { 2504 2505 var _ = this, 2506 touches; 2507 _.$list.addClass('dragging'); //CUSTOM 2508 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 2509 _.touchObject = {}; 2510 return false; 2511 } 2512 2513 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 2514 touches = event.originalEvent.touches[0]; 2515 } 2516 2517 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 2518 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 2519 2520 _.dragging = true; 2521 2522 }; 2523 2524 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 2525 2526 var _ = this; 2527 2528 if (_.$slidesCache !== null) { 2529 2530 _.unload(); 2531 2532 _.$slideTrack.children(this.options.slide).detach(); 2533 2534 _.$slidesCache.appendTo(_.$slideTrack); 2535 2536 _.reinit(); 2537 2538 } 2539 2540 }; 2541 2542 Slick.prototype.unload = function() { 2543 2544 var _ = this; 2545 2546 $('.slick-cloned', _.$slider).remove(); 2547 2548 if (_.$dots) { 2549 _.$dots.remove(); 2550 } 2551 2552 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 2553 _.$prevArrow.remove(); 2554 } 2555 2556 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 2557 _.$nextArrow.remove(); 2558 } 2559 2560 _.$slides 2561 .removeClass('slick-slide slick-active slick-visible slick-current') 2562 .attr('aria-hidden', 'true') 2563 .css('width', ''); 2564 2565 }; 2566
2567 Slick.prototype.unslick = function(fromBreakpoint) { 2568 2569 var _ = this; 2570 _.$slider.trigger('unslick', [_, fromBreakpoint]); 2571 _.destroy(); 2572 2573 }; 2574 2575 Slick.prototype.updateArrows = function() { 2576 2577 var _ = this, 2578 centerOffset; 2579 2580 centerOffset = Math.floor(_.options.slidesToShow / 2); 2581 2582 if ( _.options.arrows === true && 2583 _.slideCount > _.options.slidesToShow && 2584 !_.options.infinite ) { 2585 2586 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2587 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2588 2589 if (_.currentSlide === 0) { 2590 2591 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2592 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2593 2594 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 2595 2596 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2597 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2598 2599 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 2600 2601 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2602 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2603 2604 } 2605 2606 } 2607 2608 }; 2609 2610 Slick.prototype.updateDots = function() { 2611 2612 var _ = this; 2613 2614 if (_.$dots !== null) { 2615 2616 _.$dots 2617 .find('li') 2618 .removeClass('slick-active') 2619 .attr('aria-hidden', 'true'); 2620 2621 _.$dots 2622 .find('li') 2623 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 2624 .addClass('slick-active') 2625 .attr('aria-hidden', 'false'); 2626 2627 } 2628 2629 }; 2630 2631 Slick.prototype.visibility = function() { 2632 2633 var _ = this; 2634 2635 if (document[_.hidden]) { 2636 _.paused = true; 2637 _.autoPlayClear(); 2638 } else { 2639 if (_.options.autoplay === true) { 2640 _.paused = false; 2641 _.autoPlay(); 2642 } 2643 } 2644 2645 }; 2646 Slick.prototype.initADA = function() { 2647 var _ = this; 2648 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 2649 'aria-hidden': 'true', 2650 'tabindex': '-1' 2651 }).find('a, input, button, select').attr({ 2652 'tabindex': '-1' 2653 }); 2654 2655 _.$slideTrack.attr('role', 'listbox'); 2656 2657 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 2658 $(this).attr({ 2659 'role': 'option', 2660 'aria-describedby': 'slick-slide' + _.instanceUid + i + '' 2661 }); 2662 }); 2663 2664 if (_.$dots !== null) { 2665 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 2666 $(this).attr({ 2667 'role': 'presentation', 2668 'aria-selected': 'false', 2669 'aria-controls': 'navigation' + _.instanceUid + i + '', 2670 'id': 'slick-slide' + _.instanceUid + i + '' 2671 }); 2672 }) 2673 .first().attr('aria-selected', 'true').end() 2674 .find('button').attr('role', 'button').end() 2675 .closest('div').attr('role', 'toolbar'); 2676 } 2677 _.activateADA(); 2678 2679 }; 2680 2681 Slick.prototype.activateADA = function() { 2682 var _ = this; 2683 2684 _.$slideTrack.find('.slick-active').attr({ 2685 'aria-hidden': 'false' 2686 }).find('a, input, button, select').attr({ 2687 'tabindex': '0' 2688 }); 2689 2690 }; 2691 2692 Slick.prototype.focusHandler = function() { 2693 var _ = this; 2694 _.$slider.on('focus.slick blur.slick', '*', function(event) { 2695 event.stopImmediatePropagation(); 2696 var sf = $(this); 2697 setTimeout(function() { 2698 if (_.isPlay) { 2699 if (sf.is(':focus')) { 2700 _.autoPlayClear(); 2701 _.paused = true; 2702 } else { 2703 _.paused = false; 2704 _.autoPlay(); 2705 } 2706 } 2707 }, 0); 2708 }); 2709 }; 2710 2711 $.fn.slick = function() { 2712 var _ = this, 2713 opt = arguments[0], 2714 args = Array.prototype.slice.call(arguments, 1), 2715 l = _.length, 2716 i, 2717 ret; 2718 for (i = 0; i < l; i++) { 2719 if (typeof opt == 'object' || typeof opt == 'undefined') 2720 _[i].slick = new Slick(_[i], opt); 2721 else 2722 ret = _[i].slick[opt].apply(_[i].slick, args); 2723 if (typeof ret != 'undefined') return ret; 2724 } 2725 return _; 2726 }; 2727 2728}));; 2729'use strict'; 2730(function ($) { 2731 var SlickLightbox, defaults; 2732 SlickLightbox = function () { 2733 /* 2734 The core class. 2735 */ 2736 function SlickLightbox(element, options1) { 2737 var slickLightbox; 2738 this.options = options1; 2739 /* Binds the plugin. */ 2740 this.$element = $(element); 2741 this.didInit = false; 2742 slickLightbox = this; 2743 this.$element.on('click.slickLightbox', this.options.itemSelector, function (e) { 2744 var $clickedItem, $items; 2745 e.preventDefault(); 2746 $clickedItem = $(this); 2747 $clickedItem.blur(); 2748 if (typeof slickLightbox.options.shouldOpen === 'function') { 2749 if (!slickLightbox.options.shouldOpen(slickLightbox, $clickedItem, e)) { 2750 return; 2751 } 2752 } 2753 $items = slickLightbox.filterOutSlickClones(slickLightbox.$element.find(slickLightbox.options.itemSelector)); 2754 return slickLightbox.init($items.index($clickedItem)); 2755 }); 2756 } 2757 SlickLightbox.prototype.init = function (index) { 2758 /* Creates the lightbox, opens it, binds events and calls `slick`. Accepts `index` of the element, that triggered it (so that we know, on which slide to start slick). */ 2759 this.didInit = true; 2760 this.detectIE(); 2761 this.createModal(); 2762 this.bindEvents(); 2763 this.initSlick(index); 2764 return this.open(); 2765 }; 2766 SlickLightbox.prototype.createModalItems = function () { 2767 /* Creates individual slides to be used with slick. If `options.images` array is specified, it uses it's contents, otherwise loops through elements' `options.itemSelector`. */ 2768 var $items, createItem, length, links; 2769 if (this.options.images) { 2770 links = $.map(this.options.images, function (img) { 2771 return '<div class="slick-lightbox-slick-item"><div class="slick-lightbox-slick-item-inner"><img class="slick-lightbox-slick-img" src="' + img + '" /></div></div>'; 2772 }); 2773 } else { 2774 $items = this.filterOutSlickClones(this.$element.find(this.options.itemSelector)); 2775 length = $items.length; 2776 createItem = function (_this) { 2777 return function (el, index) { 2778 var caption, info, src; 2779 info = { 2780 index: index, 2781 length: length 2782 }; 2783 caption = _this.getElementCaption(el, info); 2784 src = _this.getElementSrc(el); 2785 if (_this.detectImage(src)) { 2786 return "<div class=\"slick-lightbox-slick-item\"><div class=\"slick-lightbox-slick-item-inner\"><img class=\"slick-lightbox-slick-img\" src=\"" + src + "\" />" + caption + "</div></div>"; 2787 } else { 2788 return "<div class=\"slick-lightbox-slick-item\"><div class=\"slick-lightbox-slick-item-inner iframe\"><div class=\"slick-lightbox-slick-iframe-wrap\"><iframe class=\"slick-lightbox-slick-iframe\" src=\"" + src + "\" frameborder=\"0\" allowfullscreen></iframe>" + caption + "</div></div></div>"; 2789 } 2790 }; 2791 }(this); 2792 links = $.map($items, createItem); 2793 } 2794 return links; 2795 }; 2796 SlickLightbox.prototype.createModal = function () { 2797 /* Creates a `slick`-friendly modal. */ 2798 var html, links; 2799 links = this.createModalItems();
2800 html = '<div class="slick-lightbox slick-lightbox-hide-init' + (this.isIE ? ' slick-lightbox-ie' : '') + '" style="background: ' + this.options.background + ';">\n <div class="slick-lightbox-inner">\n <div class="slick-lightbox-slick slick-caption-' + this.options.captionPosition + '">' + links.join('') + '</div>\n <div>\n<div>'; 2801 this.$modalElement = $(html); 2802 this.$parts = {}; 2803 this.$parts['closeButton'] = $(this.options.layouts.closeButton); 2804 this.$modalElement.find('.slick-lightbox-inner').append(this.$parts['closeButton']); 2805 return $('body').append(this.$modalElement); 2806 }; 2807 SlickLightbox.prototype.initSlick = function (index) { 2808 /* Runs slick by default, using `options.slick` if provided. If `options.slick` is a function, it gets fired instead of us initializing slick. Merges in initialSlide option. */ 2809 var additional; 2810 additional = { initialSlide: index }; 2811 if (this.options.slick != null) { 2812 if (typeof this.options.slick === 'function') { 2813 this.slick = this.options.slick(this.$modalElement); 2814 } else { 2815 this.slick = this.$modalElement.find('.slick-lightbox-slick').slick($.extend({}, this.options.slick, additional)); 2816 } 2817 } else { 2818 this.slick = this.$modalElement.find('.slick-lightbox-slick').slick(additional); 2819 } 2820 return this.$modalElement.trigger('init.slickLightbox'); 2821 }; 2822 SlickLightbox.prototype.open = function () { 2823 /* Opens the lightbox. */ 2824 if (this.options.useHistoryApi) { 2825 this.writeHistory(); 2826 } 2827 this.$element.trigger('show.slickLightbox'); 2828 setTimeout(function (_this) { 2829 return function () { 2830 return _this.$element.trigger('shown.slickLightbox'); 2831 }; 2832 }(this), this.getTransitionDuration()); 2833 return this.$modalElement.removeClass('slick-lightbox-hide-init'); 2834 }; 2835 SlickLightbox.prototype.close = function () { 2836 // remove autoplay string to prevent autoplay items from playing when opening a nonautoplay video 2837 $('.kaltura-auto').each(function(){ 2838 this.href = this.href.replace('[autoPlay]=true[streamerType]=auto', ''); 2839 }); 2840 /* Closes the lightbox and destroys it, maintaining the original element bindings. */ 2841 this.$element.trigger('hide.slickLightbox'); 2842 setTimeout(function (_this) { 2843 return function () { 2844 return _this.$element.trigger('hidden.slickLightbox'); 2845 }; 2846 }(this), this.getTransitionDuration()); 2847 this.$modalElement.addClass('slick-lightbox-hide'); 2848 return this.destroy(); 2849 }; 2850 SlickLightbox.prototype.bindEvents = function () { 2851 /* Binds global events. */ 2852 var resizeSlides; 2853 resizeSlides = function (_this) { 2854 return function () { 2855 var h; 2856 h = _this.$modalElement.find('.slick-lightbox-inner').height(); 2857 _this.$modalElement.find('.slick-lightbox-slick-item').height(h); 2858 return _this.$modalElement.find('.slick-lightbox-slick-img, .slick-lightbox-slick-item-inner').css('max-height', Math.round(_this.options.imageMaxHeight * h)); 2859 }; 2860 }(this); 2861 $(window).on('orientationchange.slickLightbox resize.slickLightbox', resizeSlides); 2862 if (this.options.useHistoryApi) { 2863 $(window).on('popstate.slickLightbox', function (_this) { 2864 return function () { 2865 return _this.close(); 2866 }; 2867 }(this)); 2868 } 2869 this.$modalElement.on('init.slickLightbox', resizeSlides); 2870 this.$modalElement.on('destroy.slickLightbox', function (_this) { 2871 return function () { 2872 return _this.destroy(); 2873 }; 2874 }(this)); 2875 this.$element.on('destroy.slickLightbox', function (_this) { 2876 return function () { 2877 return _this.destroy(true); 2878 }; 2879 }(this)); 2880 this.$parts['closeButton'].on('click.slickLightbox touchstart.slickLightbox', function (_this) { 2881 return function (e) { 2882 e.preventDefault(); 2883 return _this.close(); 2884 }; 2885 }(this)); 2886 if (this.options.closeOnEscape || this.options.navigateByKeyboard) { 2887 $(document).on('keydown.slickLightbox', function (_this) { 2888 return function (e) { 2889 var code; 2890 code = e.keyCode ? e.keyCode : e.which; 2891 if (_this.options.navigateByKeyboard) { 2892 if (code === 37) { 2893 _this.slideSlick('left'); 2894 } else if (code === 39) { 2895 _this.slideSlick('right'); 2896 } 2897 } 2898 if (_this.options.closeOnEscape) { 2899 if (code === 27) { 2900 return _this.close(); 2901 } 2902 } 2903 }; 2904 }(this)); 2905 } 2906 if (this.options.closeOnBackdropClick) { 2907 this.$modalElement.on('click.slickLightbox touchstart.slickLightbox', '.slick-lightbox-slick-img', function (e) { 2908 return e.stopPropagation(); 2909 }); 2910 return this.$modalElement.on('click.slickLightbox', '.slick-lightbox-slick-item', function (_this) { 2911 return function (e) { 2912 e.preventDefault(); 2913 return _this.close(); 2914 }; 2915 }(this)); 2916 } 2917 }; 2918 SlickLightbox.prototype.slideSlick = function (direction) { 2919 /* Moves the slick prev or next. */ 2920 if (direction === 'left') { 2921 return this.slick.slick('slickPrev'); 2922 } else { 2923 return this.slick.slick('slickNext'); 2924 } 2925 }; 2926 SlickLightbox.prototype.detectIE = function () { 2927 /* Detects usage of IE8 and lower. */ 2928 var ieversion; 2929 this.isIE = false; 2930 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 2931 ieversion = new Number(RegExp.$1); 2932 if (ieversion < 9) { 2933 return this.isIE = true; 2934 } 2935 } 2936 }; 2937 SlickLightbox.prototype.getElementCaption = function (el, info) { 2938 /* Returns caption for each slide based on the type of `options.caption`. */ 2939 var c; 2940 if (!this.options.caption) { 2941 return ''; 2942 } 2943 c = function () { 2944 switch (typeof this.options.caption) { 2945 case 'function': 2946 return this.options.caption(el, info); 2947 case 'string': 2948 return $(el).data(this.options.caption); 2949 } 2950 }.call(this); 2951 return '<span class="slick-lightbox-slick-caption">' + c + '</span>'; 2952 }; 2953 SlickLightbox.prototype.getElementSrc = function (el) { 2954 /* Returns src for each slide image based on the type of `options.src`. */ 2955 switch (typeof this.options.src) { 2956 case 'function': 2957 return this.options.src(el); 2958 case 'string': 2959 return $(el).attr(this.options.src); 2960 default: 2961 return el.href; 2962 } 2963 }; 2964 SlickLightbox.prototype.detectImage = function(url) { 2965 /* Returns true if finds image file extension */ 2966 return url.match(/\.(jpeg|jpg|gif|png)$/) !== null; 2967 }; 2968 SlickLightbox.prototype.unbindEvents = function () { 2969 /* Unbinds global events. */ 2970 $(window).off('.slickLightbox'); 2971 $(document).off('.slickLightbox'); 2972 return this.$modalElement.off('.slickLightbox'); 2973 }; 2974 SlickLightbox.prototype.destroy = function (unbindAnchors) { 2975 if (unbindAnchors == null) { 2976 unbindAnchors = false; 2977 } 2978 /* Destroys the lightbox and unbinds global events. If `true` is passed as an argument, unbinds the original element as well. */ 2979 if (this.didInit) { 2980 this.unbindEvents(); 2981 setTimeout(function (_this) { 2982 return function () { 2983 return _this.$modalElement.remove(); 2984 }; 2985 }(this), this.options.destroyTimeout); 2986 } 2987 if (unbindAnchors) { 2988 this.$element.off('.slickLightbox'); 2989 return this.$element.off('.slickLightbox', this.options.itemSelector); 2990 } 2991 }; 2992 SlickLightbox.prototype.destroyPrevious = function () { 2993 /* Destroys lightboxes currently in DOM. */ 2994 return $('body').children('.slick-lightbox').trigger('destroy.slickLightbox'); 2995 }; 2996 SlickLightbox.prototype.getTransitionDuration = function () { 2997 /* Detects the transition duration to know when to remove stuff from DOM etc. */ 2998 var duration; 2999 // if (this.transitionDuration) { 3000 // return this.transitionDuration; 3001 // } 3002 // duration = this.$modalElement.css('transition-duration'); 3003 duration = 0; 3004 // if (typeof duration === 'undefined') { 3005 // return this.transitionDuration = 500; 3006 // } else { 3007 // return this.transitionDuration = duration.indexOf('ms') > -1 ? parseFloat(duration) : parseFloat(duration) * 1000; 3008 // } 3009 }; 3010 SlickLightbox.prototype.writeHistory = function () { 3011 /* Writes an empty state to the history API if supported. */ 3012 return typeof history !== 'undefined' && history !== null ? typeof history.pushState === 'function' ? history.pushState(null, null, '') : void 0 : void 0; 3013 }; 3014 SlickLightbox.prototype.filterOutSlickClones = function ($items) { 3015 /* Removes all slick clones from the set of elements. Only does so, if the target element is a slick slider. */ 3016 if (!this.$element.hasClass('slick-slider')) { 3017 return $items; 3018 } 3019 return $items = $items.filter(function () { 3020 var $item; 3021 $item = $(this); 3022 return !$item.hasClass('slick-cloned') && $item.parents('.slick-cloned').length === 0; 3023 }); 3024 }; 3025 return SlickLightbox; 3026 }(); 3027 defaults = { 3028 background: 'rgba(0,0,0,.8)', 3029 closeOnEscape: true, 3030 closeOnBackdropClick: true, 3031 destroyTimeout: 500, 3032 itemSelector: 'a', 3033 navigateByKeyboard: true, 3034 src: false, 3035 caption: false, 3036 captionPosition: 'dynamic', 3037 images: false, 3038 slick: {}, 3039 useHistoryApi: false, 3040 layouts: { closeButton: '<button type="button" class="slick-lightbox-close"></button>' }, 3041 shouldOpen: null, 3042 imageMaxHeight: 0.9 3043 }; 3044 $.fn.slickLightbox = function (options) { 3045 /* Fires the plugin. */ 3046 options = $.extend({}, defaults, options); 3047 $(this).each(function () { 3048 return this.slickLightbox = new SlickLightbox(this, options); 3049 }); 3050 return this; 3051 }; 3052 $.fn.unslickLightbox = function () { 3053 /* Removes everything. */ 3054 return $(this).trigger('destroy.slickLightbox').each(function () { 3055 return this.slickLightbox = null; 3056 }); 3057 }; 3058}(jQuery)); 3059; 3060/*! 3061 * Select2 4.0.12 3062 * https://select2.github.io 3063 * 3064 * Released under the MIT license 3065 * https://github.com/select2/select2/blob/master/LICENSE.md 3066 */ 3067;(function (factory) { 3068 if (typeof define === 'function' && define.amd) { 3069 // AMD. Register as an anonymous module. 3070 define(['jquery'], factory); 3071 } else if (typeof module === 'object' && module.exports) { 3072 // Node/CommonJS 3073 module.exports = function (root, jQuery) { 3074 if (jQuery === undefined) { 3075 // require('jQuery') returns a factory that requires window to 3076 // build a jQuery instance, we normalize how we use modules 3077 // that require this pattern but the window provided is a noop 3078 // if it's defined (how jquery works) 3079 if (typeof window !== 'undefined') { 3080 jQuery = require('jquery'); 3081 } 3082 else { 3083 jQuery = require('jquery')(root); 3084 } 3085 } 3086 factory(jQuery); 3087 return jQuery; 3088 }; 3089 } else { 3090 // Browser globals 3091 factory(jQuery); 3092 } 3093} (function (jQuery) { 3094 // This is needed so we can catch the AMD loader configuration and use it 3095 // The inner file should be wrapped (by `banner.start.js`) in a function that 3096 // returns the AMD loader references. 3097 var S2 =(function () { 3098 // Restore the Select2 AMD loader so it can be used 3099 // Needed mostly in the language files, where the loader is not inserted 3100 if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { 3101 var S2 = jQuery.fn.select2.amd; 3102 } 3103var S2;(function () { if (!S2 || !S2.requirejs) { 3104if (!S2) { S2 = {}; } else { require = S2; } 3105/** 3106 * @license almond 0.3.3 Copyright jQuery Foundation and other contributors. 3107 * Released under MIT license, http://github.com/requirejs/almond/LICENSE 3108 */ 3109//Going sloppy to avoid 'use strict' string cost, but strict practices should 3110//be followed. 3111/*global setTimeout: false */ 3112 3113var requirejs, require, define; 3114(function (undef) { 3115 var main, req, makeMap, handlers, 3116 defined = {}, 3117 waiting = {}, 3118 config = {}, 3119 defining = {}, 3120 hasOwn = Object.prototype.hasOwnProperty, 3121 aps = [].slice, 3122 jsSuffixRegExp = /\.js$/; 3123 3124 function hasProp(obj, prop) { 3125 return hasOwn.call(obj, prop); 3126 } 3127 3128 /** 3129 * Given a relative module name, like ./something, normalize it to 3130 * a real name that can be mapped to a path. 3131 * @param {String} name the relative name 3132 * @param {String} baseName a real name that the name arg is relative 3133 * to. 3134 * @returns {String} normalized name 3135 */ 3136 function normalize(name, baseName) { 3137 var nameParts, nameSegment, mapValue, foundMap, lastIndex, 3138 foundI, foundStarMap, starI, i, j, part, normalizedBaseParts, 3139 baseParts = baseName && baseName.split("/"), 3140 map = config.map, 3141 starMap = (map && map['*']) || {}; 3142 3143 //Adjust any relative paths. 3144 if (name) { 3145 name = name.split('/'); 3146 lastIndex = name.length - 1; 3147 3148 // If wanting node ID compatibility, strip .js from end 3149 // of IDs. Have to do this here, and not in nameToUrl 3150 // because node allows either .js or non .js to map 3151 // to same file. 3152 if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { 3153 name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); 3154 } 3155 3156 // Starts with a '.' so need the baseName 3157 if (name[0].charAt(0) === '.' && baseParts) { 3158 //Convert baseName to array, and lop off the last part, 3159 //so that . matches that 'directory' and not name of the baseName's 3160 //module. For instance, baseName of 'one/two/three', maps to 3161 //'one/two/three.js', but we want the directory, 'one/two' for 3162 //this normalization. 3163 normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); 3164
vendor: 1,949 bytes, lines 3164-3209
3164 name = normalizedBaseParts.concat(name); 3165 } 3166 3167 //start trimDots 3168 for (i = 0; i < name.length; i++) { 3169 part = name[i]; 3170 if (part === '.') { 3171 name.splice(i, 1); 3172 i -= 1; 3173 } else if (part === '..') { 3174 // If at the start, or previous value is still .., 3175 // keep them so that when converted to a path it may 3176 // still work when converted to a path, even though 3177 // as an ID it is less than ideal. In larger point 3178 // releases, may be better to just kick out an error. 3179 if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') { 3180 continue; 3181 } else if (i > 0) { 3182 name.splice(i - 1, 2); 3183 i -= 2; 3184 } 3185 } 3186 } 3187 //end trimDots 3188 3189 name = name.join('/'); 3190 } 3191 3192 //Apply map config if available. 3193 if ((baseParts || starMap) && map) { 3194 nameParts = name.split('/'); 3195 3196 for (i = nameParts.length; i > 0; i -= 1) { 3197 nameSegment = nameParts.slice(0, i).join("/"); 3198 3199 if (baseParts) { 3200 //Find the longest baseName segment match in the config. 3201 //So, do joins on the biggest to smallest lengths of baseParts. 3202 for (j = baseParts.length; j > 0; j -= 1) { 3203 mapValue = map[baseParts.slice(0, j).join('/')]; 3204 3205 //baseName segment has config, find if it has one for 3206 //this name. 3207 if (mapValue) { 3208 mapValue = mapValue[nameSegment]; 3209 if (mapValue) {
vendor: 16,384 bytes, lines 3210-3738
3210 //Match, update name to the new value. 3211 foundMap = mapValue; 3212 foundI = i; 3213 break; 3214 } 3215 } 3216 } 3217 } 3218 3219 if (foundMap) { 3220 break; 3221 } 3222 3223 //Check for a star map match, but just hold on to it, 3224 //if there is a shorter segment match later in a matching 3225 //config, then favor over this star map. 3226 if (!foundStarMap && starMap && starMap[nameSegment]) { 3227 foundStarMap = starMap[nameSegment]; 3228 starI = i; 3229 } 3230 } 3231 3232 if (!foundMap && foundStarMap) { 3233 foundMap = foundStarMap; 3234 foundI = starI; 3235 } 3236 3237 if (foundMap) { 3238 nameParts.splice(0, foundI, foundMap); 3239 name = nameParts.join('/'); 3240 } 3241 } 3242 3243 return name; 3244 } 3245 3246 function makeRequire(relName, forceSync) { 3247 return function () { 3248 //A version of a require function that passes a moduleName 3249 //value for items that may need to 3250 //look up paths relative to the moduleName 3251 var args = aps.call(arguments, 0); 3252 3253 //If first arg is not require('string'), and there is only 3254 //one arg, it is the array form without a callback. Insert 3255 //a null so that the following concat is correct. 3256 if (typeof args[0] !== 'string' && args.length === 1) { 3257 args.push(null); 3258 } 3259 return req.apply(undef, args.concat([relName, forceSync])); 3260 }; 3261 } 3262 3263 function makeNormalize(relName) { 3264 return function (name) { 3265 return normalize(name, relName); 3266 }; 3267 } 3268 3269 function makeLoad(depName) { 3270 return function (value) { 3271 defined[depName] = value; 3272 }; 3273 } 3274 3275 function callDep(name) { 3276 if (hasProp(waiting, name)) { 3277 var args = waiting[name]; 3278 delete waiting[name]; 3279 defining[name] = true; 3280 main.apply(undef, args); 3281 } 3282 3283 if (!hasProp(defined, name) && !hasProp(defining, name)) { 3284 throw new Error('No ' + name); 3285 } 3286 return defined[name]; 3287 } 3288 3289 //Turns a plugin!resource to [plugin, resource] 3290 //with the plugin being undefined if the name 3291 //did not have a plugin prefix. 3292 function splitPrefix(name) { 3293 var prefix, 3294 index = name ? name.indexOf('!') : -1; 3295 if (index > -1) { 3296 prefix = name.substring(0, index); 3297 name = name.substring(index + 1, name.length); 3298 } 3299 return [prefix, name]; 3300 } 3301 3302 //Creates a parts array for a relName where first part is plugin ID, 3303 //second part is resource ID. Assumes relName has already been normalized. 3304 function makeRelParts(relName) { 3305 return relName ? splitPrefix(relName) : []; 3306 } 3307 3308 /** 3309 * Makes a name map, normalizing the name, and using a plugin 3310 * for normalization if necessary. Grabs a ref to plugin 3311 * too, as an optimization. 3312 */ 3313 makeMap = function (name, relParts) { 3314 var plugin, 3315 parts = splitPrefix(name), 3316 prefix = parts[0], 3317 relResourceName = relParts[1]; 3318 3319 name = parts[1]; 3320 3321 if (prefix) { 3322 prefix = normalize(prefix, relResourceName); 3323 plugin = callDep(prefix); 3324 } 3325 3326 //Normalize according 3327 if (prefix) { 3328 if (plugin && plugin.normalize) { 3329 name = plugin.normalize(name, makeNormalize(relResourceName)); 3330 } else { 3331 name = normalize(name, relResourceName); 3332 } 3333 } else { 3334 name = normalize(name, relResourceName); 3335 parts = splitPrefix(name); 3336 prefix = parts[0]; 3337 name = parts[1]; 3338 if (prefix) { 3339 plugin = callDep(prefix); 3340 } 3341 } 3342 3343 //Using ridiculous property names for space reasons 3344 return { 3345 f: prefix ? prefix + '!' + name : name, //fullName 3346 n: name, 3347 pr: prefix, 3348 p: plugin 3349 }; 3350 }; 3351 3352 function makeConfig(name) { 3353 return function () { 3354 return (config && config.config && config.config[name]) || {}; 3355 }; 3356 } 3357 3358 handlers = { 3359 require: function (name) { 3360 return makeRequire(name); 3361 }, 3362 exports: function (name) { 3363 var e = defined[name]; 3364 if (typeof e !== 'undefined') { 3365 return e; 3366 } else { 3367 return (defined[name] = {}); 3368 } 3369 }, 3370 module: function (name) { 3371 return { 3372 id: name, 3373 uri: '', 3374 exports: defined[name], 3375 config: makeConfig(name) 3376 }; 3377 } 3378 }; 3379 3380 main = function (name, deps, callback, relName) { 3381 var cjsModule, depName, ret, map, i, relParts, 3382 args = [], 3383 callbackType = typeof callback, 3384 usingExports; 3385 3386 //Use name if no relName 3387 relName = relName || name; 3388 relParts = makeRelParts(relName); 3389 3390 //Call the callback to define the module, if necessary. 3391 if (callbackType === 'undefined' || callbackType === 'function') { 3392 //Pull out the defined dependencies and pass the ordered 3393 //values to the callback. 3394 //Default to [require, exports, module] if no deps 3395 deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; 3396 for (i = 0; i < deps.length; i += 1) { 3397 map = makeMap(deps[i], relParts); 3398 depName = map.f; 3399 3400 //Fast path CommonJS standard dependencies. 3401 if (depName === "require") { 3402 args[i] = handlers.require(name); 3403 } else if (depName === "exports") { 3404 //CommonJS module spec 1.1 3405 args[i] = handlers.exports(name); 3406 usingExports = true; 3407 } else if (depName === "module") { 3408 //CommonJS module spec 1.1 3409 cjsModule = args[i] = handlers.module(name); 3410 } else if (hasProp(defined, depName) || 3411 hasProp(waiting, depName) || 3412 hasProp(defining, depName)) { 3413 args[i] = callDep(depName); 3414 } else if (map.p) { 3415 map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); 3416 args[i] = defined[depName]; 3417 } else { 3418 throw new Error(name + ' missing ' + depName); 3419 } 3420 } 3421 3422 ret = callback ? callback.apply(defined[name], args) : undefined; 3423 3424 if (name) { 3425 //If setting exports via "module" is in play, 3426 //favor that over return value and exports. After that, 3427 //favor a non-undefined return value over exports use. 3428 if (cjsModule && cjsModule.exports !== undef && 3429 cjsModule.exports !== defined[name]) { 3430 defined[name] = cjsModule.exports; 3431 } else if (ret !== undef || !usingExports) { 3432 //Use the return value from the function. 3433 defined[name] = ret; 3434 } 3435 } 3436 } else if (name) { 3437 //May just be an object definition for the module. Only 3438 //worry about defining if have a module name. 3439 defined[name] = callback; 3440 } 3441 }; 3442 3443 requirejs = require = req = function (deps, callback, relName, forceSync, alt) { 3444 if (typeof deps === "string") { 3445 if (handlers[deps]) { 3446 //callback in this case is really relName 3447 return handlers[deps](callback); 3448 } 3449 //Just return the module wanted. In this scenario, the 3450 //deps arg is the module name, and second arg (if passed) 3451 //is just the relName. 3452 //Normalize module name, if it contains . or .. 3453 return callDep(makeMap(deps, makeRelParts(callback)).f); 3454 } else if (!deps.splice) { 3455 //deps is a config object, not an array. 3456 config = deps; 3457 if (config.deps) { 3458 req(config.deps, config.callback); 3459 } 3460 if (!callback) { 3461 return; 3462 } 3463 3464 if (callback.splice) { 3465 //callback is an array, which means it is a dependency list. 3466 //Adjust args if there are dependencies 3467 deps = callback; 3468 callback = relName; 3469 relName = null; 3470 } else { 3471 deps = undef; 3472 } 3473 } 3474 3475 //Support require(['a']) 3476 callback = callback || function () {}; 3477 3478 //If relName is a function, it is an errback handler, 3479 //so remove it. 3480 if (typeof relName === 'function') { 3481 relName = forceSync; 3482 forceSync = alt; 3483 } 3484 3485 //Simulate async callback; 3486 if (forceSync) { 3487 main(undef, deps, callback, relName); 3488 } else { 3489 //Using a non-zero value because of concern for what old browsers 3490 //do, and latest browsers "upgrade" to 4 if lower value is used: 3491 //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: 3492 //If want a value immediately, use require('id') instead -- something 3493 //that works in almond on the global level, but not guaranteed and 3494 //unlikely to work in other AMD implementations. 3495 setTimeout(function () { 3496 main(undef, deps, callback, relName); 3497 }, 4); 3498 } 3499 3500 return req; 3501 }; 3502 3503 /** 3504 * Just drops the config on the floor, but returns req in case 3505 * the config return value is used. 3506 */ 3507 req.config = function (cfg) { 3508 return req(cfg); 3509 }; 3510 3511 /** 3512 * Expose module registry for debugging and tooling 3513 */ 3514 requirejs._defined = defined; 3515 3516 define = function (name, deps, callback) { 3517 if (typeof name !== 'string') { 3518 throw new Error('See almond README: incorrect module build, no module name'); 3519 } 3520 3521 //This module may not have dependencies 3522 if (!deps.splice) { 3523 //deps is not an array, so probably means 3524 //an object literal or factory function for 3525 //the value. Adjust args. 3526 callback = deps; 3527 deps = []; 3528 } 3529 3530 if (!hasProp(defined, name) && !hasProp(waiting, name)) { 3531 waiting[name] = [name, deps, callback]; 3532 } 3533 }; 3534 3535 define.amd = { 3536 jQuery: true 3537 }; 3538}()); 3539 3540S2.requirejs = requirejs;S2.require = require;S2.define = define; 3541} 3542}()); 3543S2.define("almond", function(){}); 3544 3545/* global jQuery:false, $:false */ 3546S2.define('jquery',[],function () { 3547 var _$ = jQuery || $; 3548 3549 if (_$ == null && console && console.error) { 3550 console.error( 3551 'Select2: An instance of jQuery or a jQuery-compatible library was not ' + 3552 'found. Make sure that you are including jQuery before Select2 on your ' + 3553 'web page.' 3554 ); 3555 } 3556 3557 return _$; 3558}); 3559 3560S2.define('select2/utils',[ 3561 'jquery' 3562], function ($) { 3563 var Utils = {}; 3564 3565 Utils.Extend = function (ChildClass, SuperClass) { 3566 var __hasProp = {}.hasOwnProperty; 3567 3568 function BaseConstructor () { 3569 this.constructor = ChildClass; 3570 } 3571 3572 for (var key in SuperClass) { 3573 if (__hasProp.call(SuperClass, key)) { 3574 ChildClass[key] = SuperClass[key]; 3575 } 3576 } 3577 3578 BaseConstructor.prototype = SuperClass.prototype; 3579 ChildClass.prototype = new BaseConstructor(); 3580 ChildClass.__super__ = SuperClass.prototype; 3581 3582 return ChildClass; 3583 }; 3584 3585 function getMethods (theClass) { 3586 var proto = theClass.prototype; 3587 3588 var methods = []; 3589 3590 for (var methodName in proto) { 3591 var m = proto[methodName]; 3592 3593 if (typeof m !== 'function') { 3594 continue; 3595 } 3596 3597 if (methodName === 'constructor') { 3598 continue; 3599 } 3600 3601 methods.push(methodName); 3602 } 3603 3604 return methods; 3605 } 3606 3607 Utils.Decorate = function (SuperClass, DecoratorClass) { 3608 var decoratedMethods = getMethods(DecoratorClass); 3609 var superMethods = getMethods(SuperClass); 3610 3611 function DecoratedClass () { 3612 var unshift = Array.prototype.unshift; 3613 3614 var argCount = DecoratorClass.prototype.constructor.length; 3615 3616 var calledConstructor = SuperClass.prototype.constructor; 3617 3618 if (argCount > 0) { 3619 unshift.call(arguments, SuperClass.prototype.constructor); 3620 3621 calledConstructor = DecoratorClass.prototype.constructor; 3622 } 3623 3624 calledConstructor.apply(this, arguments); 3625 } 3626 3627 DecoratorClass.displayName = SuperClass.displayName; 3628 3629 function ctr () { 3630 this.constructor = DecoratedClass; 3631 } 3632 3633 DecoratedClass.prototype = new ctr(); 3634 3635 for (var m = 0; m < superMethods.length; m++) { 3636 var superMethod = superMethods[m]; 3637 3638 DecoratedClass.prototype[superMethod] = 3639 SuperClass.prototype[superMethod]; 3640 } 3641 3642 var calledMethod = function (methodName) { 3643 // Stub out the original method if it's not decorating an actual method 3644 var originalMethod = function () {}; 3645 3646 if (methodName in DecoratedClass.prototype) { 3647 originalMethod = DecoratedClass.prototype[methodName]; 3648 } 3649 3650 var decoratedMethod = DecoratorClass.prototype[methodName]; 3651 3652 return function () { 3653 var unshift = Array.prototype.unshift; 3654 3655 unshift.call(arguments, originalMethod); 3656 3657 return decoratedMethod.apply(this, arguments); 3658 }; 3659 }; 3660 3661 for (var d = 0; d < decoratedMethods.length; d++) { 3662 var decoratedMethod = decoratedMethods[d]; 3663 3664 DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); 3665 } 3666 3667 return DecoratedClass; 3668 }; 3669 3670 var Observable = function () { 3671 this.listeners = {}; 3672 }; 3673 3674 Observable.prototype.on = function (event, callback) { 3675 this.listeners = this.listeners || {}; 3676 3677 if (event in this.listeners) { 3678 this.listeners[event].push(callback); 3679 } else { 3680 this.listeners[event] = [callback]; 3681 } 3682 }; 3683 3684 Observable.prototype.trigger = function (event) { 3685 var slice = Array.prototype.slice; 3686 var params = slice.call(arguments, 1); 3687 3688 this.listeners = this.listeners || {}; 3689 3690 // Params should always come in as an array 3691 if (params == null) { 3692 params = []; 3693 } 3694 3695 // If there are no arguments to the event, use a temporary object 3696 if (params.length === 0) { 3697 params.push({}); 3698 } 3699 3700 // Set the `_type` of the first object to the event 3701 params[0]._type = event; 3702 3703 if (event in this.listeners) { 3704 this.invoke(this.listeners[event], slice.call(arguments, 1)); 3705 } 3706 3707 if ('*' in this.listeners) { 3708 this.invoke(this.listeners['*'], arguments); 3709 } 3710 }; 3711 3712 Observable.prototype.invoke = function (listeners, params) { 3713 for (var i = 0, len = listeners.length; i < len; i++) { 3714 listeners[i].apply(this, params); 3715 } 3716 }; 3717 3718 Utils.Observable = Observable; 3719 3720 Utils.generateChars = function (length) { 3721 var chars = ''; 3722 3723 for (var i = 0; i < length; i++) { 3724 var randomChar = Math.floor(Math.random() * 36); 3725 chars += randomChar.toString(36); 3726 } 3727 3728 return chars; 3729 }; 3730 3731 Utils.bind = function (func, context) { 3732 return function () { 3733 func.apply(context, arguments); 3734 }; 3735 }; 3736 3737 Utils._convertData = function (data) { 3738 for (var originalKe
3738y in data) { 3739 var keys = originalKey.split('-'); 3740 3741 var dataLevel = data; 3742 3743 if (keys.length === 1) { 3744 continue; 3745 } 3746 3747 for (var k = 0; k < keys.length; k++) { 3748 var key = keys[k]; 3749 3750 // Lowercase the first letter 3751 // By default, dash-separated becomes camelCase 3752 key = key.substring(0, 1).toLowerCase() + key.substring(1); 3753 3754 if (!(key in dataLevel)) { 3755 dataLevel[key] = {}; 3756 } 3757 3758 if (k == keys.length - 1) { 3759 dataLevel[key] = data[originalKey]; 3760 } 3761 3762 dataLevel = dataLevel[key]; 3763 } 3764 3765 delete data[originalKey]; 3766 } 3767 3768 return data; 3769 }; 3770 3771 Utils.hasScroll = function (index, el) { 3772 // Adapted from the function created by @ShadowScripter 3773 // and adapted by @BillBarry on the Stack Exchange Code Review website. 3774 // The original code can be found at 3775 // http://codereview.stackexchange.com/q/13338 3776 // and was designed to be used with the Sizzle selector engine. 3777 3778 var $el = $(el); 3779 var overflowX = el.style.overflowX; 3780 var overflowY = el.style.overflowY; 3781 3782 //Check both x and y declarations 3783 if (overflowX === overflowY && 3784 (overflowY === 'hidden' || overflowY === 'visible')) { 3785 return false; 3786 } 3787 3788 if (overflowX === 'scroll' || overflowY === 'scroll') { 3789 return true; 3790 } 3791 3792 return ($el.innerHeight() < el.scrollHeight || 3793 $el.innerWidth() < el.scrollWidth); 3794 }; 3795 3796 Utils.escapeMarkup = function (markup) { 3797 var replaceMap = { 3798 '\\': '\', 3799 '&': '&', 3800 '<': '<', 3801 '>': '>', 3802 '"': '"', 3803 '\'': ''', 3804 '/': '/' 3805 }; 3806 3807 // Do not try to escape the markup if it's not a string 3808 if (typeof markup !== 'string') { 3809 return markup; 3810 } 3811 3812 return String(markup).replace(/[&<>"'\/\\]/g, function (match) { 3813 return replaceMap[match]; 3814 }); 3815 }; 3816 3817 // Append an array of jQuery nodes to a given element. 3818 Utils.appendMany = function ($element, $nodes) { 3819 // jQuery 1.7.x does not support $.fn.append() with an array 3820 // Fall back to a jQuery object collection using $.fn.add() 3821 if ($.fn.jquery.substr(0, 3) === '1.7') { 3822 var $jqNodes = $(); 3823 3824 $.map($nodes, function (node) { 3825 $jqNodes = $jqNodes.add(node); 3826 }); 3827 3828 $nodes = $jqNodes; 3829 } 3830 3831 $element.append($nodes); 3832 }; 3833 3834 // Cache objects in Utils.__cache instead of $.data (see #4346) 3835 Utils.__cache = {}; 3836 3837 var id = 0; 3838 Utils.GetUniqueElementId = function (element) { 3839 // Get a unique element Id. If element has no id, 3840 // creates a new unique number, stores it in the id 3841 // attribute and returns the new id. 3842 // If an id already exists, it simply returns it. 3843 3844 var select2Id = element.getAttribute('data-select2-id'); 3845 if (select2Id == null) { 3846 // If element has id, use it. 3847 if (element.id) { 3848 select2Id = element.id; 3849 element.setAttribute('data-select2-id', select2Id); 3850 } else { 3851 element.setAttribute('data-select2-id', ++id); 3852 select2Id = id.toString(); 3853 } 3854 } 3855 return select2Id; 3856 }; 3857 3858 Utils.StoreData = function (element, name, value) { 3859 // Stores an item in the cache for a specified element. 3860 // name is the cache key. 3861 var id = Utils.GetUniqueElementId(element); 3862 if (!Utils.__cache[id]) { 3863 Utils.__cache[id] = {}; 3864 } 3865 3866 Utils.__cache[id][name] = value; 3867 }; 3868 3869 Utils.GetData = function (element, name) { 3870 // Retrieves a value from the cache by its key (name) 3871 // name is optional. If no name specified, return 3872 // all cache items for the specified element. 3873 // and for a specified element. 3874 var id = Utils.GetUniqueElementId(element); 3875 if (name) { 3876 if (Utils.__cache[id]) { 3877 if (Utils.__cache[id][name] != null) { 3878 return Utils.__cache[id][name]; 3879 } 3880 return $(element).data(name); // Fallback to HTML5 data attribs. 3881 } 3882 return $(element).data(name); // Fallback to HTML5 data attribs. 3883 } else { 3884 return Utils.__cache[id]; 3885 } 3886 }; 3887 3888 Utils.RemoveData = function (element) { 3889 // Removes all cached items for a specified element. 3890 var id = Utils.GetUniqueElementId(element); 3891 if (Utils.__cache[id] != null) { 3892 delete Utils.__cache[id]; 3893 } 3894 3895 element.removeAttribute('data-select2-id'); 3896 }; 3897 3898 return Utils; 3899}); 3900 3901S2.define('select2/results',[ 3902 'jquery', 3903 './utils' 3904], function ($, Utils) { 3905 function Results ($element, options, dataAdapter) { 3906 this.$element = $element; 3907 this.data = dataAdapter; 3908 this.options = options; 3909 3910 Results.__super__.constructor.call(this); 3911 } 3912 3913 Utils.Extend(Results, Utils.Observable); 3914 3915 Results.prototype.render = function () { 3916 var $results = $( 3917 '<ul class="select2-results__options" role="listbox"></ul>' 3918 ); 3919 3920 if (this.options.get('multiple')) { 3921 $results.attr('aria-multiselectable', 'true'); 3922 } 3923 3924 this.$results = $results; 3925 3926 return $results; 3927 }; 3928 3929 Results.prototype.clear = function () { 3930 this.$results.empty(); 3931 }; 3932 3933 Results.prototype.displayMessage = function (params) { 3934 var escapeMarkup = this.options.get('escapeMarkup'); 3935 3936 this.clear(); 3937 this.hideLoading(); 3938 3939 var $message = $( 3940 '<li role="alert" aria-live="assertive"' + 3941 ' class="select2-results__option"></li>' 3942 ); 3943 3944 var message = this.options.get('translations').get(params.message); 3945 3946 $message.append( 3947 escapeMarkup( 3948 message(params.args) 3949 ) 3950 ); 3951 3952 $message[0].className += ' select2-results__message'; 3953 3954 this.$results.append($message); 3955 }; 3956 3957 Results.prototype.hideMessages = function () { 3958 this.$results.find('.select2-results__message').remove(); 3959 }; 3960 3961 Results.prototype.append = function (data) { 3962 this.hideLoading(); 3963 3964 var $options = []; 3965 3966 if (data.results == null || data.results.length === 0) { 3967 if (this.$results.children().length === 0) { 3968 this.trigger('results:message', { 3969 message: 'noResults' 3970 }); 3971 } 3972 3973 return; 3974 } 3975 3976 data.results = this.sort(data.results); 3977 3978 for (var d = 0; d < data.results.length; d++) { 3979 var item = data.results[d]; 3980 3981 var $option = this.option(item); 3982 3983 $options.push($option); 3984 } 3985 3986 this.$results.append($options); 3987 }; 3988 3989 Results.prototype.position = function ($results, $dropdown) { 3990 var $resultsContainer = $dropdown.find('.select2-results'); 3991 $resultsContainer.append($results); 3992 }; 3993 3994 Results.prototype.sort = function (data) { 3995 var sorter = this.options.get('sorter'); 3996 3997 return sorter(data); 3998 }; 3999 4000 Results.prototype.highlightFirstItem = function () { 4001 var $options = this.$results 4002 .find('.select2-results__option[aria-selected]'); 4003 4004 var $selected = $options.filter('[aria-selected=true]'); 4005 4006 // Check if there are any selected options 4007 if ($selected.length > 0) { 4008 // If there are selected options, highlight the first 4009 $selected.first().trigger('mouseenter'); 4010 } else { 4011 // If there are no selected options, highlight the first option 4012 // in the dropdown 4013 $options.first().trigger('mouseenter'); 4014 } 4015 4016 this.ensureHighlightVisible(); 4017 }; 4018 4019 Results.prototype.setClasses = function () { 4020 var self = this; 4021 4022 this.data.current(function (selected) { 4023 var selectedIds = $.map(selected, function (s) { 4024 return s.id.toString(); 4025 }); 4026 4027 var $options = self.$results 4028 .find('.select2-results__option[aria-selected]'); 4029 4030 $options.each(function () { 4031 var $option = $(this); 4032 4033 var item = Utils.GetData(this, 'data'); 4034 4035 // id needs to be converted to a string when comparing 4036 var id = '' + item.id; 4037 4038 if ((item.element != null && item.element.selected) || 4039 (item.element == null && $.inArray(id, selectedIds) > -1)) { 4040 $option.attr('aria-selected', 'true'); 4041 } else { 4042 $option.attr('aria-selected', 'false'); 4043 } 4044 }); 4045 4046 });
4047 }; 4048 4049 Results.prototype.showLoading = function (params) { 4050 this.hideLoading(); 4051 4052 var loadingMore = this.options.get('translations').get('searching'); 4053 4054 var loading = { 4055 disabled: true, 4056 loading: true, 4057 text: loadingMore(params) 4058 }; 4059 var $loading = this.option(loading); 4060 $loading.className += ' loading-results'; 4061 4062 this.$results.prepend($loading); 4063 }; 4064 4065 Results.prototype.hideLoading = function () { 4066 this.$results.find('.loading-results').remove(); 4067 }; 4068 4069 Results.prototype.option = function (data) { 4070 var option = document.createElement('li'); 4071 option.className = 'select2-results__option'; 4072 4073 var attrs = { 4074 'role': 'option', 4075 'aria-selected': 'false' 4076 }; 4077 4078 var matches = window.Element.prototype.matches || 4079 window.Element.prototype.msMatchesSelector || 4080 window.Element.prototype.webkitMatchesSelector; 4081 4082 if ((data.element != null && matches.call(data.element, ':disabled')) || 4083 (data.element == null && data.disabled)) { 4084 delete attrs['aria-selected']; 4085 attrs['aria-disabled'] = 'true'; 4086 } 4087 4088 if (data.id == null) { 4089 delete attrs['aria-selected']; 4090 } 4091 4092 if (data._resultId != null) { 4093 option.id = data._resultId; 4094 } 4095 4096 if (data.title) { 4097 option.title = data.title; 4098 } 4099 4100 if (data.children) { 4101 attrs.role = 'group'; 4102 attrs['aria-label'] = data.text; 4103 delete attrs['aria-selected']; 4104 } 4105 4106 for (var attr in attrs) { 4107 var val = attrs[attr]; 4108 4109 option.setAttribute(attr, val); 4110 } 4111 4112 if (data.children) { 4113 var $option = $(option); 4114 4115 var label = document.createElement('strong'); 4116 label.className = 'select2-results__group'; 4117 4118 var $label = $(label); 4119 this.template(data, label); 4120 4121 var $children = []; 4122 4123 for (var c = 0; c < data.children.length; c++) { 4124 var child = data.children[c]; 4125 4126 var $child = this.option(child); 4127 4128 $children.push($child); 4129 } 4130 4131 var $childrenContainer = $('<ul></ul>', { 4132 'class': 'select2-results__options select2-results__options--nested' 4133 }); 4134 4135 $childrenContainer.append($children); 4136 4137 $option.append(label); 4138 $option.append($childrenContainer); 4139 } else { 4140 this.template(data, option); 4141 } 4142 4143 Utils.StoreData(option, 'data', data); 4144 4145 return option; 4146 }; 4147 4148 Results.prototype.bind = function (container, $container) { 4149 var self = this; 4150 4151 var id = container.id + '-results'; 4152 4153 this.$results.attr('id', id); 4154 4155 container.on('results:all', function (params) { 4156 self.clear(); 4157 self.append(params.data); 4158 4159 if (container.isOpen()) { 4160 self.setClasses(); 4161 self.highlightFirstItem(); 4162 } 4163 }); 4164 4165 container.on('results:append', function (params) { 4166 self.append(params.data); 4167 4168 if (container.isOpen()) { 4169 self.setClasses(); 4170 } 4171 }); 4172 4173 container.on('query', function (params) { 4174 self.hideMessages(); 4175 self.showLoading(params); 4176 }); 4177 4178 container.on('select', function () { 4179 if (!container.isOpen()) { 4180 return; 4181 } 4182 4183 self.setClasses(); 4184 4185 if (self.options.get('scrollAfterSelect')) { 4186 self.highlightFirstItem(); 4187 } 4188 }); 4189 4190 container.on('unselect', function () { 4191 if (!container.isOpen()) { 4192 return; 4193 } 4194 4195 self.setClasses(); 4196 4197 if (self.options.get('scrollAfterSelect')) { 4198 self.highlightFirstItem(); 4199 } 4200 }); 4201 4202 container.on('open', function () { 4203 // When the dropdown is open, aria-expended="true" 4204 self.$results.attr('aria-expanded', 'true'); 4205 self.$results.attr('aria-hidden', 'false'); 4206 4207 self.setClasses(); 4208 self.ensureHighlightVisible(); 4209 }); 4210 4211 container.on('close', function () { 4212 // When the dropdown is closed, aria-expended="false" 4213 self.$results.attr('aria-expanded', 'false'); 4214 self.$results.attr('aria-hidden', 'true'); 4215 self.$results.removeAttr('aria-activedescendant'); 4216 });
vendor: 8,268 bytes, lines 4217-4530
4217 4218 container.on('results:toggle', function () { 4219 var $highlighted = self.getHighlightedResults(); 4220 4221 if ($highlighted.length === 0) { 4222 return; 4223 } 4224 4225 $highlighted.trigger('mouseup'); 4226 }); 4227 4228 container.on('results:select', function () { 4229 var $highlighted = self.getHighlightedResults(); 4230 4231 if ($highlighted.length === 0) { 4232 return; 4233 } 4234 4235 var data = Utils.GetData($highlighted[0], 'data'); 4236 4237 if ($highlighted.attr('aria-selected') == 'true') { 4238 self.trigger('close', {}); 4239 } else { 4240 self.trigger('select', { 4241 data: data 4242 }); 4243 } 4244 }); 4245 4246 container.on('results:previous', function () { 4247 var $highlighted = self.getHighlightedResults(); 4248 4249 var $options = self.$results.find('[aria-selected]'); 4250 4251 var currentIndex = $options.index($highlighted); 4252 4253 // If we are already at the top, don't move further 4254 // If no options, currentIndex will be -1 4255 if (currentIndex <= 0) { 4256 return; 4257 } 4258 4259 var nextIndex = currentIndex - 1; 4260 4261 // If none are highlighted, highlight the first 4262 if ($highlighted.length === 0) { 4263 nextIndex = 0; 4264 } 4265 4266 var $next = $options.eq(nextIndex); 4267 4268 $next.trigger('mouseenter'); 4269 4270 var currentOffset = self.$results.offset().top; 4271 var nextTop = $next.offset().top; 4272 var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); 4273 4274 if (nextIndex === 0) { 4275 self.$results.scrollTop(0); 4276 } else if (nextTop - currentOffset < 0) { 4277 self.$results.scrollTop(nextOffset); 4278 } 4279 }); 4280 4281 container.on('results:next', function () { 4282 var $highlighted = self.getHighlightedResults(); 4283 4284 var $options = self.$results.find('[aria-selected]'); 4285 4286 var currentIndex = $options.index($highlighted); 4287 4288 var nextIndex = currentIndex + 1; 4289 4290 // If we are at the last option, stay there 4291 if (nextIndex >= $options.length) { 4292 return; 4293 } 4294 4295 var $next = $options.eq(nextIndex); 4296 4297 $next.trigger('mouseenter'); 4298 4299 var currentOffset = self.$results.offset().top + 4300 self.$results.outerHeight(false); 4301 var nextBottom = $next.offset().top + $next.outerHeight(false); 4302 var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; 4303 4304 if (nextIndex === 0) { 4305 self.$results.scrollTop(0); 4306 } else if (nextBottom > currentOffset) { 4307 self.$results.scrollTop(nextOffset); 4308 } 4309 }); 4310 4311 container.on('results:focus', function (params) { 4312 params.element.addClass('select2-results__option--highlighted'); 4313 }); 4314 4315 container.on('results:message', function (params) { 4316 self.displayMessage(params); 4317 }); 4318 4319 if ($.fn.mousewheel) { 4320 this.$results.on('mousewheel', function (e) { 4321 var top = self.$results.scrollTop(); 4322 4323 var bottom = self.$results.get(0).scrollHeight - top + e.deltaY; 4324 4325 var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; 4326 var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); 4327 4328 if (isAtTop) { 4329 self.$results.scrollTop(0); 4330 4331 e.preventDefault(); 4332 e.stopPropagation(); 4333 } else if (isAtBottom) { 4334 self.$results.scrollTop( 4335 self.$results.get(0).scrollHeight - self.$results.height() 4336 ); 4337 4338 e.preventDefault(); 4339 e.stopPropagation(); 4340 } 4341 }); 4342 } 4343 4344 this.$results.on('mouseup', '.select2-results__option[aria-selected]', 4345 function (evt) { 4346 var $this = $(this); 4347 4348 var data = Utils.GetData(this, 'data'); 4349 4350 if ($this.attr('aria-selected') === 'true') { 4351 if (self.options.get('multiple')) { 4352 self.trigger('unselect', { 4353 originalEvent: evt, 4354 data: data 4355 }); 4356 } else { 4357 self.trigger('close', {}); 4358 } 4359 4360 return; 4361 } 4362 4363 self.trigger('select', { 4364 originalEvent: evt, 4365 data: data 4366 }); 4367 }); 4368 4369 this.$results.on('mouseenter', '.select2-results__option[aria-selected]', 4370 function (evt) { 4371 var data = Utils.GetData(this, 'data'); 4372 4373 self.getHighlightedResults() 4374 .removeClass('select2-results__option--highlighted'); 4375 4376 self.trigger('results:focus', { 4377 data: data, 4378 element: $(this) 4379 }); 4380 }); 4381 }; 4382 4383 Results.prototype.getHighlightedResults = function () { 4384 var $highlighted = this.$results 4385 .find('.select2-results__option--highlighted'); 4386 4387 return $highlighted; 4388 }; 4389 4390 Results.prototype.destroy = function () { 4391 this.$results.remove(); 4392 }; 4393 4394 Results.prototype.ensureHighlightVisible = function () { 4395 var $highlighted = this.getHighlightedResults(); 4396 4397 if ($highlighted.length === 0) { 4398 return; 4399 } 4400 4401 var $options = this.$results.find('[aria-selected]'); 4402 4403 var currentIndex = $options.index($highlighted); 4404 4405 var currentOffset = this.$results.offset().top; 4406 var nextTop = $highlighted.offset().top; 4407 var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); 4408 4409 var offsetDelta = nextTop - currentOffset; 4410 nextOffset -= $highlighted.outerHeight(false) * 2; 4411 4412 if (currentIndex <= 2) { 4413 this.$results.scrollTop(0); 4414 } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { 4415 this.$results.scrollTop(nextOffset); 4416 } 4417 }; 4418 4419 Results.prototype.template = function (result, container) { 4420 var template = this.options.get('templateResult'); 4421 var escapeMarkup = this.options.get('escapeMarkup'); 4422 4423 var content = template(result, container); 4424 4425 if (content == null) { 4426 container.style.display = 'none'; 4427 } else if (typeof content === 'string') { 4428 container.innerHTML = escapeMarkup(content); 4429 } else { 4430 $(container).append(content); 4431 } 4432 }; 4433 4434 return Results; 4435}); 4436 4437S2.define('select2/keys',[ 4438 4439], function () { 4440 var KEYS = { 4441 BACKSPACE: 8, 4442 TAB: 9, 4443 ENTER: 13, 4444 SHIFT: 16, 4445 CTRL: 17, 4446 ALT: 18, 4447 ESC: 27, 4448 SPACE: 32, 4449 PAGE_UP: 33, 4450 PAGE_DOWN: 34, 4451 END: 35, 4452 HOME: 36, 4453 LEFT: 37, 4454 UP: 38, 4455 RIGHT: 39, 4456 DOWN: 40, 4457 DELETE: 46 4458 }; 4459 4460 return KEYS; 4461}); 4462 4463S2.define('select2/selection/base',[ 4464 'jquery', 4465 '../utils', 4466 '../keys' 4467], function ($, Utils, KEYS) { 4468 function BaseSelection ($element, options) { 4469 this.$element = $element; 4470 this.options = options; 4471 4472 BaseSelection.__super__.constructor.call(this); 4473 } 4474 4475 Utils.Extend(BaseSelection, Utils.Observable); 4476 4477 BaseSelection.prototype.render = function () { 4478 var $selection = $( 4479 '<span class="select2-selection" role="combobox" ' + 4480 ' aria-haspopup="true" aria-expanded="false">' + 4481 '</span>' 4482 ); 4483 4484 this._tabindex = 0; 4485 4486 if (Utils.GetData(this.$element[0], 'old-tabindex') != null) { 4487 this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex'); 4488 } else if (this.$element.attr('tabindex') != null) { 4489 this._tabindex = this.$element.attr('tabindex'); 4490 } 4491 4492 $selection.attr('title', this.$element.attr('title')); 4493 $selection.attr('tabindex', this._tabindex); 4494 $selection.attr('aria-disabled', 'false'); 4495 4496 this.$selection = $selection; 4497 4498 return $selection; 4499 }; 4500 4501 BaseSelection.prototype.bind = function (container, $container) { 4502 var self = this; 4503 4504 var resultsId = container.id + '-results'; 4505 4506 this.container = container; 4507 4508 this.$selection.on('focus', function (evt) { 4509 self.trigger('focus', evt); 4510 }); 4511 4512 this.$selection.on('blur', function (evt) { 4513 self._handleBlur(evt); 4514 }); 4515 4516 this.$selection.on('keydown', function (evt) { 4517 self.trigger('keypress', evt); 4518 4519 if (evt.which === KEYS.SPACE) { 4520 evt.preventDefault(); 4521 } 4522 }); 4523 4524 container.on('results:focus', function (params) { 4525 self.$selection.attr('aria-activedescendant', params.data._resultId); 4526 }); 4527 4528 container.on('selection:update', function (params) { 4529 self.update(params.data); 4530 });
4531 4532 container.on('open', function () { 4533 // When the dropdown is open, aria-expanded="true" 4534 self.$selection.attr('aria-expanded', 'true'); 4535 self.$selection.attr('aria-owns', resultsId); 4536 4537 self._attachCloseHandler(container); 4538 }); 4539 4540 container.on('close', function () { 4541 // When the dropdown is closed, aria-expanded="false" 4542 self.$selection.attr('aria-expanded', 'false'); 4543 self.$selection.removeAttr('aria-activedescendant'); 4544 self.$selection.removeAttr('aria-owns'); 4545 4546 self.$selection.trigger('focus'); 4547 4548 self._detachCloseHandler(container); 4549 }); 4550 4551 container.on('enable', function () { 4552 self.$selection.attr('tabindex', self._tabindex); 4553 self.$selection.attr('aria-disabled', 'false'); 4554 }); 4555 4556 container.on('disable', function () { 4557 self.$selection.attr('tabindex', '-1'); 4558 self.$selection.attr('aria-disabled', 'true'); 4559 }); 4560 }; 4561 4562 BaseSelection.prototype._handleBlur = function (evt) { 4563 var self = this; 4564 4565 // This needs to be delayed as the active element is the body when the tab 4566 // key is pressed, possibly along with others. 4567 window.setTimeout(function () { 4568 // Don't trigger `blur` if the focus is still in the selection 4569 if ( 4570 (document.activeElement == self.$selection[0]) || 4571 ($.contains(self.$selection[0], document.activeElement)) 4572 ) { 4573 return; 4574 } 4575 4576 self.trigger('blur', evt); 4577 }, 1); 4578 }; 4579 4580 BaseSelection.prototype._attachCloseHandler = function (container) { 4581 4582 $(document.body).on('mousedown.select2.' + container.id, function (e) { 4583 var $target = $(e.target); 4584 4585 var $select = $target.closest('.select2'); 4586 4587 var $all = $('.select2.select2-container--open'); 4588 4589 $all.each(function () { 4590 if (this == $select[0]) { 4591 return; 4592 } 4593 4594 var $element = Utils.GetData(this, 'element'); 4595 4596 $element.select2('close'); 4597 }); 4598 }); 4599 }; 4600 4601 BaseSelection.prototype._detachCloseHandler = function (container) { 4602 $(document.body).off('mousedown.select2.' + container.id); 4603 }; 4604 4605 BaseSelection.prototype.position = function ($selection, $container) { 4606 var $selectionContainer = $container.find('.selection'); 4607 $selectionContainer.append($selection); 4608 }; 4609 4610 BaseSelection.prototype.destroy = function () { 4611 this._detachCloseHandler(this.container); 4612 }; 4613 4614 BaseSelection.prototype.update = function (data) { 4615 throw new Error('The `update` method must be defined in child classes.'); 4616 }; 4617 4618 return BaseSelection; 4619}); 4620 4621S2.define('select2/selection/single',[ 4622 'jquery', 4623 './base', 4624 '../utils', 4625 '../keys' 4626], function ($, BaseSelection, Utils, KEYS) { 4627 function SingleSelection () { 4628 SingleSelection.__super__.constructor.apply(this, arguments); 4629 } 4630 4631 Utils.Extend(SingleSelection, BaseSelection); 4632 4633 SingleSelection.prototype.render = function () { 4634 var $selection = SingleSelection.__super__.render.call(this); 4635 4636 $selection.addClass('select2-selection--single'); 4637 4638 $selection.html( 4639 '<span class="select2-selection__rendered"></span>' + 4640 '<span class="select2-selection__arrow" role="presentation">' + 4641 '<b role="presentation"></b>' + 4642 '</span>' 4643 ); 4644 4645 return $selection; 4646 }; 4647 4648 SingleSelection.prototype.bind = function (container, $container) { 4649 var self = this; 4650 4651 SingleSelection.__super__.bind.apply(this, arguments); 4652 4653 var id = container.id + '-container'; 4654 4655 this.$selection.find('.select2-selection__rendered') 4656 .attr('id', id) 4657 .attr('role', 'textbox') 4658 .attr('aria-readonly', 'true'); 4659 this.$selection.attr('aria-labelledby', id); 4660 4661 this.$selection.on('mousedown', function (evt) { 4662 // Only respond to left clicks 4663 if (evt.which !== 1) { 4664 return; 4665 } 4666 4667 self.trigger('toggle', { 4668 originalEvent: evt 4669 }); 4670 }); 4671 4672 this.$selection.on('focus', function (evt) { 4673 // User focuses on the container 4674 });
4675 4676 this.$selection.on('blur', function (evt) { 4677 // User exits the container 4678 }); 4679 4680 container.on('focus', function (evt) { 4681 if (!container.isOpen()) { 4682 self.$selection.trigger('focus'); 4683 } 4684 }); 4685 }; 4686 4687 SingleSelection.prototype.clear = function () { 4688 var $rendered = this.$selection.find('.select2-selection__rendered'); 4689 $rendered.empty(); 4690 $rendered.removeAttr('title'); // clear tooltip on empty 4691 }; 4692 4693 SingleSelection.prototype.display = function (data, container) { 4694 var template = this.options.get('templateSelection'); 4695 var escapeMarkup = this.options.get('escapeMarkup'); 4696 4697 return escapeMarkup(template(data, container)); 4698 }; 4699 4700 SingleSelection.prototype.selectionContainer = function () { 4701 return $('<span></span>'); 4702 }; 4703 4704 SingleSelection.prototype.update = function (data) { 4705 if (data.length === 0) { 4706 this.clear(); 4707 return; 4708 } 4709 4710 var selection = data[0]; 4711 4712 var $rendered = this.$selection.find('.select2-selection__rendered'); 4713 var formatted = this.display(selection, $rendered); 4714 4715 $rendered.empty().append(formatted); 4716 4717 var title = selection.title || selection.text; 4718 4719 if (title) { 4720 $rendered.attr('title', title); 4721 } else { 4722 $rendered.removeAttr('title'); 4723 } 4724 }; 4725 4726 return SingleSelection; 4727}); 4728 4729S2.define('select2/selection/multiple',[ 4730 'jquery', 4731 './base', 4732 '../utils' 4733], function ($, BaseSelection, Utils) { 4734 function MultipleSelection ($element, options) { 4735 MultipleSelection.__super__.constructor.apply(this, arguments); 4736 } 4737 4738 Utils.Extend(MultipleSelection, BaseSelection); 4739 4740 MultipleSelection.prototype.render = function () { 4741 var $selection = MultipleSelection.__super__.render.call(this); 4742 4743 $selection.addClass('select2-selection--multiple'); 4744 4745 $selection.html( 4746 '<ul class="select2-selection__rendered"></ul>' 4747 ); 4748 4749 return $selection; 4750 }; 4751 4752 MultipleSelection.prototype.bind = function (container, $container) { 4753 var self = this; 4754 4755 MultipleSelection.__super__.bind.apply(this, arguments); 4756 4757 this.$selection.on('click', function (evt) { 4758 self.trigger('toggle', { 4759 originalEvent: evt 4760 }); 4761 }); 4762 4763 this.$selection.on( 4764 'click', 4765 '.select2-selection__choice__remove', 4766 function (evt) { 4767 // Ignore the event if it is disabled 4768 if (self.options.get('disabled')) { 4769 return; 4770 } 4771 4772 var $remove = $(this); 4773 var $selection = $remove.parent(); 4774 4775 var data = Utils.GetData($selection[0], 'data'); 4776 4777 self.trigger('unselect', { 4778 originalEvent: evt, 4779 data: data 4780 }); 4781 } 4782 ); 4783 }; 4784 4785 MultipleSelection.prototype.clear = function () { 4786 var $rendered = this.$selection.find('.select2-selection__rendered'); 4787 $rendered.empty(); 4788 $rendered.removeAttr('title'); 4789 }; 4790 4791 MultipleSelection.prototype.display = function (data, container) { 4792 var template = this.options.get('templateSelection'); 4793 var escapeMarkup = this.options.get('escapeMarkup'); 4794 4795 return escapeMarkup(template(data, container)); 4796 }; 4797 4798 MultipleSelection.prototype.selectionContainer = function () { 4799 var $container = $( 4800 '<li class="select2-selection__choice">' + 4801 '<span class="select2-selection__choice__remove" role="presentation">' + 4802 '×' + 4803 '</span>' + 4804 '</li>' 4805 ); 4806 4807 return $container; 4808 }; 4809 4810 MultipleSelection.prototype.update = function (data) { 4811 this.clear(); 4812 4813 if (data.length === 0) { 4814 return; 4815 } 4816 4817 var $selections = []; 4818 4819 for (var d = 0; d < data.length; d++) { 4820 var selection = data[d]; 4821 4822 var $selection = this.selectionContainer(); 4823 var formatted = this.display(selection, $selection); 4824 4825 $selection.append(formatted); 4826 4827 var title = selection.title || selection.text; 4828 4829 if (title) { 4830 $selection.attr('title', title); 4831 } 4832 4833 Utils.StoreData($selection[0], 'data', selection); 4834 4835 $selections.push($selection); 4836 } 4837 4838 var $rendered = this.$selection.find('.select2-selection__rendered'); 4839 4840 Utils.appendMany($rendered, $selections); 4841 }; 4842 4843 return MultipleSelection; 4844}); 4845 4846S2.define('select2/selection/placeholder',[ 4847 '../utils' 4848], function (Utils) { 4849 function Placeholder (decorated, $element, options) { 4850 this.placeholder = this.normalizePlaceholder(options.get('placeholder')); 4851 4852 decorated.call(this, $element, options); 4853 } 4854 4855 Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { 4856 if (typeof placeholder === 'string') { 4857 placeholder = { 4858 id: '', 4859 text: placeholder 4860 }; 4861 } 4862 4863 return placeholder; 4864 }; 4865 4866 Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { 4867 var $placeholder = this.selectionContainer(); 4868 4869 $placeholder.html(this.display(placeholder));
4870 $placeholder.addClass('select2-selection__placeholder') 4871 .removeClass('select2-selection__choice'); 4872 4873 return $placeholder; 4874 }; 4875 4876 Placeholder.prototype.update = function (decorated, data) { 4877 var singlePlaceholder = ( 4878 data.length == 1 && data[0].id != this.placeholder.id 4879 ); 4880 var multipleSelections = data.length > 1; 4881 4882 if (multipleSelections || singlePlaceholder) { 4883 return decorated.call(this, data); 4884 } 4885 4886 this.clear(); 4887 4888 var $placeholder = this.createPlaceholder(this.placeholder); 4889 4890 this.$selection.find('.select2-selection__rendered').append($placeholder); 4891 }; 4892 4893 return Placeholder; 4894}); 4895 4896S2.define('select2/selection/allowClear',[ 4897 'jquery', 4898 '../keys', 4899 '../utils' 4900], function ($, KEYS, Utils) { 4901 function AllowClear () { } 4902 4903 AllowClear.prototype.bind = function (decorated, container, $container) { 4904 var self = this; 4905 4906 decorated.call(this, container, $container); 4907 4908 if (this.placeholder == null) { 4909 if (this.options.get('debug') && window.console && console.error) { 4910 console.error( 4911 'Select2: The `allowClear` option should be used in combination ' + 4912 'with the `placeholder` option.' 4913 ); 4914 } 4915 } 4916 4917 this.$selection.on('mousedown', '.select2-selection__clear', 4918 function (evt) { 4919 self._handleClear(evt); 4920 }); 4921 4922 container.on('keypress', function (evt) { 4923 self._handleKeyboardClear(evt, container); 4924 }); 4925 }; 4926 4927 AllowClear.prototype._handleClear = function (_, evt) { 4928 // Ignore the event if it is disabled 4929 if (this.options.get('disabled')) { 4930 return; 4931 } 4932 4933 var $clear = this.$selection.find('.select2-selection__clear'); 4934 4935 // Ignore the event if nothing has been selected 4936 if ($clear.length === 0) { 4937 return; 4938 } 4939 4940 evt.stopPropagation(); 4941 4942 var data = Utils.GetData($clear[0], 'data'); 4943 4944 var previousVal = this.$element.val(); 4945 this.$element.val(this.placeholder.id); 4946 4947 var unselectData = { 4948 data: data 4949 }; 4950 this.trigger('clear', unselectData); 4951 if (unselectData.prevented) { 4952 this.$element.val(previousVal); 4953 return; 4954 } 4955 4956 for (var d = 0; d < data.length; d++) { 4957 unselectData = { 4958 data: data[d] 4959 }; 4960 4961 // Trigger the `unselect` event, so people can prevent it from being 4962 // cleared. 4963 this.trigger('unselect', unselectData); 4964 4965 // If the event was prevented, don't clear it out. 4966 if (unselectData.prevented) { 4967 this.$element.val(previousVal); 4968 return; 4969 } 4970 } 4971 4972 this.$element.trigger('change'); 4973 4974 this.trigger('toggle', {}); 4975 }; 4976 4977 AllowClear.prototype._handleKeyboardClear = function (_, evt, container) { 4978 if (container.isOpen()) { 4979 return; 4980 } 4981 4982 if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) { 4983 this._handleClear(evt); 4984 } 4985 }; 4986 4987 AllowClear.prototype.update = function (decorated, data) { 4988 decorated.call(this, data); 4989 4990 if (this.$selection.find('.select2-selection__placeholder').length > 0 || 4991 data.length === 0) { 4992 return; 4993 } 4994 4995 var removeAll = this.options.get('translations').get('removeAllItems'); 4996 4997 var $remove = $( 4998 '<span class="select2-selection__clear" title="' + removeAll() +'">' + 4999 '×' + 5000 '</span>' 5001 ); 5002 Utils.StoreData($remove[0], 'data', data); 5003 5004 this.$selection.find('.select2-selection__rendered').prepend($remove); 5005 }; 5006 5007 return AllowClear; 5008}); 5009 5010S2.define('select2/selection/search',[ 5011 'jquery', 5012 '../utils', 5013 '../keys' 5014], function ($, Utils, KEYS) { 5015 function Search (decorated, $element, options) { 5016 decorated.call(this, $element, options); 5017 } 5018 5019 Search.prototype.render = function (decorated) { 5020 var $search = $( 5021 '<li class="select2-search select2-search--inline">' + 5022 '<input class="select2-search__field" type="search" tabindex="-1"' + 5023 ' autocomplete="off" autocorrect="off" autocapitalize="none"' + 5024 ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + 5025 '</li>' 5026 ); 5027 5028 this.$searchContainer = $search; 5029 this.$search = $search.find('input'); 5030 5031 var $rendered = decorated.call(this); 5032 5033 this._transferTabIndex(); 5034 5035 return $rendered; 5036 }; 5037 5038 Search.prototype.bind = function (decorated, container, $container) { 5039 var self = this; 5040 5041 var resultsId = container.id + '-results'; 5042 5043 decorated.call(this, container, $container); 5044 5045 container.on('open', function () { 5046 self.$search.attr('aria-controls', resultsId); 5047 self.$search.trigger('focus'); 5048 });
vendor: 20,159 bytes, lines 5049-5949
5049 5050 container.on('close', function () { 5051 self.$search.val(''); 5052 self.$search.removeAttr('aria-controls'); 5053 self.$search.removeAttr('aria-activedescendant'); 5054 self.$search.trigger('focus'); 5055 }); 5056 5057 container.on('enable', function () { 5058 self.$search.prop('disabled', false); 5059 5060 self._transferTabIndex(); 5061 }); 5062 5063 container.on('disable', function () { 5064 self.$search.prop('disabled', true); 5065 }); 5066 5067 container.on('focus', function (evt) { 5068 self.$search.trigger('focus'); 5069 }); 5070 5071 container.on('results:focus', function (params) { 5072 if (params.data._resultId) { 5073 self.$search.attr('aria-activedescendant', params.data._resultId); 5074 } else { 5075 self.$search.removeAttr('aria-activedescendant'); 5076 } 5077 }); 5078 5079 this.$selection.on('focusin', '.select2-search--inline', function (evt) { 5080 self.trigger('focus', evt); 5081 }); 5082 5083 this.$selection.on('focusout', '.select2-search--inline', function (evt) { 5084 self._handleBlur(evt); 5085 }); 5086 5087 this.$selection.on('keydown', '.select2-search--inline', function (evt) { 5088 evt.stopPropagation(); 5089 5090 self.trigger('keypress', evt); 5091 5092 self._keyUpPrevented = evt.isDefaultPrevented(); 5093 5094 var key = evt.which; 5095 5096 if (key === KEYS.BACKSPACE && self.$search.val() === '') { 5097 var $previousChoice = self.$searchContainer 5098 .prev('.select2-selection__choice'); 5099 5100 if ($previousChoice.length > 0) { 5101 var item = Utils.GetData($previousChoice[0], 'data'); 5102 5103 self.searchRemoveChoice(item); 5104 5105 evt.preventDefault(); 5106 } 5107 } 5108 }); 5109 5110 this.$selection.on('click', '.select2-search--inline', function (evt) { 5111 if (self.$search.val()) { 5112 evt.stopPropagation(); 5113 } 5114 }); 5115 5116 // Try to detect the IE version should the `documentMode` property that 5117 // is stored on the document. This is only implemented in IE and is 5118 // slightly cleaner than doing a user agent check. 5119 // This property is not available in Edge, but Edge also doesn't have 5120 // this bug. 5121 var msie = document.documentMode; 5122 var disableInputEvents = msie && msie <= 11; 5123 5124 // Workaround for browsers which do not support the `input` event 5125 // This will prevent double-triggering of events for browsers which support 5126 // both the `keyup` and `input` events. 5127 this.$selection.on( 5128 'input.searchcheck', 5129 '.select2-search--inline', 5130 function (evt) { 5131 // IE will trigger the `input` event when a placeholder is used on a 5132 // search box. To get around this issue, we are forced to ignore all 5133 // `input` events in IE and keep using `keyup`. 5134 if (disableInputEvents) { 5135 self.$selection.off('input.search input.searchcheck'); 5136 return; 5137 } 5138 5139 // Unbind the duplicated `keyup` event 5140 self.$selection.off('keyup.search'); 5141 } 5142 ); 5143 5144 this.$selection.on( 5145 'keyup.search input.search', 5146 '.select2-search--inline', 5147 function (evt) { 5148 // IE will trigger the `input` event when a placeholder is used on a 5149 // search box. To get around this issue, we are forced to ignore all 5150 // `input` events in IE and keep using `keyup`. 5151 if (disableInputEvents && evt.type === 'input') { 5152 self.$selection.off('input.search input.searchcheck'); 5153 return; 5154 } 5155 5156 var key = evt.which; 5157 5158 // We can freely ignore events from modifier keys 5159 if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) { 5160 return; 5161 } 5162 5163 // Tabbing will be handled during the `keydown` phase 5164 if (key == KEYS.TAB) { 5165 return; 5166 } 5167 5168 self.handleSearch(evt); 5169 } 5170 ); 5171 }; 5172 5173 /** 5174 * This method will transfer the tabindex attribute from the rendered 5175 * selection to the search box. This allows for the search box to be used as 5176 * the primary focus instead of the selection container. 5177 * 5178 * @private 5179 */ 5180 Search.prototype._transferTabIndex = function (decorated) { 5181 this.$search.attr('tabindex', this.$selection.attr('tabindex')); 5182 this.$selection.attr('tabindex', '-1'); 5183 }; 5184 5185 Search.prototype.createPlaceholder = function (decorated, placeholder) { 5186 this.$search.attr('placeholder', placeholder.text); 5187 }; 5188 5189 Search.prototype.update = function (decorated, data) { 5190 var searchHadFocus = this.$search[0] == document.activeElement; 5191 5192 this.$search.attr('placeholder', ''); 5193 5194 decorated.call(this, data); 5195 5196 this.$selection.find('.select2-selection__rendered') 5197 .append(this.$searchContainer); 5198 5199 this.resizeSearch(); 5200 if (searchHadFocus) { 5201 this.$search.trigger('focus'); 5202 } 5203 }; 5204 5205 Search.prototype.handleSearch = function () { 5206 this.resizeSearch(); 5207 5208 if (!this._keyUpPrevented) { 5209 var input = this.$search.val(); 5210 5211 this.trigger('query', { 5212 term: input 5213 }); 5214 } 5215 5216 this._keyUpPrevented = false; 5217 }; 5218 5219 Search.prototype.searchRemoveChoice = function (decorated, item) { 5220 this.trigger('unselect', { 5221 data: item 5222 }); 5223 5224 this.$search.val(item.text); 5225 this.handleSearch(); 5226 }; 5227 5228 Search.prototype.resizeSearch = function () { 5229 this.$search.css('width', '25px'); 5230 5231 var width = ''; 5232 5233 if (this.$search.attr('placeholder') !== '') { 5234 width = this.$selection.find('.select2-selection__rendered').width(); 5235 } else { 5236 var minimumWidth = this.$search.val().length + 1; 5237 5238 width = (minimumWidth * 0.75) + 'em'; 5239 } 5240 5241 this.$search.css('width', width); 5242 }; 5243 5244 return Search; 5245}); 5246 5247S2.define('select2/selection/eventRelay',[ 5248 'jquery' 5249], function ($) { 5250 function EventRelay () { } 5251 5252 EventRelay.prototype.bind = function (decorated, container, $container) { 5253 var self = this; 5254 var relayEvents = [ 5255 'open', 'opening', 5256 'close', 'closing', 5257 'select', 'selecting', 5258 'unselect', 'unselecting', 5259 'clear', 'clearing' 5260 ]; 5261 5262 var preventableEvents = [ 5263 'opening', 'closing', 'selecting', 'unselecting', 'clearing' 5264 ]; 5265 5266 decorated.call(this, container, $container); 5267 5268 container.on('*', function (name, params) { 5269 // Ignore events that should not be relayed 5270 if ($.inArray(name, relayEvents) === -1) { 5271 return; 5272 } 5273 5274 // The parameters should always be an object 5275 params = params || {}; 5276 5277 // Generate the jQuery event for the Select2 event 5278 var evt = $.Event('select2:' + name, { 5279 params: params 5280 }); 5281 5282 self.$element.trigger(evt); 5283 5284 // Only handle preventable events if it was one 5285 if ($.inArray(name, preventableEvents) === -1) { 5286 return; 5287 } 5288 5289 params.prevented = evt.isDefaultPrevented(); 5290 }); 5291 }; 5292 5293 return EventRelay; 5294}); 5295 5296S2.define('select2/translation',[ 5297 'jquery', 5298 'require' 5299], function ($, require) { 5300 function Translation (dict) { 5301 this.dict = dict || {}; 5302 } 5303 5304 Translation.prototype.all = function () { 5305 return this.dict; 5306 }; 5307 5308 Translation.prototype.get = function (key) { 5309 return this.dict[key]; 5310 }; 5311 5312 Translation.prototype.extend = function (translation) { 5313 this.dict = $.extend({}, translation.all(), this.dict); 5314 }; 5315 5316 // Static functions 5317 5318 Translation._cache = {}; 5319 5320 Translation.loadPath = function (path) { 5321 if (!(path in Translation._cache)) { 5322 var translations = require(path); 5323 5324 Translation._cache[path] = translations; 5325 } 5326 5327 return new Translation(Translation._cache[path]); 5328 }; 5329 5330 return Translation; 5331}); 5332 5333S2.define('select2/diacritics',[ 5334 5335], function () { 5336 var diacritics = { 5337 '\u24B6': 'A', 5338 '\uFF21': 'A', 5339 '\u00C0': 'A', 5340 '\u00C1': 'A', 5341 '\u00C2': 'A', 5342 '\u1EA6': 'A', 5343 '\u1EA4': 'A', 5344 '\u1EAA': 'A', 5345 '\u1EA8': 'A', 5346 '\u00C3': 'A', 5347 '\u0100': 'A', 5348 '\u0102': 'A', 5349 '\u1EB0': 'A', 5350 '\u1EAE': 'A', 5351 '\u1EB4': 'A', 5352 '\u1EB2': 'A', 5353 '\u0226': 'A', 5354 '\u01E0': 'A', 5355 '\u00C4': 'A', 5356 '\u01DE': 'A', 5357 '\u1EA2': 'A', 5358 '\u00C5': 'A', 5359 '\u01FA': 'A', 5360 '\u01CD': 'A', 5361 '\u0200': 'A', 5362 '\u0202': 'A', 5363 '\u1EA0': 'A', 5364 '\u1EAC': 'A', 5365 '\u1EB6': 'A', 5366 '\u1E00': 'A', 5367 '\u0104': 'A', 5368 '\u023A': 'A', 5369 '\u2C6F': 'A', 5370 '\uA732': 'AA', 5371 '\u00C6': 'AE', 5372 '\u01FC': 'AE', 5373 '\u01E2': 'AE', 5374 '\uA734': 'AO', 5375 '\uA736': 'AU', 5376 '\uA738': 'AV', 5377 '\uA73A': 'AV', 5378 '\uA73C': 'AY', 5379 '\u24B7': 'B', 5380 '\uFF22': 'B', 5381 '\u1E02': 'B', 5382 '\u1E04': 'B', 5383 '\u1E06': 'B', 5384 '\u0243': 'B', 5385 '\u0182': 'B', 5386 '\u0181': 'B', 5387 '\u24B8': 'C', 5388 '\uFF23': 'C', 5389 '\u0106': 'C', 5390 '\u0108': 'C', 5391 '\u010A': 'C', 5392 '\u010C': 'C', 5393 '\u00C7': 'C', 5394 '\u1E08': 'C', 5395 '\u0187': 'C', 5396 '\u023B': 'C', 5397 '\uA73E': 'C', 5398 '\u24B9': 'D', 5399 '\uFF24': 'D', 5400 '\u1E0A': 'D', 5401 '\u010E': 'D', 5402 '\u1E0C': 'D', 5403 '\u1E10': 'D', 5404 '\u1E12': 'D', 5405 '\u1E0E': 'D', 5406 '\u0110': 'D', 5407 '\u018B': 'D', 5408 '\u018A': 'D', 5409 '\u0189': 'D', 5410 '\uA779': 'D', 5411 '\u01F1': 'DZ', 5412 '\u01C4': 'DZ', 5413 '\u01F2': 'Dz', 5414 '\u01C5': 'Dz', 5415 '\u24BA': 'E', 5416 '\uFF25': 'E', 5417 '\u00C8': 'E', 5418 '\u00C9': 'E', 5419 '\u00CA': 'E', 5420 '\u1EC0': 'E', 5421 '\u1EBE': 'E', 5422 '\u1EC4': 'E', 5423 '\u1EC2': 'E', 5424 '\u1EBC': 'E', 5425 '\u0112': 'E', 5426 '\u1E14': 'E', 5427 '\u1E16': 'E', 5428 '\u0114': 'E', 5429 '\u0116': 'E', 5430 '\u00CB': 'E', 5431 '\u1EBA': 'E', 5432 '\u011A': 'E', 5433 '\u0204': 'E', 5434 '\u0206': 'E', 5435 '\u1EB8': 'E', 5436 '\u1EC6': 'E', 5437 '\u0228': 'E', 5438 '\u1E1C': 'E', 5439 '\u0118': 'E', 5440 '\u1E18': 'E', 5441 '\u1E1A': 'E', 5442 '\u0190': 'E', 5443 '\u018E': 'E', 5444 '\u24BB': 'F', 5445 '\uFF26': 'F', 5446 '\u1E1E': 'F', 5447 '\u0191': 'F', 5448 '\uA77B': 'F', 5449 '\u24BC': 'G', 5450 '\uFF27': 'G', 5451 '\u01F4': 'G', 5452 '\u011C': 'G', 5453 '\u1E20': 'G', 5454 '\u011E': 'G', 5455 '\u0120': 'G', 5456 '\u01E6': 'G', 5457 '\u0122': 'G', 5458 '\u01E4': 'G', 5459 '\u0193': 'G', 5460 '\uA7A0': 'G', 5461 '\uA77D': 'G', 5462 '\uA77E': 'G', 5463 '\u24BD': 'H', 5464 '\uFF28': 'H', 5465 '\u0124': 'H', 5466 '\u1E22': 'H', 5467 '\u1E26': 'H', 5468 '\u021E': 'H', 5469 '\u1E24': 'H', 5470 '\u1E28': 'H', 5471 '\u1E2A': 'H', 5472 '\u0126': 'H', 5473 '\u2C67': 'H', 5474 '\u2C75': 'H', 5475 '\uA78D': 'H', 5476 '\u24BE': 'I', 5477 '\uFF29': 'I', 5478 '\u00CC': 'I', 5479 '\u00CD': 'I', 5480 '\u00CE': 'I', 5481 '\u0128': 'I', 5482 '\u012A': 'I', 5483 '\u012C': 'I', 5484 '\u0130': 'I', 5485 '\u00CF': 'I', 5486 '\u1E2E': 'I', 5487 '\u1EC8': 'I', 5488 '\u01CF': 'I', 5489 '\u0208': 'I', 5490 '\u020A': 'I', 5491 '\u1ECA': 'I', 5492 '\u012E': 'I', 5493 '\u1E2C': 'I', 5494 '\u0197': 'I', 5495 '\u24BF': 'J', 5496 '\uFF2A': 'J', 5497 '\u0134': 'J', 5498 '\u0248': 'J', 5499 '\u24C0': 'K', 5500 '\uFF2B': 'K', 5501 '\u1E30': 'K', 5502 '\u01E8': 'K', 5503 '\u1E32': 'K', 5504 '\u0136': 'K', 5505 '\u1E34': 'K', 5506 '\u0198': 'K', 5507 '\u2C69': 'K', 5508 '\uA740': 'K', 5509 '\uA742': 'K', 5510 '\uA744': 'K', 5511 '\uA7A2': 'K', 5512 '\u24C1': 'L', 5513 '\uFF2C': 'L', 5514 '\u013F': 'L', 5515 '\u0139': 'L', 5516 '\u013D': 'L', 5517 '\u1E36': 'L', 5518 '\u1E38': 'L', 5519 '\u013B': 'L', 5520 '\u1E3C': 'L', 5521 '\u1E3A': 'L', 5522 '\u0141': 'L', 5523 '\u023D': 'L', 5524 '\u2C62': 'L', 5525 '\u2C60': 'L', 5526 '\uA748': 'L', 5527 '\uA746': 'L', 5528 '\uA780': 'L', 5529 '\u01C7': 'LJ', 5530 '\u01C8': 'Lj', 5531 '\u24C2': 'M', 5532 '\uFF2D': 'M', 5533 '\u1E3E': 'M', 5534 '\u1E40': 'M', 5535 '\u1E42': 'M', 5536 '\u2C6E': 'M', 5537 '\u019C': 'M', 5538 '\u24C3': 'N', 5539 '\uFF2E': 'N', 5540 '\u01F8': 'N', 5541 '\u0143': 'N', 5542 '\u00D1': 'N', 5543 '\u1E44': 'N', 5544 '\u0147': 'N', 5545 '\u1E46': 'N', 5546 '\u0145': 'N', 5547 '\u1E4A': 'N', 5548 '\u1E48': 'N', 5549 '\u0220': 'N', 5550 '\u019D': 'N', 5551 '\uA790': 'N', 5552 '\uA7A4': 'N', 5553 '\u01CA': 'NJ', 5554 '\u01CB': 'Nj', 5555 '\u24C4': 'O', 5556 '\uFF2F': 'O', 5557 '\u00D2': 'O', 5558 '\u00D3': 'O', 5559 '\u00D4': 'O', 5560 '\u1ED2': 'O', 5561 '\u1ED0': 'O', 5562 '\u1ED6': 'O', 5563 '\u1ED4': 'O', 5564 '\u00D5': 'O', 5565 '\u1E4C': 'O', 5566 '\u022C': 'O', 5567 '\u1E4E': 'O', 5568 '\u014C': 'O', 5569 '\u1E50': 'O', 5570 '\u1E52': 'O', 5571 '\u014E': 'O', 5572 '\u022E': 'O', 5573 '\u0230': 'O', 5574 '\u00D6': 'O', 5575 '\u022A': 'O', 5576 '\u1ECE': 'O', 5577 '\u0150': 'O', 5578 '\u01D1': 'O', 5579 '\u020C': 'O', 5580 '\u020E': 'O', 5581 '\u01A0': 'O', 5582 '\u1EDC': 'O', 5583 '\u1EDA': 'O', 5584 '\u1EE0': 'O', 5585 '\u1EDE': 'O', 5586 '\u1EE2': 'O', 5587 '\u1ECC': 'O', 5588 '\u1ED8': 'O', 5589 '\u01EA': 'O', 5590 '\u01EC': 'O', 5591 '\u00D8': 'O', 5592 '\u01FE': 'O', 5593 '\u0186': 'O', 5594 '\u019F': 'O', 5595 '\uA74A': 'O', 5596 '\uA74C': 'O', 5597 '\u0152': 'OE', 5598 '\u01A2': 'OI', 5599 '\uA74E': 'OO', 5600 '\u0222': 'OU', 5601 '\u24C5': 'P', 5602 '\uFF30': 'P', 5603 '\u1E54': 'P', 5604 '\u1E56': 'P', 5605 '\u01A4': 'P', 5606 '\u2C63': 'P', 5607 '\uA750': 'P', 5608 '\uA752': 'P', 5609 '\uA754': 'P', 5610 '\u24C6': 'Q', 5611 '\uFF31': 'Q', 5612 '\uA756': 'Q', 5613 '\uA758': 'Q', 5614 '\u024A': 'Q', 5615 '\u24C7': 'R', 5616 '\uFF32': 'R', 5617 '\u0154': 'R', 5618 '\u1E58': 'R', 5619 '\u0158': 'R', 5620 '\u0210': 'R', 5621 '\u0212': 'R', 5622 '\u1E5A': 'R', 5623 '\u1E5C': 'R', 5624 '\u0156': 'R', 5625 '\u1E5E': 'R', 5626 '\u024C': 'R', 5627 '\u2C64': 'R', 5628 '\uA75A': 'R', 5629 '\uA7A6': 'R', 5630 '\uA782': 'R', 5631 '\u24C8': 'S', 5632 '\uFF33': 'S', 5633 '\u1E9E': 'S', 5634 '\u015A': 'S', 5635 '\u1E64': 'S', 5636 '\u015C': 'S', 5637 '\u1E60': 'S', 5638 '\u0160': 'S', 5639 '\u1E66': 'S', 5640 '\u1E62': 'S', 5641 '\u1E68': 'S', 5642 '\u0218': 'S', 5643 '\u015E': 'S', 5644 '\u2C7E': 'S', 5645 '\uA7A8': 'S', 5646 '\uA784': 'S', 5647 '\u24C9': 'T', 5648 '\uFF34': 'T', 5649 '\u1E6A': 'T', 5650 '\u0164': 'T', 5651 '\u1E6C': 'T', 5652 '\u021A': 'T', 5653 '\u0162': 'T', 5654 '\u1E70': 'T', 5655 '\u1E6E': 'T', 5656 '\u0166': 'T', 5657 '\u01AC': 'T', 5658 '\u01AE': 'T', 5659 '\u023E': 'T', 5660 '\uA786': 'T', 5661 '\uA728': 'TZ', 5662 '\u24CA': 'U', 5663 '\uFF35': 'U', 5664 '\u00D9': 'U', 5665 '\u00DA': 'U', 5666 '\u00DB': 'U', 5667 '\u0168': 'U', 5668 '\u1E78': 'U', 5669 '\u016A': 'U', 5670 '\u1E7A': 'U', 5671 '\u016C': 'U', 5672 '\u00DC': 'U', 5673 '\u01DB': 'U', 5674 '\u01D7': 'U', 5675 '\u01D5': 'U', 5676 '\u01D9': 'U', 5677 '\u1EE6': 'U', 5678 '\u016E': 'U', 5679 '\u0170': 'U', 5680 '\u01D3': 'U', 5681 '\u0214': 'U', 5682 '\u0216': 'U', 5683 '\u01AF': 'U', 5684 '\u1EEA': 'U', 5685 '\u1EE8': 'U', 5686 '\u1EEE': 'U', 5687 '\u1EEC': 'U', 5688 '\u1EF0': 'U', 5689 '\u1EE4': 'U', 5690 '\u1E72': 'U', 5691 '\u0172': 'U', 5692 '\u1E76': 'U', 5693 '\u1E74': 'U', 5694 '\u0244': 'U', 5695 '\u24CB': 'V', 5696 '\uFF36': 'V', 5697 '\u1E7C': 'V', 5698 '\u1E7E': 'V', 5699 '\u01B2': 'V', 5700 '\uA75E': 'V', 5701 '\u0245': 'V', 5702 '\uA760': 'VY', 5703 '\u24CC': 'W', 5704 '\uFF37': 'W', 5705 '\u1E80': 'W', 5706 '\u1E82': 'W', 5707 '\u0174': 'W', 5708 '\u1E86': 'W', 5709 '\u1E84': 'W', 5710 '\u1E88': 'W', 5711 '\u2C72': 'W', 5712 '\u24CD': 'X', 5713 '\uFF38': 'X', 5714 '\u1E8A': 'X', 5715 '\u1E8C': 'X', 5716 '\u24CE': 'Y', 5717 '\uFF39': 'Y', 5718 '\u1EF2': 'Y', 5719 '\u00DD': 'Y', 5720 '\u0176': 'Y', 5721 '\u1EF8': 'Y', 5722 '\u0232': 'Y', 5723 '\u1E8E': 'Y', 5724 '\u0178': 'Y', 5725 '\u1EF6': 'Y', 5726 '\u1EF4': 'Y', 5727 '\u01B3': 'Y', 5728 '\u024E': 'Y', 5729 '\u1EFE': 'Y', 5730 '\u24CF': 'Z', 5731 '\uFF3A': 'Z', 5732 '\u0179': 'Z', 5733 '\u1E90': 'Z', 5734 '\u017B': 'Z', 5735 '\u017D': 'Z', 5736 '\u1E92': 'Z', 5737 '\u1E94': 'Z', 5738 '\u01B5': 'Z', 5739 '\u0224': 'Z', 5740 '\u2C7F': 'Z', 5741 '\u2C6B': 'Z', 5742 '\uA762': 'Z', 5743 '\u24D0': 'a', 5744 '\uFF41': 'a', 5745 '\u1E9A': 'a', 5746 '\u00E0': 'a', 5747 '\u00E1': 'a', 5748 '\u00E2': 'a', 5749 '\u1EA7': 'a', 5750 '\u1EA5': 'a', 5751 '\u1EAB': 'a', 5752 '\u1EA9': 'a', 5753 '\u00E3': 'a', 5754 '\u0101': 'a', 5755 '\u0103': 'a', 5756 '\u1EB1': 'a', 5757 '\u1EAF': 'a', 5758 '\u1EB5': 'a', 5759 '\u1EB3': 'a', 5760 '\u0227': 'a', 5761 '\u01E1': 'a', 5762 '\u00E4': 'a', 5763 '\u01DF': 'a', 5764 '\u1EA3': 'a', 5765 '\u00E5': 'a', 5766 '\u01FB': 'a', 5767 '\u01CE': 'a', 5768 '\u0201': 'a', 5769 '\u0203': 'a', 5770 '\u1EA1': 'a', 5771 '\u1EAD': 'a', 5772 '\u1EB7': 'a', 5773 '\u1E01': 'a', 5774 '\u0105': 'a', 5775 '\u2C65': 'a', 5776 '\u0250': 'a', 5777 '\uA733': 'aa', 5778 '\u00E6': 'ae', 5779 '\u01FD': 'ae', 5780 '\u01E3': 'ae', 5781 '\uA735': 'ao', 5782 '\uA737': 'au', 5783 '\uA739': 'av', 5784 '\uA73B': 'av', 5785 '\uA73D': 'ay', 5786 '\u24D1': 'b', 5787 '\uFF42': 'b', 5788 '\u1E03': 'b', 5789 '\u1E05': 'b', 5790 '\u1E07': 'b', 5791 '\u0180': 'b', 5792 '\u0183': 'b', 5793 '\u0253': 'b', 5794 '\u24D2': 'c', 5795 '\uFF43': 'c', 5796 '\u0107': 'c', 5797 '\u0109': 'c', 5798 '\u010B': 'c', 5799 '\u010D': 'c', 5800 '\u00E7': 'c', 5801 '\u1E09': 'c', 5802 '\u0188': 'c', 5803 '\u023C': 'c', 5804 '\uA73F': 'c', 5805 '\u2184': 'c', 5806 '\u24D3': 'd', 5807 '\uFF44': 'd', 5808 '\u1E0B': 'd', 5809 '\u010F': 'd', 5810 '\u1E0D': 'd', 5811 '\u1E11': 'd', 5812 '\u1E13': 'd', 5813 '\u1E0F': 'd', 5814 '\u0111': 'd', 5815 '\u018C': 'd', 5816 '\u0256': 'd', 5817 '\u0257': 'd', 5818 '\uA77A': 'd', 5819 '\u01F3': 'dz', 5820 '\u01C6': 'dz', 5821 '\u24D4': 'e', 5822 '\uFF45': 'e', 5823 '\u00E8': 'e', 5824 '\u00E9': 'e', 5825 '\u00EA': 'e', 5826 '\u1EC1': 'e', 5827 '\u1EBF': 'e', 5828 '\u1EC5': 'e', 5829 '\u1EC3': 'e', 5830 '\u1EBD': 'e', 5831 '\u0113': 'e', 5832 '\u1E15': 'e', 5833 '\u1E17': 'e', 5834 '\u0115': 'e', 5835 '\u0117': 'e', 5836 '\u00EB': 'e', 5837 '\u1EBB': 'e', 5838 '\u011B': 'e', 5839 '\u0205': 'e', 5840 '\u0207': 'e', 5841 '\u1EB9': 'e', 5842 '\u1EC7': 'e', 5843 '\u0229': 'e', 5844 '\u1E1D': 'e', 5845 '\u0119': 'e', 5846 '\u1E19': 'e', 5847 '\u1E1B': 'e', 5848 '\u0247': 'e', 5849 '\u025B': 'e', 5850 '\u01DD': 'e', 5851 '\u24D5': 'f', 5852 '\uFF46': 'f', 5853 '\u1E1F': 'f', 5854 '\u0192': 'f', 5855 '\uA77C': 'f', 5856 '\u24D6': 'g', 5857 '\uFF47': 'g', 5858 '\u01F5': 'g', 5859 '\u011D': 'g', 5860 '\u1E21': 'g', 5861 '\u011F': 'g', 5862 '\u0121': 'g', 5863 '\u01E7': 'g', 5864 '\u0123': 'g', 5865 '\u01E5': 'g', 5866 '\u0260': 'g', 5867 '\uA7A1': 'g', 5868 '\u1D79': 'g', 5869 '\uA77F': 'g', 5870 '\u24D7': 'h', 5871 '\uFF48': 'h', 5872 '\u0125': 'h', 5873 '\u1E23': 'h', 5874 '\u1E27': 'h', 5875 '\u021F': 'h', 5876 '\u1E25': 'h', 5877 '\u1E29': 'h', 5878 '\u1E2B': 'h', 5879 '\u1E96': 'h', 5880 '\u0127': 'h', 5881 '\u2C68': 'h', 5882 '\u2C76': 'h', 5883 '\u0265': 'h', 5884 '\u0195': 'hv', 5885 '\u24D8': 'i', 5886 '\uFF49': 'i', 5887 '\u00EC': 'i', 5888 '\u00ED': 'i', 5889 '\u00EE': 'i', 5890 '\u0129': 'i', 5891 '\u012B': 'i', 5892 '\u012D': 'i', 5893 '\u00EF': 'i', 5894 '\u1E2F': 'i', 5895 '\u1EC9': 'i', 5896 '\u01D0': 'i', 5897 '\u0209': 'i', 5898 '\u020B': 'i', 5899 '\u1ECB': 'i', 5900 '\u012F': 'i', 5901 '\u1E2D': 'i', 5902 '\u0268': 'i', 5903 '\u0131': 'i', 5904 '\u24D9': 'j', 5905 '\uFF4A': 'j', 5906 '\u0135': 'j', 5907 '\u01F0': 'j', 5908 '\u0249': 'j', 5909 '\u24DA': 'k', 5910 '\uFF4B': 'k', 5911 '\u1E31': 'k', 5912 '\u01E9': 'k', 5913 '\u1E33': 'k', 5914 '\u0137': 'k', 5915 '\u1E35': 'k', 5916 '\u0199': 'k', 5917 '\u2C6A': 'k', 5918 '\uA741': 'k', 5919 '\uA743': 'k', 5920 '\uA745': 'k', 5921 '\uA7A3': 'k', 5922 '\u24DB': 'l', 5923 '\uFF4C': 'l', 5924 '\u0140': 'l', 5925 '\u013A': 'l', 5926 '\u013E': 'l', 5927 '\u1E37': 'l', 5928 '\u1E39': 'l', 5929 '\u013C': 'l', 5930 '\u1E3D': 'l', 5931 '\u1E3B': 'l', 5932 '\u017F': 'l', 5933 '\u0142': 'l', 5934 '\u019A': 'l', 5935 '\u026B': 'l', 5936 '\u2C61': 'l', 5937 '\uA749': 'l', 5938 '\uA781': 'l', 5939 '\uA747': 'l', 5940 '\u01C9': 'lj', 5941 '\u24DC': 'm', 5942 '\uFF4D': 'm', 5943 '\u1E3F': 'm', 5944 '\u1E41': 'm', 5945 '\u1E43': 'm', 5946 '\u0271': 'm', 5947 '\u026F': 'm', 5948 '\u24DD': 'n', 5949 '\uFF4E': 'n',
vendor: 6,398 bytes, lines 5950-6249
5950 '\u01F9': 'n', 5951 '\u0144': 'n', 5952 '\u00F1': 'n', 5953 '\u1E45': 'n', 5954 '\u0148': 'n', 5955 '\u1E47': 'n', 5956 '\u0146': 'n', 5957 '\u1E4B': 'n', 5958 '\u1E49': 'n', 5959 '\u019E': 'n', 5960 '\u0272': 'n', 5961 '\u0149': 'n', 5962 '\uA791': 'n', 5963 '\uA7A5': 'n', 5964 '\u01CC': 'nj', 5965 '\u24DE': 'o', 5966 '\uFF4F': 'o', 5967 '\u00F2': 'o', 5968 '\u00F3': 'o', 5969 '\u00F4': 'o', 5970 '\u1ED3': 'o', 5971 '\u1ED1': 'o', 5972 '\u1ED7': 'o', 5973 '\u1ED5': 'o', 5974 '\u00F5': 'o', 5975 '\u1E4D': 'o', 5976 '\u022D': 'o', 5977 '\u1E4F': 'o', 5978 '\u014D': 'o', 5979 '\u1E51': 'o', 5980 '\u1E53': 'o', 5981 '\u014F': 'o', 5982 '\u022F': 'o', 5983 '\u0231': 'o', 5984 '\u00F6': 'o', 5985 '\u022B': 'o', 5986 '\u1ECF': 'o', 5987 '\u0151': 'o', 5988 '\u01D2': 'o', 5989 '\u020D': 'o', 5990 '\u020F': 'o', 5991 '\u01A1': 'o', 5992 '\u1EDD': 'o', 5993 '\u1EDB': 'o', 5994 '\u1EE1': 'o', 5995 '\u1EDF': 'o', 5996 '\u1EE3': 'o', 5997 '\u1ECD': 'o', 5998 '\u1ED9': 'o', 5999 '\u01EB': 'o', 6000 '\u01ED': 'o', 6001 '\u00F8': 'o', 6002 '\u01FF': 'o', 6003 '\u0254': 'o', 6004 '\uA74B': 'o', 6005 '\uA74D': 'o', 6006 '\u0275': 'o', 6007 '\u0153': 'oe', 6008 '\u01A3': 'oi', 6009 '\u0223': 'ou', 6010 '\uA74F': 'oo', 6011 '\u24DF': 'p', 6012 '\uFF50': 'p', 6013 '\u1E55': 'p', 6014 '\u1E57': 'p', 6015 '\u01A5': 'p', 6016 '\u1D7D': 'p', 6017 '\uA751': 'p', 6018 '\uA753': 'p', 6019 '\uA755': 'p', 6020 '\u24E0': 'q', 6021 '\uFF51': 'q', 6022 '\u024B': 'q', 6023 '\uA757': 'q', 6024 '\uA759': 'q', 6025 '\u24E1': 'r', 6026 '\uFF52': 'r', 6027 '\u0155': 'r', 6028 '\u1E59': 'r', 6029 '\u0159': 'r', 6030 '\u0211': 'r', 6031 '\u0213': 'r', 6032 '\u1E5B': 'r', 6033 '\u1E5D': 'r', 6034 '\u0157': 'r', 6035 '\u1E5F': 'r', 6036 '\u024D': 'r', 6037 '\u027D': 'r', 6038 '\uA75B': 'r', 6039 '\uA7A7': 'r', 6040 '\uA783': 'r', 6041 '\u24E2': 's', 6042 '\uFF53': 's', 6043 '\u00DF': 's', 6044 '\u015B': 's', 6045 '\u1E65': 's', 6046 '\u015D': 's', 6047 '\u1E61': 's', 6048 '\u0161': 's', 6049 '\u1E67': 's', 6050 '\u1E63': 's', 6051 '\u1E69': 's', 6052 '\u0219': 's', 6053 '\u015F': 's', 6054 '\u023F': 's', 6055 '\uA7A9': 's', 6056 '\uA785': 's', 6057 '\u1E9B': 's', 6058 '\u24E3': 't', 6059 '\uFF54': 't', 6060 '\u1E6B': 't', 6061 '\u1E97': 't', 6062 '\u0165': 't', 6063 '\u1E6D': 't', 6064 '\u021B': 't', 6065 '\u0163': 't', 6066 '\u1E71': 't', 6067 '\u1E6F': 't', 6068 '\u0167': 't', 6069 '\u01AD': 't', 6070 '\u0288': 't', 6071 '\u2C66': 't', 6072 '\uA787': 't', 6073 '\uA729': 'tz', 6074 '\u24E4': 'u', 6075 '\uFF55': 'u', 6076 '\u00F9': 'u', 6077 '\u00FA': 'u', 6078 '\u00FB': 'u', 6079 '\u0169': 'u', 6080 '\u1E79': 'u', 6081 '\u016B': 'u', 6082 '\u1E7B': 'u', 6083 '\u016D': 'u', 6084 '\u00FC': 'u', 6085 '\u01DC': 'u', 6086 '\u01D8': 'u', 6087 '\u01D6': 'u', 6088 '\u01DA': 'u', 6089 '\u1EE7': 'u', 6090 '\u016F': 'u', 6091 '\u0171': 'u', 6092 '\u01D4': 'u', 6093 '\u0215': 'u', 6094 '\u0217': 'u', 6095 '\u01B0': 'u', 6096 '\u1EEB': 'u', 6097 '\u1EE9': 'u', 6098 '\u1EEF': 'u', 6099 '\u1EED': 'u', 6100 '\u1EF1': 'u', 6101 '\u1EE5': 'u', 6102 '\u1E73': 'u', 6103 '\u0173': 'u', 6104 '\u1E77': 'u', 6105 '\u1E75': 'u', 6106 '\u0289': 'u', 6107 '\u24E5': 'v', 6108 '\uFF56': 'v', 6109 '\u1E7D': 'v', 6110 '\u1E7F': 'v', 6111 '\u028B': 'v', 6112 '\uA75F': 'v', 6113 '\u028C': 'v', 6114 '\uA761': 'vy', 6115 '\u24E6': 'w', 6116 '\uFF57': 'w', 6117 '\u1E81': 'w', 6118 '\u1E83': 'w', 6119 '\u0175': 'w', 6120 '\u1E87': 'w', 6121 '\u1E85': 'w', 6122 '\u1E98': 'w', 6123 '\u1E89': 'w', 6124 '\u2C73': 'w', 6125 '\u24E7': 'x', 6126 '\uFF58': 'x', 6127 '\u1E8B': 'x', 6128 '\u1E8D': 'x', 6129 '\u24E8': 'y', 6130 '\uFF59': 'y', 6131 '\u1EF3': 'y', 6132 '\u00FD': 'y', 6133 '\u0177': 'y', 6134 '\u1EF9': 'y', 6135 '\u0233': 'y', 6136 '\u1E8F': 'y', 6137 '\u00FF': 'y', 6138 '\u1EF7': 'y', 6139 '\u1E99': 'y', 6140 '\u1EF5': 'y', 6141 '\u01B4': 'y', 6142 '\u024F': 'y', 6143 '\u1EFF': 'y', 6144 '\u24E9': 'z', 6145 '\uFF5A': 'z', 6146 '\u017A': 'z', 6147 '\u1E91': 'z', 6148 '\u017C': 'z', 6149 '\u017E': 'z', 6150 '\u1E93': 'z', 6151 '\u1E95': 'z', 6152 '\u01B6': 'z', 6153 '\u0225': 'z', 6154 '\u0240': 'z', 6155 '\u2C6C': 'z', 6156 '\uA763': 'z', 6157 '\u0386': '\u0391', 6158 '\u0388': '\u0395', 6159 '\u0389': '\u0397', 6160 '\u038A': '\u0399', 6161 '\u03AA': '\u0399', 6162 '\u038C': '\u039F', 6163 '\u038E': '\u03A5', 6164 '\u03AB': '\u03A5', 6165 '\u038F': '\u03A9', 6166 '\u03AC': '\u03B1', 6167 '\u03AD': '\u03B5', 6168 '\u03AE': '\u03B7', 6169 '\u03AF': '\u03B9', 6170 '\u03CA': '\u03B9', 6171 '\u0390': '\u03B9', 6172 '\u03CC': '\u03BF', 6173 '\u03CD': '\u03C5', 6174 '\u03CB': '\u03C5', 6175 '\u03B0': '\u03C5', 6176 '\u03CE': '\u03C9', 6177 '\u03C2': '\u03C3', 6178 '\u2019': '\'' 6179 }; 6180 6181 return diacritics; 6182}); 6183 6184S2.define('select2/data/base',[ 6185 '../utils' 6186], function (Utils) { 6187 function BaseAdapter ($element, options) { 6188 BaseAdapter.__super__.constructor.call(this); 6189 } 6190 6191 Utils.Extend(BaseAdapter, Utils.Observable); 6192 6193 BaseAdapter.prototype.current = function (callback) { 6194 throw new Error('The `current` method must be defined in child classes.'); 6195 }; 6196 6197 BaseAdapter.prototype.query = function (params, callback) { 6198 throw new Error('The `query` method must be defined in child classes.'); 6199 }; 6200 6201 BaseAdapter.prototype.bind = function (container, $container) { 6202 // Can be implemented in subclasses 6203 }; 6204 6205 BaseAdapter.prototype.destroy = function () { 6206 // Can be implemented in subclasses 6207 }; 6208 6209 BaseAdapter.prototype.generateResultId = function (container, data) { 6210 var id = container.id + '-result-'; 6211 6212 id += Utils.generateChars(4); 6213 6214 if (data.id != null) { 6215 id += '-' + data.id.toString(); 6216 } else { 6217 id += '-' + Utils.generateChars(4); 6218 } 6219 return id; 6220 }; 6221 6222 return BaseAdapter; 6223}); 6224 6225S2.define('select2/data/select',[ 6226 './base', 6227 '../utils', 6228 'jquery' 6229], function (BaseAdapter, Utils, $) { 6230 function SelectAdapter ($element, options) { 6231 this.$element = $element; 6232 this.options = options; 6233 6234 SelectAdapter.__super__.constructor.call(this); 6235 } 6236 6237 Utils.Extend(SelectAdapter, BaseAdapter); 6238 6239 SelectAdapter.prototype.current = function (callback) { 6240 var data = []; 6241 var self = this; 6242 6243 this.$element.find(':selected').each(function () { 6244 var $option = $(this); 6245 6246 var option = self.item($option); 6247 6248 data.push(option); 6249 });
vendor: 21,513 bytes, lines 6250-7147
6250 6251 callback(data); 6252 }; 6253 6254 SelectAdapter.prototype.select = function (data) { 6255 var self = this; 6256 6257 data.selected = true; 6258 6259 // If data.element is a DOM node, use it instead 6260 if ($(data.element).is('option')) { 6261 data.element.selected = true; 6262 6263 this.$element.trigger('change'); 6264 6265 return; 6266 } 6267 6268 if (this.$element.prop('multiple')) { 6269 this.current(function (currentData) { 6270 var val = []; 6271 6272 data = [data]; 6273 data.push.apply(data, currentData); 6274 6275 for (var d = 0; d < data.length; d++) { 6276 var id = data[d].id; 6277 6278 if ($.inArray(id, val) === -1) { 6279 val.push(id); 6280 } 6281 } 6282 6283 self.$element.val(val); 6284 self.$element.trigger('change'); 6285 }); 6286 } else { 6287 var val = data.id; 6288 6289 this.$element.val(val); 6290 this.$element.trigger('change'); 6291 } 6292 }; 6293 6294 SelectAdapter.prototype.unselect = function (data) { 6295 var self = this; 6296 6297 if (!this.$element.prop('multiple')) { 6298 return; 6299 } 6300 6301 data.selected = false; 6302 6303 if ($(data.element).is('option')) { 6304 data.element.selected = false; 6305 6306 this.$element.trigger('change'); 6307 6308 return; 6309 } 6310 6311 this.current(function (currentData) { 6312 var val = []; 6313 6314 for (var d = 0; d < currentData.length; d++) { 6315 var id = currentData[d].id; 6316 6317 if (id !== data.id && $.inArray(id, val) === -1) { 6318 val.push(id); 6319 } 6320 } 6321 6322 self.$element.val(val); 6323 6324 self.$element.trigger('change'); 6325 }); 6326 }; 6327 6328 SelectAdapter.prototype.bind = function (container, $container) { 6329 var self = this; 6330 6331 this.container = container; 6332 6333 container.on('select', function (params) { 6334 self.select(params.data); 6335 }); 6336 6337 container.on('unselect', function (params) { 6338 self.unselect(params.data); 6339 }); 6340 }; 6341 6342 SelectAdapter.prototype.destroy = function () { 6343 // Remove anything added to child elements 6344 this.$element.find('*').each(function () { 6345 // Remove any custom data set by Select2 6346 Utils.RemoveData(this); 6347 }); 6348 }; 6349 6350 SelectAdapter.prototype.query = function (params, callback) { 6351 var data = []; 6352 var self = this; 6353 6354 var $options = this.$element.children(); 6355 6356 $options.each(function () { 6357 var $option = $(this); 6358 6359 if (!$option.is('option') && !$option.is('optgroup')) { 6360 return; 6361 } 6362 6363 var option = self.item($option); 6364 6365 var matches = self.matches(params, option); 6366 6367 if (matches !== null) { 6368 data.push(matches); 6369 } 6370 }); 6371 6372 callback({ 6373 results: data 6374 }); 6375 }; 6376 6377 SelectAdapter.prototype.addOptions = function ($options) { 6378 Utils.appendMany(this.$element, $options); 6379 }; 6380 6381 SelectAdapter.prototype.option = function (data) { 6382 var option; 6383 6384 if (data.children) { 6385 option = document.createElement('optgroup'); 6386 option.label = data.text; 6387 } else { 6388 option = document.createElement('option'); 6389 6390 if (option.textContent !== undefined) { 6391 option.textContent = data.text; 6392 } else { 6393 option.innerText = data.text; 6394 } 6395 } 6396 6397 if (data.id !== undefined) { 6398 option.value = data.id; 6399 } 6400 6401 if (data.disabled) { 6402 option.disabled = true; 6403 } 6404 6405 if (data.selected) { 6406 option.selected = true; 6407 } 6408 6409 if (data.title) { 6410 option.title = data.title; 6411 } 6412 6413 var $option = $(option); 6414 6415 var normalizedData = this._normalizeItem(data); 6416 normalizedData.element = option; 6417 6418 // Override the option's data with the combined data 6419 Utils.StoreData(option, 'data', normalizedData); 6420 6421 return $option; 6422 }; 6423 6424 SelectAdapter.prototype.item = function ($option) { 6425 var data = {}; 6426 6427 data = Utils.GetData($option[0], 'data'); 6428 6429 if (data != null) { 6430 return data; 6431 } 6432 6433 if ($option.is('option')) { 6434 data = { 6435 id: $option.val(), 6436 text: $option.text(), 6437 disabled: $option.prop('disabled'), 6438 selected: $option.prop('selected'), 6439 title: $option.prop('title') 6440 }; 6441 } else if ($option.is('optgroup')) { 6442 data = { 6443 text: $option.prop('label'), 6444 children: [], 6445 title: $option.prop('title') 6446 }; 6447 6448 var $children = $option.children('option'); 6449 var children = []; 6450 6451 for (var c = 0; c < $children.length; c++) { 6452 var $child = $($children[c]); 6453 6454 var child = this.item($child); 6455 6456 children.push(child); 6457 } 6458 6459 data.children = children; 6460 } 6461 6462 data = this._normalizeItem(data); 6463 data.element = $option[0]; 6464 6465 Utils.StoreData($option[0], 'data', data); 6466 6467 return data; 6468 }; 6469 6470 SelectAdapter.prototype._normalizeItem = function (item) { 6471 if (item !== Object(item)) { 6472 item = { 6473 id: item, 6474 text: item 6475 }; 6476 } 6477 6478 item = $.extend({}, { 6479 text: '' 6480 }, item); 6481 6482 var defaults = { 6483 selected: false, 6484 disabled: false 6485 }; 6486 6487 if (item.id != null) { 6488 item.id = item.id.toString(); 6489 } 6490 6491 if (item.text != null) { 6492 item.text = item.text.toString(); 6493 } 6494 6495 if (item._resultId == null && item.id && this.container != null) { 6496 item._resultId = this.generateResultId(this.container, item); 6497 } 6498 6499 return $.extend({}, defaults, item); 6500 }; 6501 6502 SelectAdapter.prototype.matches = function (params, data) { 6503 var matcher = this.options.get('matcher'); 6504 6505 return matcher(params, data); 6506 }; 6507 6508 return SelectAdapter; 6509}); 6510 6511S2.define('select2/data/array',[ 6512 './select', 6513 '../utils', 6514 'jquery' 6515], function (SelectAdapter, Utils, $) { 6516 function ArrayAdapter ($element, options) { 6517 this._dataToConvert = options.get('data') || []; 6518 6519 ArrayAdapter.__super__.constructor.call(this, $element, options); 6520 } 6521 6522 Utils.Extend(ArrayAdapter, SelectAdapter); 6523 6524 ArrayAdapter.prototype.bind = function (container, $container) { 6525 ArrayAdapter.__super__.bind.call(this, container, $container); 6526 6527 this.addOptions(this.convertToOptions(this._dataToConvert)); 6528 }; 6529 6530 ArrayAdapter.prototype.select = function (data) { 6531 var $option = this.$element.find('option').filter(function (i, elm) { 6532 return elm.value == data.id.toString(); 6533 }); 6534 6535 if ($option.length === 0) { 6536 $option = this.option(data); 6537 6538 this.addOptions($option); 6539 } 6540 6541 ArrayAdapter.__super__.select.call(this, data); 6542 }; 6543 6544 ArrayAdapter.prototype.convertToOptions = function (data) { 6545 var self = this; 6546 6547 var $existing = this.$element.find('option'); 6548 var existingIds = $existing.map(function () { 6549 return self.item($(this)).id; 6550 }).get(); 6551 6552 var $options = []; 6553 6554 // Filter out all items except for the one passed in the argument 6555 function onlyItem (item) { 6556 return function () { 6557 return $(this).val() == item.id; 6558 }; 6559 } 6560 6561 for (var d = 0; d < data.length; d++) { 6562 var item = this._normalizeItem(data[d]); 6563 6564 // Skip items which were pre-loaded, only merge the data 6565 if ($.inArray(item.id, existingIds) >= 0) { 6566 var $existingOption = $existing.filter(onlyItem(item)); 6567 6568 var existingData = this.item($existingOption); 6569 var newData = $.extend(true, {}, item, existingData); 6570 6571 var $newOption = this.option(newData); 6572 6573 $existingOption.replaceWith($newOption); 6574 6575 continue; 6576 } 6577 6578 var $option = this.option(item); 6579 6580 if (item.children) { 6581 var $children = this.convertToOptions(item.children); 6582 6583 Utils.appendMany($option, $children); 6584 } 6585 6586 $options.push($option); 6587 } 6588 6589 return $options; 6590 }; 6591 6592 return ArrayAdapter; 6593}); 6594 6595S2.define('select2/data/ajax',[ 6596 './array', 6597 '../utils', 6598 'jquery' 6599], function (ArrayAdapter, Utils, $) { 6600 function AjaxAdapter ($element, options) { 6601 this.ajaxOptions = this._applyDefaults(options.get('ajax')); 6602 6603 if (this.ajaxOptions.processResults != null) { 6604 this.processResults = this.ajaxOptions.processResults; 6605 } 6606 6607 AjaxAdapter.__super__.constructor.call(this, $element, options); 6608 } 6609 6610 Utils.Extend(AjaxAdapter, ArrayAdapter); 6611 6612 AjaxAdapter.prototype._applyDefaults = function (options) { 6613 var defaults = { 6614 data: function (params) { 6615 return $.extend({}, params, { 6616 q: params.term 6617 }); 6618 }, 6619 transport: function (params, success, failure) { 6620 var $request = $.ajax(params); 6621 6622 $request.then(success); 6623 $request.fail(failure); 6624 6625 return $request; 6626 } 6627 }; 6628 6629 return $.extend({}, defaults, options, true); 6630 }; 6631 6632 AjaxAdapter.prototype.processResults = function (results) { 6633 return results; 6634 }; 6635 6636 AjaxAdapter.prototype.query = function (params, callback) { 6637 var matches = []; 6638 var self = this; 6639 6640 if (this._request != null) { 6641 // JSONP requests cannot always be aborted 6642 if ($.isFunction(this._request.abort)) { 6643 this._request.abort(); 6644 } 6645 6646 this._request = null; 6647 } 6648 6649 var options = $.extend({ 6650 type: 'GET' 6651 }, this.ajaxOptions); 6652 6653 if (typeof options.url === 'function') { 6654 options.url = options.url.call(this.$element, params); 6655 } 6656 6657 if (typeof options.data === 'function') { 6658 options.data = options.data.call(this.$element, params); 6659 } 6660 6661 function request () { 6662 var $request = options.transport(options, function (data) { 6663 var results = self.processResults(data, params); 6664 6665 if (self.options.get('debug') && window.console && console.error) { 6666 // Check to make sure that the response included a `results` key. 6667 if (!results || !results.results || !$.isArray(results.results)) { 6668 console.error( 6669 'Select2: The AJAX results did not return an array in the ' + 6670 '`results` key of the response.' 6671 ); 6672 } 6673 } 6674 6675 callback(results); 6676 }, function () { 6677 // Attempt to detect if a request was aborted 6678 // Only works if the transport exposes a status property 6679 if ('status' in $request && 6680 ($request.status === 0 || $request.status === '0')) { 6681 return; 6682 } 6683 6684 self.trigger('results:message', { 6685 message: 'errorLoading' 6686 }); 6687 }); 6688 6689 self._request = $request; 6690 } 6691 6692 if (this.ajaxOptions.delay && params.term != null) { 6693 if (this._queryTimeout) { 6694 window.clearTimeout(this._queryTimeout); 6695 } 6696 6697 this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); 6698 } else { 6699 request(); 6700 } 6701 }; 6702 6703 return AjaxAdapter; 6704}); 6705 6706S2.define('select2/data/tags',[ 6707 'jquery' 6708], function ($) { 6709 function Tags (decorated, $element, options) { 6710 var tags = options.get('tags'); 6711 6712 var createTag = options.get('createTag'); 6713 6714 if (createTag !== undefined) { 6715 this.createTag = createTag; 6716 } 6717 6718 var insertTag = options.get('insertTag'); 6719 6720 if (insertTag !== undefined) { 6721 this.insertTag = insertTag; 6722 } 6723 6724 decorated.call(this, $element, options); 6725 6726 if ($.isArray(tags)) { 6727 for (var t = 0; t < tags.length; t++) { 6728 var tag = tags[t]; 6729 var item = this._normalizeItem(tag); 6730 6731 var $option = this.option(item); 6732 6733 this.$element.append($option); 6734 } 6735 } 6736 } 6737 6738 Tags.prototype.query = function (decorated, params, callback) { 6739 var self = this; 6740 6741 this._removeOldTags(); 6742 6743 if (params.term == null || params.page != null) { 6744 decorated.call(this, params, callback); 6745 return; 6746 } 6747 6748 function wrapper (obj, child) { 6749 var data = obj.results; 6750 6751 for (var i = 0; i < data.length; i++) { 6752 var option = data[i]; 6753 6754 var checkChildren = ( 6755 option.children != null && 6756 !wrapper({ 6757 results: option.children 6758 }, true) 6759 ); 6760 6761 var optionText = (option.text || '').toUpperCase(); 6762 var paramsTerm = (params.term || '').toUpperCase(); 6763 6764 var checkText = optionText === paramsTerm; 6765 6766 if (checkText || checkChildren) { 6767 if (child) { 6768 return false; 6769 } 6770 6771 obj.data = data; 6772 callback(obj); 6773 6774 return; 6775 } 6776 } 6777 6778 if (child) { 6779 return true; 6780 } 6781 6782 var tag = self.createTag(params); 6783 6784 if (tag != null) { 6785 var $option = self.option(tag); 6786 $option.attr('data-select2-tag', true); 6787 6788 self.addOptions([$option]); 6789 6790 self.insertTag(data, tag); 6791 } 6792 6793 obj.results = data; 6794 6795 callback(obj); 6796 } 6797 6798 decorated.call(this, params, wrapper); 6799 }; 6800 6801 Tags.prototype.createTag = function (decorated, params) { 6802 var term = $.trim(params.term); 6803 6804 if (term === '') { 6805 return null; 6806 } 6807 6808 return { 6809 id: term, 6810 text: term 6811 }; 6812 }; 6813 6814 Tags.prototype.insertTag = function (_, data, tag) { 6815 data.unshift(tag); 6816 }; 6817 6818 Tags.prototype._removeOldTags = function (_) { 6819 var $options = this.$element.find('option[data-select2-tag]'); 6820 6821 $options.each(function () { 6822 if (this.selected) { 6823 return; 6824 } 6825 6826 $(this).remove(); 6827 }); 6828 }; 6829 6830 return Tags; 6831}); 6832 6833S2.define('select2/data/tokenizer',[ 6834 'jquery' 6835], function ($) { 6836 function Tokenizer (decorated, $element, options) { 6837 var tokenizer = options.get('tokenizer'); 6838 6839 if (tokenizer !== undefined) { 6840 this.tokenizer = tokenizer; 6841 } 6842 6843 decorated.call(this, $element, options); 6844 } 6845 6846 Tokenizer.prototype.bind = function (decorated, container, $container) { 6847 decorated.call(this, container, $container); 6848 6849 this.$search = container.dropdown.$search || container.selection.$search || 6850 $container.find('.select2-search__field'); 6851 }; 6852 6853 Tokenizer.prototype.query = function (decorated, params, callback) { 6854 var self = this; 6855 6856 function createAndSelect (data) { 6857 // Normalize the data object so we can use it for checks 6858 var item = self._normalizeItem(data); 6859 6860 // Check if the data object already exists as a tag 6861 // Select it if it doesn't 6862 var $existingOptions = self.$element.find('option').filter(function () { 6863 return $(this).val() === item.id; 6864 }); 6865 6866 // If an existing option wasn't found for it, create the option 6867 if (!$existingOptions.length) { 6868 var $option = self.option(item); 6869 $option.attr('data-select2-tag', true); 6870 6871 self._removeOldTags(); 6872 self.addOptions([$option]); 6873 } 6874 6875 // Select the item, now that we know there is an option for it 6876 select(item); 6877 } 6878 6879 function select (data) { 6880 self.trigger('select', { 6881 data: data 6882 }); 6883 } 6884 6885 params.term = params.term || ''; 6886 6887 var tokenData = this.tokenizer(params, this.options, createAndSelect); 6888 6889 if (tokenData.term !== params.term) { 6890 // Replace the search term if we have the search box 6891 if (this.$search.length) { 6892 this.$search.val(tokenData.term); 6893 this.$search.trigger('focus'); 6894 } 6895 6896 params.term = tokenData.term; 6897 } 6898 6899 decorated.call(this, params, callback); 6900 }; 6901 6902 Tokenizer.prototype.tokenizer = function (_, params, options, callback) { 6903 var separators = options.get('tokenSeparators') || []; 6904 var term = params.term; 6905 var i = 0; 6906 6907 var createTag = this.createTag || function (params) { 6908 return { 6909 id: params.term, 6910 text: params.term 6911 }; 6912 }; 6913 6914 while (i < term.length) { 6915 var termChar = term[i]; 6916 6917 if ($.inArray(termChar, separators) === -1) { 6918 i++; 6919 6920 continue; 6921 } 6922 6923 var part = term.substr(0, i); 6924 var partParams = $.extend({}, params, { 6925 term: part 6926 }); 6927 6928 var data = createTag(partParams); 6929 6930 if (data == null) { 6931 i++; 6932 continue; 6933 } 6934 6935 callback(data); 6936 6937 // Reset the term to not include the tokenized portion 6938 term = term.substr(i + 1) || ''; 6939 i = 0; 6940 } 6941 6942 return { 6943 term: term 6944 }; 6945 }; 6946 6947 return Tokenizer; 6948}); 6949 6950S2.define('select2/data/minimumInputLength',[ 6951 6952], function () { 6953 function MinimumInputLength (decorated, $e, options) { 6954 this.minimumInputLength = options.get('minimumInputLength'); 6955 6956 decorated.call(this, $e, options); 6957 } 6958 6959 MinimumInputLength.prototype.query = function (decorated, params, callback) { 6960 params.term = params.term || ''; 6961 6962 if (params.term.length < this.minimumInputLength) { 6963 this.trigger('results:message', { 6964 message: 'inputTooShort', 6965 args: { 6966 minimum: this.minimumInputLength, 6967 input: params.term, 6968 params: params 6969 } 6970 }); 6971 6972 return; 6973 } 6974 6975 decorated.call(this, params, callback); 6976 }; 6977 6978 return MinimumInputLength; 6979}); 6980 6981S2.define('select2/data/maximumInputLength',[ 6982 6983], function () { 6984 function MaximumInputLength (decorated, $e, options) { 6985 this.maximumInputLength = options.get('maximumInputLength'); 6986 6987 decorated.call(this, $e, options); 6988 } 6989 6990 MaximumInputLength.prototype.query = function (decorated, params, callback) { 6991 params.term = params.term || ''; 6992 6993 if (this.maximumInputLength > 0 && 6994 params.term.length > this.maximumInputLength) { 6995 this.trigger('results:message', { 6996 message: 'inputTooLong', 6997 args: { 6998 maximum: this.maximumInputLength, 6999 input: params.term, 7000 params: params 7001 } 7002 }); 7003 7004 return; 7005 } 7006 7007 decorated.call(this, params, callback); 7008 }; 7009 7010 return MaximumInputLength; 7011}); 7012 7013S2.define('select2/data/maximumSelectionLength',[ 7014 7015], function (){ 7016 function MaximumSelectionLength (decorated, $e, options) { 7017 this.maximumSelectionLength = options.get('maximumSelectionLength'); 7018 7019 decorated.call(this, $e, options); 7020 } 7021 7022 MaximumSelectionLength.prototype.bind = 7023 function (decorated, container, $container) { 7024 var self = this; 7025 7026 decorated.call(this, container, $container); 7027 7028 container.on('select', function () { 7029 self._checkIfMaximumSelected(); 7030 }); 7031 }; 7032 7033 MaximumSelectionLength.prototype.query = 7034 function (decorated, params, callback) { 7035 var self = this; 7036 7037 this._checkIfMaximumSelected(function () { 7038 decorated.call(self, params, callback); 7039 }); 7040 }; 7041 7042 MaximumSelectionLength.prototype._checkIfMaximumSelected = 7043 function (_, successCallback) { 7044 var self = this; 7045 7046 this.current(function (currentData) { 7047 var count = currentData != null ? currentData.length : 0; 7048 if (self.maximumSelectionLength > 0 && 7049 count >= self.maximumSelectionLength) { 7050 self.trigger('results:message', { 7051 message: 'maximumSelected', 7052 args: { 7053 maximum: self.maximumSelectionLength 7054 } 7055 }); 7056 return; 7057 } 7058 7059 if (successCallback) { 7060 successCallback(); 7061 } 7062 }); 7063 }; 7064 7065 return MaximumSelectionLength; 7066}); 7067 7068S2.define('select2/dropdown',[ 7069 'jquery', 7070 './utils' 7071], function ($, Utils) { 7072 function Dropdown ($element, options) { 7073 this.$element = $element; 7074 this.options = options; 7075 7076 Dropdown.__super__.constructor.call(this); 7077 } 7078 7079 Utils.Extend(Dropdown, Utils.Observable); 7080 7081 Dropdown.prototype.render = function () { 7082 var $dropdown = $( 7083 '<span class="select2-dropdown">' + 7084 '<span class="select2-results"></span>' + 7085 '</span>' 7086 ); 7087 7088 $dropdown.attr('dir', this.options.get('dir')); 7089 7090 this.$dropdown = $dropdown; 7091 7092 return $dropdown; 7093 }; 7094 7095 Dropdown.prototype.bind = function () { 7096 // Should be implemented in subclasses 7097 }; 7098 7099 Dropdown.prototype.position = function ($dropdown, $container) { 7100 // Should be implemented in subclasses 7101 }; 7102 7103 Dropdown.prototype.destroy = function () { 7104 // Remove the dropdown from the DOM 7105 this.$dropdown.remove(); 7106 }; 7107 7108 return Dropdown; 7109}); 7110 7111S2.define('select2/dropdown/search',[ 7112 'jquery', 7113 '../utils' 7114], function ($, Utils) { 7115 function Search () { } 7116 7117 Search.prototype.render = function (decorated) { 7118 var $rendered = decorated.call(this); 7119 7120 var $search = $( 7121 '<span class="select2-search select2-search--dropdown">' + 7122 '<input class="select2-search__field" type="search" tabindex="-1"' + 7123 ' autocomplete="off" autocorrect="off" autocapitalize="none"' + 7124 ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + 7125 '</span>' 7126 ); 7127 7128 this.$searchContainer = $search; 7129 this.$search = $search.find('input'); 7130 7131 $rendered.prepend($search); 7132 7133 return $rendered; 7134 }; 7135 7136 Search.prototype.bind = function (decorated, container, $container) { 7137 var self = this; 7138 7139 var resultsId = container.id + '-results'; 7140 7141 decorated.call(this, container, $container); 7142 7143 this.$search.on('keydown', function (evt) { 7144 self.trigger('keypress', evt); 7145 7146 self._keyUpPrevented = evt.isDefaultPrevented(); 7147 });
vendor: 20,905 bytes, lines 7148-7943
7148 7149 // Workaround for browsers which do not support the `input` event 7150 // This will prevent double-triggering of events for browsers which support 7151 // both the `keyup` and `input` events. 7152 this.$search.on('input', function (evt) { 7153 // Unbind the duplicated `keyup` event 7154 $(this).off('keyup'); 7155 }); 7156 7157 this.$search.on('keyup input', function (evt) { 7158 self.handleSearch(evt); 7159 }); 7160 7161 container.on('open', function () { 7162 self.$search.attr('tabindex', 0); 7163 self.$search.attr('aria-controls', resultsId); 7164 7165 self.$search.trigger('focus'); 7166 7167 window.setTimeout(function () { 7168 self.$search.trigger('focus'); 7169 }, 0); 7170 }); 7171 7172 container.on('close', function () { 7173 self.$search.attr('tabindex', -1); 7174 self.$search.removeAttr('aria-controls'); 7175 self.$search.removeAttr('aria-activedescendant'); 7176 7177 self.$search.val(''); 7178 self.$search.trigger('blur'); 7179 }); 7180 7181 container.on('focus', function () { 7182 if (!container.isOpen()) { 7183 self.$search.trigger('focus'); 7184 } 7185 }); 7186 7187 container.on('results:all', function (params) { 7188 if (params.query.term == null || params.query.term === '') { 7189 var showSearch = self.showSearch(params); 7190 7191 if (showSearch) { 7192 self.$searchContainer.removeClass('select2-search--hide'); 7193 } else { 7194 self.$searchContainer.addClass('select2-search--hide'); 7195 } 7196 } 7197 }); 7198 7199 container.on('results:focus', function (params) { 7200 if (params.data._resultId) { 7201 self.$search.attr('aria-activedescendant', params.data._resultId); 7202 } else { 7203 self.$search.removeAttr('aria-activedescendant'); 7204 } 7205 }); 7206 }; 7207 7208 Search.prototype.handleSearch = function (evt) { 7209 if (!this._keyUpPrevented) { 7210 var input = this.$search.val(); 7211 7212 this.trigger('query', { 7213 term: input 7214 }); 7215 } 7216 7217 this._keyUpPrevented = false; 7218 }; 7219 7220 Search.prototype.showSearch = function (_, params) { 7221 return true; 7222 }; 7223 7224 return Search; 7225}); 7226 7227S2.define('select2/dropdown/hidePlaceholder',[ 7228 7229], function () { 7230 function HidePlaceholder (decorated, $element, options, dataAdapter) { 7231 this.placeholder = this.normalizePlaceholder(options.get('placeholder')); 7232 7233 decorated.call(this, $element, options, dataAdapter); 7234 } 7235 7236 HidePlaceholder.prototype.append = function (decorated, data) { 7237 data.results = this.removePlaceholder(data.results); 7238 7239 decorated.call(this, data); 7240 }; 7241 7242 HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { 7243 if (typeof placeholder === 'string') { 7244 placeholder = { 7245 id: '', 7246 text: placeholder 7247 }; 7248 } 7249 7250 return placeholder; 7251 }; 7252 7253 HidePlaceholder.prototype.removePlaceholder = function (_, data) { 7254 var modifiedData = data.slice(0); 7255 7256 for (var d = data.length - 1; d >= 0; d--) { 7257 var item = data[d]; 7258 7259 if (this.placeholder.id === item.id) { 7260 modifiedData.splice(d, 1); 7261 } 7262 } 7263 7264 return modifiedData; 7265 }; 7266 7267 return HidePlaceholder; 7268}); 7269 7270S2.define('select2/dropdown/infiniteScroll',[ 7271 'jquery' 7272], function ($) { 7273 function InfiniteScroll (decorated, $element, options, dataAdapter) { 7274 this.lastParams = {}; 7275 7276 decorated.call(this, $element, options, dataAdapter); 7277 7278 this.$loadingMore = this.createLoadingMore(); 7279 this.loading = false; 7280 } 7281 7282 InfiniteScroll.prototype.append = function (decorated, data) { 7283 this.$loadingMore.remove(); 7284 this.loading = false; 7285 7286 decorated.call(this, data); 7287 7288 if (this.showLoadingMore(data)) { 7289 this.$results.append(this.$loadingMore); 7290 this.loadMoreIfNeeded(); 7291 } 7292 }; 7293 7294 InfiniteScroll.prototype.bind = function (decorated, container, $container) { 7295 var self = this; 7296 7297 decorated.call(this, container, $container); 7298 7299 container.on('query', function (params) { 7300 self.lastParams = params; 7301 self.loading = true; 7302 }); 7303 7304 container.on('query:append', function (params) { 7305 self.lastParams = params; 7306 self.loading = true; 7307 }); 7308 7309 this.$results.on('scroll', this.loadMoreIfNeeded.bind(this)); 7310 }; 7311 7312 InfiniteScroll.prototype.loadMoreIfNeeded = function () { 7313 var isLoadMoreVisible = $.contains( 7314 document.documentElement, 7315 this.$loadingMore[0] 7316 ); 7317 7318 if (this.loading || !isLoadMoreVisible) { 7319 return; 7320 } 7321 7322 var currentOffset = this.$results.offset().top + 7323 this.$results.outerHeight(false); 7324 var loadingMoreOffset = this.$loadingMore.offset().top + 7325 this.$loadingMore.outerHeight(false); 7326 7327 if (currentOffset + 50 >= loadingMoreOffset) { 7328 this.loadMore(); 7329 } 7330 }; 7331 7332 InfiniteScroll.prototype.loadMore = function () { 7333 this.loading = true; 7334 7335 var params = $.extend({}, {page: 1}, this.lastParams); 7336 7337 params.page++; 7338 7339 this.trigger('query:append', params); 7340 }; 7341 7342 InfiniteScroll.prototype.showLoadingMore = function (_, data) { 7343 return data.pagination && data.pagination.more; 7344 }; 7345 7346 InfiniteScroll.prototype.createLoadingMore = function () { 7347 var $option = $( 7348 '<li ' + 7349 'class="select2-results__option select2-results__option--load-more"' + 7350 'role="option" aria-disabled="true"></li>' 7351 ); 7352 7353 var message = this.options.get('translations').get('loadingMore'); 7354 7355 $option.html(message(this.lastParams)); 7356 7357 return $option; 7358 }; 7359 7360 return InfiniteScroll; 7361}); 7362 7363S2.define('select2/dropdown/attachBody',[ 7364 'jquery', 7365 '../utils' 7366], function ($, Utils) { 7367 function AttachBody (decorated, $element, options) { 7368 this.$dropdownParent = $(options.get('dropdownParent') || document.body); 7369 7370 decorated.call(this, $element, options); 7371 } 7372 7373 AttachBody.prototype.bind = function (decorated, container, $container) { 7374 var self = this; 7375 7376 decorated.call(this, container, $container); 7377 7378 container.on('open', function () { 7379 self._showDropdown(); 7380 self._attachPositioningHandler(container); 7381 7382 // Must bind after the results handlers to ensure correct sizing 7383 self._bindContainerResultHandlers(container); 7384 }); 7385 7386 container.on('close', function () { 7387 self._hideDropdown(); 7388 self._detachPositioningHandler(container); 7389 }); 7390 7391 this.$dropdownContainer.on('mousedown', function (evt) { 7392 evt.stopPropagation(); 7393 }); 7394 }; 7395 7396 AttachBody.prototype.destroy = function (decorated) { 7397 decorated.call(this); 7398 7399 this.$dropdownContainer.remove(); 7400 }; 7401 7402 AttachBody.prototype.position = function (decorated, $dropdown, $container) { 7403 // Clone all of the container classes 7404 $dropdown.attr('class', $container.attr('class')); 7405 7406 $dropdown.removeClass('select2'); 7407 $dropdown.addClass('select2-container--open'); 7408 7409 $dropdown.css({ 7410 position: 'absolute', 7411 top: -999999 7412 }); 7413 7414 this.$container = $container; 7415 }; 7416 7417 AttachBody.prototype.render = function (decorated) { 7418 var $container = $('<span></span>'); 7419 7420 var $dropdown = decorated.call(this); 7421 $container.append($dropdown); 7422 7423 this.$dropdownContainer = $container; 7424 7425 return $container; 7426 }; 7427 7428 AttachBody.prototype._hideDropdown = function (decorated) { 7429 this.$dropdownContainer.detach(); 7430 }; 7431 7432 AttachBody.prototype._bindContainerResultHandlers = 7433 function (decorated, container) { 7434 7435 // These should only be bound once 7436 if (this._containerResultsHandlersBound) { 7437 return; 7438 } 7439 7440 var self = this; 7441 7442 container.on('results:all', function () { 7443 self._positionDropdown(); 7444 self._resizeDropdown(); 7445 }); 7446 7447 container.on('results:append', function () { 7448 self._positionDropdown(); 7449 self._resizeDropdown(); 7450 }); 7451 7452 container.on('results:message', function () { 7453 self._positionDropdown(); 7454 self._resizeDropdown(); 7455 }); 7456 7457 container.on('select', function () { 7458 self._positionDropdown(); 7459 self._resizeDropdown(); 7460 }); 7461 7462 container.on('unselect', function () { 7463 self._positionDropdown(); 7464 self._resizeDropdown(); 7465 }); 7466 7467 this._containerResultsHandlersBound = true; 7468 }; 7469 7470 AttachBody.prototype._attachPositioningHandler = 7471 function (decorated, container) { 7472 var self = this; 7473 7474 var scrollEvent = 'scroll.select2.' + container.id; 7475 var resizeEvent = 'resize.select2.' + container.id; 7476 var orientationEvent = 'orientationchange.select2.' + container.id; 7477 7478 var $watchers = this.$container.parents().filter(Utils.hasScroll); 7479 $watchers.each(function () { 7480 Utils.StoreData(this, 'select2-scroll-position', { 7481 x: $(this).scrollLeft(), 7482 y: $(this).scrollTop() 7483 }); 7484 }); 7485 7486 $watchers.on(scrollEvent, function (ev) { 7487 var position = Utils.GetData(this, 'select2-scroll-position'); 7488 $(this).scrollTop(position.y); 7489 }); 7490 7491 $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, 7492 function (e) { 7493 self._positionDropdown(); 7494 self._resizeDropdown(); 7495 }); 7496 }; 7497 7498 AttachBody.prototype._detachPositioningHandler = 7499 function (decorated, container) { 7500 var scrollEvent = 'scroll.select2.' + container.id; 7501 var resizeEvent = 'resize.select2.' + container.id; 7502 var orientationEvent = 'orientationchange.select2.' + container.id; 7503 7504 var $watchers = this.$container.parents().filter(Utils.hasScroll); 7505 $watchers.off(scrollEvent); 7506 7507 $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); 7508 }; 7509 7510 AttachBody.prototype._positionDropdown = function () { 7511 var $window = $(window); 7512 7513 var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); 7514 var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); 7515 7516 var newDirection = null; 7517 7518 var offset = this.$container.offset(); 7519 7520 offset.bottom = offset.top + this.$container.outerHeight(false); 7521 7522 var container = { 7523 height: this.$container.outerHeight(false) 7524 }; 7525 7526 container.top = offset.top; 7527 container.bottom = offset.top + container.height; 7528 7529 var dropdown = { 7530 height: this.$dropdown.outerHeight(false) 7531 }; 7532 7533 var viewport = { 7534 top: $window.scrollTop(), 7535 bottom: $window.scrollTop() + $window.height() 7536 }; 7537 7538 var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); 7539 var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); 7540 7541 var css = { 7542 left: offset.left, 7543 top: container.bottom 7544 }; 7545 7546 // Determine what the parent element is to use for calculating the offset 7547 var $offsetParent = this.$dropdownParent; 7548 7549 // For statically positioned elements, we need to get the element 7550 // that is determining the offset 7551 if ($offsetParent.css('position') === 'static') { 7552 $offsetParent = $offsetParent.offsetParent(); 7553 } 7554 7555 var parentOffset = { 7556 top: 0, 7557 left: 0 7558 }; 7559 7560 if ( 7561 $.contains(document.body, $offsetParent[0]) || 7562 $offsetParent[0].isConnected 7563 ) { 7564 parentOffset = $offsetParent.offset(); 7565 } 7566 7567 css.top -= parentOffset.top; 7568 css.left -= parentOffset.left; 7569 7570 if (!isCurrentlyAbove && !isCurrentlyBelow) { 7571 newDirection = 'below'; 7572 } 7573 7574 if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { 7575 newDirection = 'above'; 7576 } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { 7577 newDirection = 'below'; 7578 } 7579 7580 if (newDirection == 'above' || 7581 (isCurrentlyAbove && newDirection !== 'below')) { 7582 css.top = container.top - parentOffset.top - dropdown.height; 7583 } 7584 7585 if (newDirection != null) { 7586 this.$dropdown 7587 .removeClass('select2-dropdown--below select2-dropdown--above') 7588 .addClass('select2-dropdown--' + newDirection); 7589 this.$container 7590 .removeClass('select2-container--below select2-container--above') 7591 .addClass('select2-container--' + newDirection); 7592 } 7593 7594 this.$dropdownContainer.css(css); 7595 }; 7596 7597 AttachBody.prototype._resizeDropdown = function () { 7598 var css = { 7599 width: this.$container.outerWidth(false) + 'px' 7600 }; 7601 7602 if (this.options.get('dropdownAutoWidth')) { 7603 css.minWidth = css.width; 7604 css.position = 'relative'; 7605 css.width = 'auto'; 7606 } 7607 7608 this.$dropdown.css(css); 7609 }; 7610 7611 AttachBody.prototype._showDropdown = function (decorated) { 7612 this.$dropdownContainer.appendTo(this.$dropdownParent); 7613 7614 this._positionDropdown(); 7615 this._resizeDropdown(); 7616 }; 7617 7618 return AttachBody; 7619}); 7620 7621S2.define('select2/dropdown/minimumResultsForSearch',[ 7622 7623], function () { 7624 function countResults (data) { 7625 var count = 0; 7626 7627 for (var d = 0; d < data.length; d++) { 7628 var item = data[d]; 7629 7630 if (item.children) { 7631 count += countResults(item.children); 7632 } else { 7633 count++; 7634 } 7635 } 7636 7637 return count; 7638 } 7639 7640 function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { 7641 this.minimumResultsForSearch = options.get('minimumResultsForSearch'); 7642 7643 if (this.minimumResultsForSearch < 0) { 7644 this.minimumResultsForSearch = Infinity; 7645 } 7646 7647 decorated.call(this, $element, options, dataAdapter); 7648 } 7649 7650 MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { 7651 if (countResults(params.data.results) < this.minimumResultsForSearch) { 7652 return false; 7653 } 7654 7655 return decorated.call(this, params); 7656 }; 7657 7658 return MinimumResultsForSearch; 7659}); 7660 7661S2.define('select2/dropdown/selectOnClose',[ 7662 '../utils' 7663], function (Utils) { 7664 function SelectOnClose () { } 7665 7666 SelectOnClose.prototype.bind = function (decorated, container, $container) { 7667 var self = this; 7668 7669 decorated.call(this, container, $container); 7670 7671 container.on('close', function (params) { 7672 self._handleSelectOnClose(params); 7673 }); 7674 }; 7675 7676 SelectOnClose.prototype._handleSelectOnClose = function (_, params) { 7677 if (params && params.originalSelect2Event != null) { 7678 var event = params.originalSelect2Event; 7679 7680 // Don't select an item if the close event was triggered from a select or 7681 // unselect event 7682 if (event._type === 'select' || event._type === 'unselect') { 7683 return; 7684 } 7685 } 7686 7687 var $highlightedResults = this.getHighlightedResults(); 7688 7689 // Only select highlighted results 7690 if ($highlightedResults.length < 1) { 7691 return; 7692 } 7693 7694 var data = Utils.GetData($highlightedResults[0], 'data'); 7695 7696 // Don't re-select already selected resulte 7697 if ( 7698 (data.element != null && data.element.selected) || 7699 (data.element == null && data.selected) 7700 ) { 7701 return; 7702 } 7703 7704 this.trigger('select', { 7705 data: data 7706 }); 7707 }; 7708 7709 return SelectOnClose; 7710}); 7711 7712S2.define('select2/dropdown/closeOnSelect',[ 7713 7714], function () { 7715 function CloseOnSelect () { } 7716 7717 CloseOnSelect.prototype.bind = function (decorated, container, $container) { 7718 var self = this; 7719 7720 decorated.call(this, container, $container); 7721 7722 container.on('select', function (evt) { 7723 self._selectTriggered(evt); 7724 }); 7725 7726 container.on('unselect', function (evt) { 7727 self._selectTriggered(evt); 7728 }); 7729 }; 7730 7731 CloseOnSelect.prototype._selectTriggered = function (_, evt) { 7732 var originalEvent = evt.originalEvent; 7733 7734 // Don't close if the control key is being held 7735 if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) { 7736 return; 7737 } 7738 7739 this.trigger('close', { 7740 originalEvent: originalEvent, 7741 originalSelect2Event: evt 7742 }); 7743 }; 7744 7745 return CloseOnSelect; 7746}); 7747 7748S2.define('select2/i18n/en',[],function () { 7749 // English 7750 return { 7751 errorLoading: function () { 7752 return 'The results could not be loaded.'; 7753 }, 7754 inputTooLong: function (args) { 7755 var overChars = args.input.length - args.maximum; 7756 7757 var message = 'Please delete ' + overChars + ' character'; 7758 7759 if (overChars != 1) { 7760 message += 's'; 7761 } 7762 7763 return message; 7764 }, 7765 inputTooShort: function (args) { 7766 var remainingChars = args.minimum - args.input.length; 7767 7768 var message = 'Please enter ' + remainingChars + ' or more characters'; 7769 7770 return message; 7771 }, 7772 loadingMore: function () { 7773 return 'Loading more results…'; 7774 }, 7775 maximumSelected: function (args) { 7776 var message = 'You can only select ' + args.maximum + ' item'; 7777 7778 if (args.maximum != 1) { 7779 message += 's'; 7780 } 7781 7782 return message; 7783 }, 7784 noResults: function () { 7785 return 'No results found'; 7786 }, 7787 searching: function () { 7788 return 'Searching…'; 7789 }, 7790 removeAllItems: function () { 7791 return 'Remove all items'; 7792 } 7793 }; 7794}); 7795 7796S2.define('select2/defaults',[ 7797 'jquery', 7798 'require', 7799 7800 './results', 7801 7802 './selection/single', 7803 './selection/multiple', 7804 './selection/placeholder', 7805 './selection/allowClear', 7806 './selection/search', 7807 './selection/eventRelay', 7808 7809 './utils', 7810 './translation', 7811 './diacritics', 7812 7813 './data/select', 7814 './data/array', 7815 './data/ajax', 7816 './data/tags', 7817 './data/tokenizer', 7818 './data/minimumInputLength', 7819 './data/maximumInputLength', 7820 './data/maximumSelectionLength', 7821 7822 './dropdown', 7823 './dropdown/search', 7824 './dropdown/hidePlaceholder', 7825 './dropdown/infiniteScroll', 7826 './dropdown/attachBody', 7827 './dropdown/minimumResultsForSearch', 7828 './dropdown/selectOnClose', 7829 './dropdown/closeOnSelect', 7830 7831 './i18n/en' 7832], function ($, require, 7833 7834 ResultsList, 7835 7836 SingleSelection, MultipleSelection, Placeholder, AllowClear, 7837 SelectionSearch, EventRelay, 7838 7839 Utils, Translation, DIACRITICS, 7840 7841 SelectData, ArrayData, AjaxData, Tags, Tokenizer, 7842 MinimumInputLength, MaximumInputLength, MaximumSelectionLength, 7843 7844 Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, 7845 AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, 7846 7847 EnglishTranslation) { 7848 function Defaults () { 7849 this.reset(); 7850 } 7851 7852 Defaults.prototype.apply = function (options) { 7853 options = $.extend(true, {}, this.defaults, options); 7854 7855 if (options.dataAdapter == null) { 7856 if (options.ajax != null) { 7857 options.dataAdapter = AjaxData; 7858 } else if (options.data != null) { 7859 options.dataAdapter = ArrayData; 7860 } else { 7861 options.dataAdapter = SelectData; 7862 } 7863 7864 if (options.minimumInputLength > 0) { 7865 options.dataAdapter = Utils.Decorate( 7866 options.dataAdapter, 7867 MinimumInputLength 7868 ); 7869 } 7870 7871 if (options.maximumInputLength > 0) { 7872 options.dataAdapter = Utils.Decorate( 7873 options.dataAdapter, 7874 MaximumInputLength 7875 ); 7876 } 7877 7878 if (options.maximumSelectionLength > 0) { 7879 options.dataAdapter = Utils.Decorate( 7880 options.dataAdapter, 7881 MaximumSelectionLength 7882 ); 7883 } 7884 7885 if (options.tags) { 7886 options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); 7887 } 7888 7889 if (options.tokenSeparators != null || options.tokenizer != null) { 7890 options.dataAdapter = Utils.Decorate( 7891 options.dataAdapter, 7892 Tokenizer 7893 ); 7894 } 7895 7896 if (options.query != null) { 7897 var Query = require(options.amdBase + 'compat/query'); 7898 7899 options.dataAdapter = Utils.Decorate( 7900 options.dataAdapter, 7901 Query 7902 ); 7903 } 7904 7905 if (options.initSelection != null) { 7906 var InitSelection = require(options.amdBase + 'compat/initSelection'); 7907 7908 options.dataAdapter = Utils.Decorate( 7909 options.dataAdapter, 7910 InitSelection 7911 ); 7912 } 7913 } 7914 7915 if (options.resultsAdapter == null) { 7916 options.resultsAdapter = ResultsList; 7917 7918 if (options.ajax != null) { 7919 options.resultsAdapter = Utils.Decorate( 7920 options.resultsAdapter, 7921 InfiniteScroll 7922 ); 7923 } 7924 7925 if (options.placeholder != null) { 7926 options.resultsAdapter = Utils.Decorate( 7927 options.resultsAdapter, 7928 HidePlaceholder 7929 ); 7930 } 7931 7932 if (options.selectOnClose) { 7933 options.resultsAdapter = Utils.Decorate( 7934 options.resultsAdapter, 7935 SelectOnClose 7936 ); 7937 } 7938 } 7939 7940 if (options.dropdownAdapter == null) { 7941 if (options.multiple) { 7942 options.dropdownAdapter = Dropdown; 7943 } else {
7944 var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); 7945 7946 options.dropdownAdapter = SearchableDropdown; 7947 } 7948 7949 if (options.minimumResultsForSearch !== 0) { 7950 options.dropdownAdapter = Utils.Decorate( 7951 options.dropdownAdapter, 7952 MinimumResultsForSearch 7953 ); 7954 } 7955 7956 if (options.closeOnSelect) { 7957 options.dropdownAdapter = Utils.Decorate( 7958 options.dropdownAdapter, 7959 CloseOnSelect 7960 ); 7961 } 7962 7963 if ( 7964 options.dropdownCssClass != null || 7965 options.dropdownCss != null || 7966 options.adaptDropdownCssClass != null 7967 ) { 7968 var DropdownCSS = require(options.amdBase + 'compat/dropdownCss'); 7969 7970 options.dropdownAdapter = Utils.Decorate( 7971 options.dropdownAdapter, 7972 DropdownCSS 7973 ); 7974 } 7975 7976 options.dropdownAdapter = Utils.Decorate( 7977 options.dropdownAdapter, 7978 AttachBody 7979 ); 7980 } 7981 7982 if (options.selectionAdapter == null) { 7983 if (options.multiple) { 7984 options.selectionAdapter = MultipleSelection; 7985 } else { 7986 options.selectionAdapter = SingleSelection; 7987 } 7988 7989 // Add the placeholder mixin if a placeholder was specified 7990 if (options.placeholder != null) { 7991 options.selectionAdapter = Utils.Decorate( 7992 options.selectionAdapter, 7993 Placeholder 7994 ); 7995 } 7996 7997 if (options.allowClear) { 7998 options.selectionAdapter = Utils.Decorate( 7999 options.selectionAdapter, 8000 AllowClear 8001 ); 8002 } 8003 8004 if (options.multiple) { 8005 options.selectionAdapter = Utils.Decorate( 8006 options.selectionAdapter, 8007 SelectionSearch 8008 ); 8009 } 8010 8011 if ( 8012 options.containerCssClass != null || 8013 options.containerCss != null || 8014 options.adaptContainerCssClass != null 8015 ) { 8016 var ContainerCSS = require(options.amdBase + 'compat/containerCss'); 8017 8018 options.selectionAdapter = Utils.Decorate( 8019 options.selectionAdapter, 8020 ContainerCSS 8021 ); 8022 } 8023 8024 options.selectionAdapter = Utils.Decorate( 8025 options.selectionAdapter, 8026 EventRelay 8027 ); 8028 } 8029 8030 // If the defaults were not previously applied from an element, it is 8031 // possible for the language option to have not been resolved 8032 options.language = this._resolveLanguage(options.language); 8033 8034 // Always fall back to English since it will always be complete 8035 options.language.push('en'); 8036 8037 var uniqueLanguages = []; 8038 8039 for (var l = 0; l < options.language.length; l++) { 8040 var language = options.language[l]; 8041 8042 if (uniqueLanguages.indexOf(language) === -1) { 8043 uniqueLanguages.push(language); 8044 } 8045 } 8046 8047 options.language = uniqueLanguages; 8048 8049 options.translations = this._processTranslations( 8050 options.language, 8051 options.debug 8052 ); 8053 8054 return options; 8055 }; 8056 8057 Defaults.prototype.reset = function () { 8058 function stripDiacritics (text) { 8059 // Used 'uni range + named function' from http://jsperf.com/diacritics/18 8060 function match(a) { 8061 return DIACRITICS[a] || a; 8062 } 8063
vendor: 12,102 bytes, lines 8064-8473
8064 return text.replace(/[^\u0000-\u007E]/g, match); 8065 } 8066 8067 function matcher (params, data) { 8068 // Always return the object if there is nothing to compare 8069 if ($.trim(params.term) === '') { 8070 return data; 8071 } 8072 8073 // Do a recursive check for options with children 8074 if (data.children && data.children.length > 0) { 8075 // Clone the data object if there are children 8076 // This is required as we modify the object to remove any non-matches 8077 var match = $.extend(true, {}, data); 8078 8079 // Check each child of the option 8080 for (var c = data.children.length - 1; c >= 0; c--) { 8081 var child = data.children[c]; 8082 8083 var matches = matcher(params, child); 8084 8085 // If there wasn't a match, remove the object in the array 8086 if (matches == null) { 8087 match.children.splice(c, 1); 8088 } 8089 } 8090 8091 // If any children matched, return the new object 8092 if (match.children.length > 0) { 8093 return match; 8094 } 8095 8096 // If there were no matching children, check just the plain object 8097 return matcher(params, match); 8098 } 8099 8100 var original = stripDiacritics(data.text).toUpperCase(); 8101 var term = stripDiacritics(params.term).toUpperCase(); 8102 8103 // Check if the text contains the term 8104 if (original.indexOf(term) > -1) { 8105 return data; 8106 } 8107 8108 // If it doesn't contain the term, don't return anything 8109 return null; 8110 } 8111 8112 this.defaults = { 8113 amdBase: './', 8114 amdLanguageBase: './i18n/', 8115 closeOnSelect: true, 8116 debug: false, 8117 dropdownAutoWidth: false, 8118 escapeMarkup: Utils.escapeMarkup, 8119 language: {}, 8120 matcher: matcher, 8121 minimumInputLength: 0, 8122 maximumInputLength: 0, 8123 maximumSelectionLength: 0, 8124 minimumResultsForSearch: 0, 8125 selectOnClose: false, 8126 scrollAfterSelect: false, 8127 sorter: function (data) { 8128 return data; 8129 }, 8130 templateResult: function (result) { 8131 return result.text; 8132 }, 8133 templateSelection: function (selection) { 8134 return selection.text; 8135 }, 8136 theme: 'default', 8137 width: 'resolve' 8138 }; 8139 }; 8140 8141 Defaults.prototype.applyFromElement = function (options, $element) { 8142 var optionLanguage = options.language; 8143 var defaultLanguage = this.defaults.language; 8144 var elementLanguage = $element.prop('lang'); 8145 var parentLanguage = $element.closest('[lang]').prop('lang'); 8146 8147 var languages = Array.prototype.concat.call( 8148 this._resolveLanguage(elementLanguage), 8149 this._resolveLanguage(optionLanguage), 8150 this._resolveLanguage(defaultLanguage), 8151 this._resolveLanguage(parentLanguage) 8152 ); 8153 8154 options.language = languages; 8155 8156 return options; 8157 }; 8158 8159 Defaults.prototype._resolveLanguage = function (language) { 8160 if (!language) { 8161 return []; 8162 } 8163 8164 if ($.isEmptyObject(language)) { 8165 return []; 8166 } 8167 8168 if ($.isPlainObject(language)) { 8169 return [language]; 8170 } 8171 8172 var languages; 8173 8174 if (!$.isArray(language)) { 8175 languages = [language]; 8176 } else { 8177 languages = language; 8178 } 8179 8180 var resolvedLanguages = []; 8181 8182 for (var l = 0; l < languages.length; l++) { 8183 resolvedLanguages.push(languages[l]); 8184 8185 if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) { 8186 // Extract the region information if it is included 8187 var languageParts = languages[l].split('-'); 8188 var baseLanguage = languageParts[0]; 8189 8190 resolvedLanguages.push(baseLanguage); 8191 } 8192 } 8193 8194 return resolvedLanguages; 8195 }; 8196 8197 Defaults.prototype._processTranslations = function (languages, debug) { 8198 var translations = new Translation(); 8199 8200 for (var l = 0; l < languages.length; l++) { 8201 var languageData = new Translation(); 8202 8203 var language = languages[l]; 8204 8205 if (typeof language === 'string') { 8206 try { 8207 // Try to load it with the original name 8208 languageData = Translation.loadPath(language); 8209 } catch (e) { 8210 try { 8211 // If we couldn't load it, check if it wasn't the full path 8212 language = this.defaults.amdLanguageBase + language; 8213 languageData = Translation.loadPath(language); 8214 } catch (ex) { 8215 // The translation could not be loaded at all. Sometimes this is 8216 // because of a configuration problem, other times this can be 8217 // because of how Select2 helps load all possible translation files 8218 if (debug && window.console && console.warn) { 8219 console.warn( 8220 'Select2: The language file for "' + language + '" could ' + 8221 'not be automatically loaded. A fallback will be used instead.' 8222 ); 8223 } 8224 } 8225 } 8226 } else if ($.isPlainObject(language)) { 8227 languageData = new Translation(language); 8228 } else { 8229 languageData = language; 8230 } 8231 8232 translations.extend(languageData); 8233 } 8234 8235 return translations; 8236 }; 8237 8238 Defaults.prototype.set = function (key, value) { 8239 var camelKey = $.camelCase(key); 8240 8241 var data = {}; 8242 data[camelKey] = value; 8243 8244 var convertedData = Utils._convertData(data); 8245 8246 $.extend(true, this.defaults, convertedData); 8247 }; 8248 8249 var defaults = new Defaults(); 8250 8251 return defaults; 8252}); 8253 8254S2.define('select2/options',[ 8255 'require', 8256 'jquery', 8257 './defaults', 8258 './utils' 8259], function (require, $, Defaults, Utils) { 8260 function Options (options, $element) { 8261 this.options = options; 8262 8263 if ($element != null) { 8264 this.fromElement($element); 8265 } 8266 8267 if ($element != null) { 8268 this.options = Defaults.applyFromElement(this.options, $element); 8269 } 8270 8271 this.options = Defaults.apply(this.options); 8272 8273 if ($element && $element.is('input')) { 8274 var InputCompat = require(this.get('amdBase') + 'compat/inputData'); 8275 8276 this.options.dataAdapter = Utils.Decorate( 8277 this.options.dataAdapter, 8278 InputCompat 8279 ); 8280 } 8281 } 8282 8283 Options.prototype.fromElement = function ($e) { 8284 var excludedData = ['select2']; 8285 8286 if (this.options.multiple == null) { 8287 this.options.multiple = $e.prop('multiple'); 8288 } 8289 8290 if (this.options.disabled == null) { 8291 this.options.disabled = $e.prop('disabled'); 8292 } 8293 8294 if (this.options.dir == null) { 8295 if ($e.prop('dir')) { 8296 this.options.dir = $e.prop('dir'); 8297 } else if ($e.closest('[dir]').prop('dir')) { 8298 this.options.dir = $e.closest('[dir]').prop('dir'); 8299 } else { 8300 this.options.dir = 'ltr'; 8301 } 8302 } 8303 8304 $e.prop('disabled', this.options.disabled); 8305 $e.prop('multiple', this.options.multiple); 8306 8307 if (Utils.GetData($e[0], 'select2Tags')) { 8308 if (this.options.debug && window.console && console.warn) { 8309 console.warn( 8310 'Select2: The `data-select2-tags` attribute has been changed to ' + 8311 'use the `data-data` and `data-tags="true"` attributes and will be ' + 8312 'removed in future versions of Select2.' 8313 ); 8314 } 8315 8316 Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags')); 8317 Utils.StoreData($e[0], 'tags', true); 8318 } 8319 8320 if (Utils.GetData($e[0], 'ajaxUrl')) { 8321 if (this.options.debug && window.console && console.warn) { 8322 console.warn( 8323 'Select2: The `data-ajax-url` attribute has been changed to ' + 8324 '`data-ajax--url` and support for the old attribute will be removed' + 8325 ' in future versions of Select2.' 8326 ); 8327 } 8328 8329 $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); 8330 Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl')); 8331 } 8332 8333 var dataset = {}; 8334 8335 function upperCaseLetter(_, letter) { 8336 return letter.toUpperCase(); 8337 } 8338 8339 // Pre-load all of the attributes which are prefixed with `data-` 8340 for (var attr = 0; attr < $e[0].attributes.length; attr++) { 8341 var attributeName = $e[0].attributes[attr].name; 8342 var prefix = 'data-'; 8343 8344 if (attributeName.substr(0, prefix.length) == prefix) { 8345 // Get the contents of the attribute after `data-` 8346 var dataName = attributeName.substring(prefix.length); 8347 8348 // Get the data contents from the consistent source 8349 // This is more than likely the jQuery data helper 8350 var dataValue = Utils.GetData($e[0], dataName); 8351 8352 // camelCase the attribute name to match the spec 8353 var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter); 8354 8355 // Store the data attribute contents into the dataset since 8356 dataset[camelDataName] = dataValue; 8357 } 8358 } 8359 8360 // Prefer the element's `dataset` attribute if it exists 8361 // jQuery 1.x does not correctly handle data attributes with multiple dashes 8362 if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { 8363 dataset = $.extend(true, {}, $e[0].dataset, dataset); 8364 } 8365 8366 // Prefer our internal data cache if it exists 8367 var data = $.extend(true, {}, Utils.GetData($e[0]), dataset); 8368 8369 data = Utils._convertData(data); 8370 8371 for (var key in data) { 8372 if ($.inArray(key, excludedData) > -1) { 8373 continue; 8374 } 8375 8376 if ($.isPlainObject(this.options[key])) { 8377 $.extend(this.options[key], data[key]); 8378 } else { 8379 this.options[key] = data[key]; 8380 } 8381 } 8382 8383 return this; 8384 }; 8385 8386 Options.prototype.get = function (key) { 8387 return this.options[key]; 8388 }; 8389 8390 Options.prototype.set = function (key, val) { 8391 this.options[key] = val; 8392 }; 8393 8394 return Options; 8395}); 8396 8397S2.define('select2/core',[ 8398 'jquery', 8399 './options', 8400 './utils', 8401 './keys' 8402], function ($, Options, Utils, KEYS) { 8403 var Select2 = function ($element, options) { 8404 if (Utils.GetData($element[0], 'select2') != null) { 8405 Utils.GetData($element[0], 'select2').destroy(); 8406 } 8407 8408 this.$element = $element; 8409 8410 this.id = this._generateId($element); 8411 8412 options = options || {}; 8413 8414 this.options = new Options(options, $element); 8415 8416 Select2.__super__.constructor.call(this); 8417 8418 // Set up the tabindex 8419 8420 var tabindex = $element.attr('tabindex') || 0; 8421 Utils.StoreData($element[0], 'old-tabindex', tabindex); 8422 $element.attr('tabindex', '-1'); 8423 8424 // Set up containers and adapters 8425 8426 var DataAdapter = this.options.get('dataAdapter'); 8427 this.dataAdapter = new DataAdapter($element, this.options); 8428 8429 var $container = this.render(); 8430 8431 this._placeContainer($container); 8432 8433 var SelectionAdapter = this.options.get('selectionAdapter'); 8434 this.selection = new SelectionAdapter($element, this.options); 8435 this.$selection = this.selection.render(); 8436 8437 this.selection.position(this.$selection, $container); 8438 8439 var DropdownAdapter = this.options.get('dropdownAdapter'); 8440 this.dropdown = new DropdownAdapter($element, this.options); 8441 this.$dropdown = this.dropdown.render(); 8442 8443 this.dropdown.position(this.$dropdown, $container); 8444 8445 var ResultsAdapter = this.options.get('resultsAdapter'); 8446 this.results = new ResultsAdapter($element, this.options, this.dataAdapter); 8447 this.$results = this.results.render(); 8448 8449 this.results.position(this.$results, this.$dropdown); 8450 8451 // Bind events 8452 8453 var self = this; 8454 8455 // Bind the container to all of the adapters 8456 this._bindAdapters(); 8457 8458 // Register any DOM event handlers 8459 this._registerDomEvents(); 8460 8461 // Register any internal event handlers 8462 this._registerDataEvents(); 8463 this._registerSelectionEvents(); 8464 this._registerDropdownEvents(); 8465 this._registerResultsEvents(); 8466 this._registerEvents(); 8467 8468 // Set the initial state 8469 this.dataAdapter.current(function (initialData) { 8470 self.trigger('selection:update', { 8471 data: initialData 8472 }); 8473 });
vendor: 10,486 bytes, lines 8474-8888
8474 8475 // Hide the original select 8476 $element.addClass('select2-hidden-accessible'); 8477 $element.attr('aria-hidden', 'true'); 8478 8479 // Synchronize any monitored attributes 8480 this._syncAttributes(); 8481 8482 Utils.StoreData($element[0], 'select2', this); 8483 8484 // Ensure backwards compatibility with $element.data('select2'). 8485 $element.data('select2', this); 8486 }; 8487 8488 Utils.Extend(Select2, Utils.Observable); 8489 8490 Select2.prototype._generateId = function ($element) { 8491 var id = ''; 8492 8493 if ($element.attr('id') != null) { 8494 id = $element.attr('id'); 8495 } else if ($element.attr('name') != null) { 8496 id = $element.attr('name') + '-' + Utils.generateChars(2); 8497 } else { 8498 id = Utils.generateChars(4); 8499 } 8500 8501 id = id.replace(/(:|\.|\[|\]|,)/g, ''); 8502 id = 'select2-' + id; 8503 8504 return id; 8505 }; 8506 8507 Select2.prototype._placeContainer = function ($container) { 8508 $container.insertAfter(this.$element); 8509 8510 var width = this._resolveWidth(this.$element, this.options.get('width')); 8511 8512 if (width != null) { 8513 $container.css('width', width); 8514 } 8515 }; 8516 8517 Select2.prototype._resolveWidth = function ($element, method) { 8518 var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; 8519 8520 if (method == 'resolve') { 8521 var styleWidth = this._resolveWidth($element, 'style'); 8522 8523 if (styleWidth != null) { 8524 return styleWidth; 8525 } 8526 8527 return this._resolveWidth($element, 'element'); 8528 } 8529 8530 if (method == 'element') { 8531 var elementWidth = $element.outerWidth(false); 8532 8533 if (elementWidth <= 0) { 8534 return 'auto'; 8535 } 8536 8537 return elementWidth + 'px'; 8538 } 8539 8540 if (method == 'style') { 8541 var style = $element.attr('style'); 8542 8543 if (typeof(style) !== 'string') { 8544 return null; 8545 } 8546 8547 var attrs = style.split(';'); 8548 8549 for (var i = 0, l = attrs.length; i < l; i = i + 1) { 8550 var attr = attrs[i].replace(/\s/g, ''); 8551 var matches = attr.match(WIDTH); 8552 8553 if (matches !== null && matches.length >= 1) { 8554 return matches[1]; 8555 } 8556 } 8557 8558 return null; 8559 } 8560 8561 if (method == 'computedstyle') { 8562 var computedStyle = window.getComputedStyle($element[0]); 8563 8564 return computedStyle.width; 8565 } 8566 8567 return method; 8568 }; 8569 8570 Select2.prototype._bindAdapters = function () { 8571 this.dataAdapter.bind(this, this.$container); 8572 this.selection.bind(this, this.$container); 8573 8574 this.dropdown.bind(this, this.$container); 8575 this.results.bind(this, this.$container); 8576 }; 8577 8578 Select2.prototype._registerDomEvents = function () { 8579 var self = this; 8580 8581 this.$element.on('change.select2', function () { 8582 self.dataAdapter.current(function (data) { 8583 self.trigger('selection:update', { 8584 data: data 8585 }); 8586 }); 8587 }); 8588 8589 this.$element.on('focus.select2', function (evt) { 8590 self.trigger('focus', evt); 8591 }); 8592 8593 this._syncA = Utils.bind(this._syncAttributes, this); 8594 this._syncS = Utils.bind(this._syncSubtree, this); 8595 8596 if (this.$element[0].attachEvent) { 8597 this.$element[0].attachEvent('onpropertychange', this._syncA); 8598 } 8599 8600 var observer = window.MutationObserver || 8601 window.WebKitMutationObserver || 8602 window.MozMutationObserver 8603 ; 8604 8605 if (observer != null) { 8606 this._observer = new observer(function (mutations) { 8607 $.each(mutations, self._syncA); 8608 $.each(mutations, self._syncS); 8609 }); 8610 this._observer.observe(this.$element[0], { 8611 attributes: true, 8612 childList: true, 8613 subtree: false 8614 }); 8615 } else if (this.$element[0].addEventListener) { 8616 this.$element[0].addEventListener( 8617 'DOMAttrModified', 8618 self._syncA, 8619 false 8620 ); 8621 this.$element[0].addEventListener( 8622 'DOMNodeInserted', 8623 self._syncS, 8624 false 8625 ); 8626 this.$element[0].addEventListener( 8627 'DOMNodeRemoved', 8628 self._syncS, 8629 false 8630 ); 8631 } 8632 }; 8633 8634 Select2.prototype._registerDataEvents = function () { 8635 var self = this; 8636 8637 this.dataAdapter.on('*', function (name, params) { 8638 self.trigger(name, params); 8639 }); 8640 }; 8641 8642 Select2.prototype._registerSelectionEvents = function () { 8643 var self = this; 8644 var nonRelayEvents = ['toggle', 'focus']; 8645 8646 this.selection.on('toggle', function () { 8647 self.toggleDropdown(); 8648 }); 8649 8650 this.selection.on('focus', function (params) { 8651 self.focus(params); 8652 }); 8653 8654 this.selection.on('*', function (name, params) { 8655 if ($.inArray(name, nonRelayEvents) !== -1) { 8656 return; 8657 } 8658 8659 self.trigger(name, params); 8660 }); 8661 }; 8662 8663 Select2.prototype._registerDropdownEvents = function () { 8664 var self = this; 8665 8666 this.dropdown.on('*', function (name, params) { 8667 self.trigger(name, params); 8668 }); 8669 }; 8670 8671 Select2.prototype._registerResultsEvents = function () { 8672 var self = this; 8673 8674 this.results.on('*', function (name, params) { 8675 self.trigger(name, params); 8676 }); 8677 }; 8678 8679 Select2.prototype._registerEvents = function () { 8680 var self = this; 8681 8682 this.on('open', function () { 8683 self.$container.addClass('select2-container--open'); 8684 }); 8685 8686 this.on('close', function () { 8687 self.$container.removeClass('select2-container--open'); 8688 }); 8689 8690 this.on('enable', function () { 8691 self.$container.removeClass('select2-container--disabled'); 8692 }); 8693 8694 this.on('disable', function () { 8695 self.$container.addClass('select2-container--disabled'); 8696 }); 8697 8698 this.on('blur', function () { 8699 self.$container.removeClass('select2-container--focus'); 8700 }); 8701 8702 this.on('query', function (params) { 8703 if (!self.isOpen()) { 8704 self.trigger('open', {}); 8705 } 8706 8707 this.dataAdapter.query(params, function (data) { 8708 self.trigger('results:all', { 8709 data: data, 8710 query: params 8711 }); 8712 }); 8713 }); 8714 8715 this.on('query:append', function (params) { 8716 this.dataAdapter.query(params, function (data) { 8717 self.trigger('results:append', { 8718 data: data, 8719 query: params 8720 }); 8721 }); 8722 }); 8723 8724 this.on('keypress', function (evt) { 8725 var key = evt.which; 8726 8727 if (self.isOpen()) { 8728 if (key === KEYS.ESC || key === KEYS.TAB || 8729 (key === KEYS.UP && evt.altKey)) { 8730 self.close(); 8731 8732 evt.preventDefault(); 8733 } else if (key === KEYS.ENTER) { 8734 self.trigger('results:select', {}); 8735 8736 evt.preventDefault(); 8737 } else if ((key === KEYS.SPACE && evt.ctrlKey)) { 8738 self.trigger('results:toggle', {}); 8739 8740 evt.preventDefault(); 8741 } else if (key === KEYS.UP) { 8742 self.trigger('results:previous', {}); 8743 8744 evt.preventDefault(); 8745 } else if (key === KEYS.DOWN) { 8746 self.trigger('results:next', {}); 8747 8748 evt.preventDefault(); 8749 } 8750 } else { 8751 if (key === KEYS.ENTER || key === KEYS.SPACE || 8752 (key === KEYS.DOWN && evt.altKey)) { 8753 self.open(); 8754 8755 evt.preventDefault(); 8756 } 8757 } 8758 }); 8759 }; 8760 8761 Select2.prototype._syncAttributes = function () { 8762 this.options.set('disabled', this.$element.prop('disabled')); 8763 8764 if (this.options.get('disabled')) { 8765 if (this.isOpen()) { 8766 this.close(); 8767 } 8768 8769 this.trigger('disable', {}); 8770 } else { 8771 this.trigger('enable', {}); 8772 } 8773 }; 8774 8775 Select2.prototype._syncSubtree = function (evt, mutations) { 8776 var changed = false; 8777 var self = this; 8778 8779 // Ignore any mutation events raised for elements that aren't options or 8780 // optgroups. This handles the case when the select element is destroyed 8781 if ( 8782 evt && evt.target && ( 8783 evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP' 8784 ) 8785 ) { 8786 return; 8787 } 8788 8789 if (!mutations) { 8790 // If mutation events aren't supported, then we can only assume that the 8791 // change affected the selections 8792 changed = true; 8793 } else if (mutations.addedNodes && mutations.addedNodes.length > 0) { 8794 for (var n = 0; n < mutations.addedNodes.length; n++) { 8795 var node = mutations.addedNodes[n]; 8796 8797 if (node.selected) { 8798 changed = true; 8799 } 8800 } 8801 } else if (mutations.removedNodes && mutations.removedNodes.length > 0) { 8802 changed = true; 8803 } 8804 8805 // Only re-pull the data if we think there is a change 8806 if (changed) { 8807 this.dataAdapter.current(function (currentData) { 8808 self.trigger('selection:update', { 8809 data: currentData 8810 }); 8811 }); 8812 } 8813 }; 8814 8815 /** 8816 * Override the trigger method to automatically trigger pre-events when 8817 * there are events that can be prevented. 8818 */ 8819 Select2.prototype.trigger = function (name, args) { 8820 var actualTrigger = Select2.__super__.trigger; 8821 var preTriggerMap = { 8822 'open': 'opening', 8823 'close': 'closing', 8824 'select': 'selecting', 8825 'unselect': 'unselecting', 8826 'clear': 'clearing' 8827 }; 8828 8829 if (args === undefined) { 8830 args = {}; 8831 } 8832 8833 if (name in preTriggerMap) { 8834 var preTriggerName = preTriggerMap[name]; 8835 var preTriggerArgs = { 8836 prevented: false, 8837 name: name, 8838 args: args 8839 }; 8840 8841 actualTrigger.call(this, preTriggerName, preTriggerArgs); 8842 8843 if (preTriggerArgs.prevented) { 8844 args.prevented = true; 8845 8846 return; 8847 } 8848 } 8849 8850 actualTrigger.call(this, name, args); 8851 }; 8852 8853 Select2.prototype.toggleDropdown = function () { 8854 if (this.options.get('disabled')) { 8855 return; 8856 } 8857 8858 if (this.isOpen()) { 8859 this.close(); 8860 } else { 8861 this.open(); 8862 } 8863 }; 8864 8865 Select2.prototype.open = function () { 8866 if (this.isOpen()) { 8867 return; 8868 } 8869 8870 this.trigger('query', {}); 8871 }; 8872 8873 Select2.prototype.close = function () { 8874 if (!this.isOpen()) { 8875 return; 8876 } 8877 8878 this.trigger('close', {}); 8879 }; 8880 8881 Select2.prototype.isOpen = function () { 8882 return this.$container.hasClass('select2-container--open'); 8883 }; 8884 8885 Select2.prototype.hasFocus = function () { 8886 return this.$container.hasClass('select2-container--focus'); 8887 }; 8888
8889 Select2.prototype.focus = function (data) { 8890 // No need to re-trigger focus events if we are already focused 8891 if (this.hasFocus()) { 8892 return; 8893 } 8894 8895 this.$container.addClass('select2-container--focus'); 8896 this.trigger('focus', {}); 8897 }; 8898 8899 Select2.prototype.enable = function (args) { 8900 if (this.options.get('debug') && window.console && console.warn) { 8901 console.warn( 8902 'Select2: The `select2("enable")` method has been deprecated and will' + 8903 ' be removed in later Select2 versions. Use $element.prop("disabled")' + 8904 ' instead.' 8905 ); 8906 } 8907 8908 if (args == null || args.length === 0) { 8909 args = [true]; 8910 } 8911 8912 var disabled = !args[0]; 8913 8914 this.$element.prop('disabled', disabled); 8915 }; 8916 8917 Select2.prototype.data = function () { 8918 if (this.options.get('debug') && 8919 arguments.length > 0 && window.console && console.warn) { 8920 console.warn( 8921 'Select2: Data can no longer be set using `select2("data")`. You ' + 8922 'should consider setting the value instead using `$element.val()`.' 8923 ); 8924 } 8925 8926 var data = []; 8927 8928 this.dataAdapter.current(function (currentData) { 8929 data = currentData; 8930 }); 8931 8932 return data; 8933 }; 8934 8935 Select2.prototype.val = function (args) { 8936 if (this.options.get('debug') && window.console && console.warn) { 8937 console.warn( 8938 'Select2: The `select2("val")` method has been deprecated and will be' + 8939 ' removed in later Select2 versions. Use $element.val() instead.' 8940 ); 8941 } 8942 8943 if (args == null || args.length === 0) { 8944 return this.$element.val(); 8945 } 8946 8947 var newVal = args[0]; 8948 8949 if ($.isArray(newVal)) { 8950 newVal = $.map(newVal, function (obj) { 8951 return obj.toString(); 8952 }); 8953 } 8954 8955 this.$element.val(newVal).trigger('change'); 8956 }; 8957 8958 Select2.prototype.destroy = function () { 8959 this.$container.remove(); 8960 8961 if (this.$element[0].detachEvent) { 8962 this.$element[0].detachEvent('onpropertychange', this._syncA); 8963 } 8964 8965 if (this._observer != null) { 8966 this._observer.disconnect(); 8967 this._observer = null; 8968 } else if (this.$element[0].removeEventListener) { 8969 this.$element[0] 8970 .removeEventListener('DOMAttrModified', this._syncA, false); 8971 this.$element[0] 8972 .removeEventListener('DOMNodeInserted', this._syncS, false); 8973 this.$element[0] 8974 .removeEventListener('DOMNodeRemoved', this._syncS, false); 8975 } 8976 8977 this._syncA = null; 8978 this._syncS = null; 8979 8980 this.$element.off('.select2'); 8981 this.$element.attr('tabindex', 8982 Utils.GetData(this.$element[0], 'old-tabindex')); 8983 8984 this.$element.removeClass('select2-hidden-accessible'); 8985 this.$element.attr('aria-hidden', 'false'); 8986 Utils.RemoveData(this.$element[0]); 8987 this.$element.removeData('select2'); 8988 8989 this.dataAdapter.destroy(); 8990 this.selection.destroy(); 8991 this.dropdown.destroy(); 8992 this.results.destroy(); 8993 8994 this.dataAdapter = null; 8995 this.selection = null; 8996 this.dropdown = null; 8997 this.results = null; 8998 }; 8999 9000 Select2.prototype.render = function () { 9001 var $container = $( 9002 '<span class="select2 select2-container">' + 9003 '<span class="selection"></span>' + 9004 '<span class="dropdown-wrapper" aria-hidden="true"></span>' + 9005 '</span>' 9006 ); 9007 9008 $container.attr('dir', this.options.get('dir')); 9009 9010 this.$container = $container; 9011 9012 this.$container.addClass('select2-container--' + this.options.get('theme')); 9013 9014 Utils.StoreData($container[0], 'element', this.$element); 9015 9016 return $container; 9017 }; 9018 9019 return Select2; 9020}); 9021 9022S2.define('jquery-mousewheel',[ 9023 'jquery' 9024], function ($) { 9025 // Used to shim jQuery.mousewheel for non-full builds. 9026 return $; 9027}); 9028 9029S2.define('jquery.select2',[ 9030 'jquery', 9031 'jquery-mousewheel', 9032 9033 './select2/core', 9034 './select2/defaults', 9035 './select2/utils' 9036], function ($, _, Select2, Defaults, Utils) { 9037 if ($.fn.select2 == null) { 9038 // All methods that should return the element 9039 var thisMethods = ['open', 'close', 'destroy']; 9040 9041 $.fn.select2 = function (options) { 9042 options = options || {}; 9043 9044 if (typeof options === 'object') { 9045 this.each(function () { 9046 var instanceOptions = $.extend(true, {}, options); 9047 9048 var instance = new Select2($(this), instanceOptions); 9049 }); 9050 9051 return this; 9052 } else if (typeof options === 'string') { 9053 var ret; 9054 var args = Array.prototype.slice.call(arguments, 1); 9055 9056 this.each(function () { 9057 var instance = Utils.GetData(this, 'select2'); 9058 9059 if (instance == null && window.console && console.error) { 9060 console.error( 9061 'The select2(\'' + options + '\') method was called on an ' + 9062 'element that is not using Select2.' 9063 ); 9064 } 9065 9066 ret = instance[options].apply(instance, args); 9067 }); 9068 9069 // Check if we should be returning `this` 9070 if ($.inArray(options, thisMethods) > -1) { 9071 return this; 9072 } 9073 9074 return ret; 9075 } else { 9076 throw new Error('Invalid arguments for Select2: ' + options); 9077 } 9078 }; 9079 } 9080 9081 if ($.fn.select2.defaults == null) { 9082 $.fn.select2.defaults = Defaults; 9083 } 9084 9085 return Select2; 9086}); 9087 9088 // Return the AMD loader configuration so it can be used outside of this file 9089 return { 9090 define: S2.define, 9091 require: S2.require 9092 }; 9093}()); 9094 9095 // Autoload the jQuery bindings 9096 // We know that all of the modules exist above this, so we're safe 9097 var select2 = S2.require('jquery.select2'); 9098 9099 // Hold the AMD module references on the jQuery function that was just loaded 9100 // This allows Select2 to use the internal loader outside of this file, such 9101 // as in the language files. 9102 jQuery.fn.select2.amd = S2; 9103 9104 // Return the Select2 instance for anyone who is importing it. 9105 return select2; 9106})); 9107; 9108/* flatpickr v4.6.3, @license MIT */ 9109(function (global, factory) { 9110 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 9111 typeof define === 'function' && define.amd ? define(factory) : 9112 (global = global || self, global.flatpickr = factory()); 9113}(this, function () { 'use strict'; 9114 9115 /*! ***************************************************************************** 9116 Copyright (c) Microsoft Corporation. All rights reserved. 9117 Licensed under the Apache License, Version 2.0 (the "License");
9117 you may not use 9118 this file except in compliance with the License. You may obtain a copy of the 9119 License at http://www.apache.org/licenses/LICENSE-2.0 9120 9121 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 9122 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 9123 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 9124 MERCHANTABLITY OR NON-INFRINGEMENT. 9125 9126 See the Apache Version 2.0 License for specific language governing permissions 9127 and limitations under the License. 9128 ***************************************************************************** */ 9129 9130 var __assign = function() { 9131 __assign = Object.assign || function __assign(t) { 9132 for (var s, i = 1, n = arguments.length; i < n; i++) { 9133 s = arguments[i]; 9134 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 9135 } 9136 return t; 9137 }; 9138 return __assign.apply(this, arguments); 9139 }; 9140 9141 var HOOKS = [ 9142 "onChange", 9143 "onClose", 9144 "onDayCreate", 9145 "onDestroy", 9146 "onKeyDown", 9147 "onMonthChange", 9148 "onOpen", 9149 "onParseConfig", 9150 "onReady", 9151 "onValueUpdate", 9152 "onYearChange", 9153 "onPreCalendarPosition", 9154 ]; 9155 var defaults = { 9156 _disable: [], 9157 _enable: [], 9158 allowInput: false, 9159 altFormat: "F j, Y", 9160 altInput: false, 9161 altInputClass: "form-control input", 9162 animate: typeof window === "object" && 9163 window.navigator.userAgent.indexOf("MSIE") === -1, 9164 ariaDateFormat: "F j, Y", 9165 clickOpens: true, 9166 closeOnSelect: true, 9167 conjunction: ", ", 9168 dateFormat: "Y-m-d", 9169 defaultHour: 12, 9170 defaultMinute: 0, 9171 defaultSeconds: 0, 9172 disable: [], 9173 disableMobile: false, 9174 enable: [], 9175 enableSeconds: false, 9176 enableTime: false, 9177 errorHandler: function (err) { 9178 return typeof console !== "undefined" && console.warn(err); 9179 }, 9180 getWeek: function (givenDate) { 9181 var date = new Date(givenDate.getTime()); 9182 date.setHours(0, 0, 0, 0); 9183 // Thursday in current week decides the year. 9184 date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7)); 9185 // January 4 is always in week 1. 9186 var week1 = new Date(date.getFullYear(), 0, 4); 9187 // Adjust to Thursday in week 1 and count number of weeks from date to week1. 9188 return (1 + 9189 Math.round(((date.getTime() - week1.getTime()) / 86400000 - 9190 3 + 9191 ((week1.getDay() + 6) % 7)) / 9192 7)); 9193 }, 9194 hourIncrement: 1, 9195 ignoredFocusElements: [], 9196 inline: false, 9197 locale: "default", 9198 minuteIncrement: 5, 9199 mode: "single", 9200 monthSelectorType: "dropdown", 9201 nextArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>", 9202 noCalendar: false, 9203 now: new Date(), 9204 onChange: [], 9205 onClose: [], 9206 onDayCreate: [], 9207 onDestroy: [], 9208 onKeyDown: [], 9209 onMonthChange: [], 9210 onOpen: [], 9211 onParseConfig: [], 9212 onReady: [], 9213 onValueUpdate: [], 9214 onYearChange: [], 9215 onPreCalendarPosition: [], 9216 plugins: [], 9217 position: "auto", 9218 positionElement: undefined, 9219 prevArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>", 9220 shorthandCurrentMonth: false, 9221 showMonths: 1, 9222 static: false, 9223 time_24hr: false, 9224 weekNumbers: false, 9225 wrap: false 9226 }; 9227 9228 var english = { 9229 weekdays: { 9230 shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 9231 longhand: [ 9232 "Sunday", 9233 "Monday", 9234 "Tuesday", 9235 "Wednesday", 9236 "Thursday", 9237 "Friday", 9238 "Saturday", 9239 ] 9240 }, 9241 months: { 9242 shorthand: [ 9243 "Jan", 9244 "Feb", 9245 "Mar", 9246 "Apr", 9247 "May", 9248 "Jun", 9249 "Jul", 9250 "Aug", 9251 "Sep", 9252 "Oct", 9253 "Nov", 9254 "Dec", 9255 ], 9256 longhand: [ 9257 "January", 9258 "February", 9259 "March", 9260 "April", 9261 "May", 9262 "June", 9263 "July", 9264 "August", 9265 "September", 9266 "October", 9267 "November", 9268 "December", 9269 ] 9270 }, 9271 daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], 9272 firstDayOfWeek: 0, 9273 ordinal: function (nth) { 9274 var s = nth % 100; 9275 if (s > 3 && s < 21) 9276 return "th"; 9277 switch (s % 10) { 9278 case 1: 9279 return "st"; 9280 case 2: 9281 return "nd"; 9282 case 3: 9283 return "rd"; 9284 default: 9285 return "th"; 9286 } 9287 }, 9288 rangeSeparator: " to ", 9289 weekAbbreviation: "Wk", 9290 scrollTitle: "Scroll to increment", 9291 toggleTitle: "Click to toggle", 9292 amPM: ["AM", "PM"], 9293 yearAriaLabel: "Year", 9294 hourAriaLabel: "Hour", 9295 minuteAriaLabel: "Minute", 9296 time_24hr: false 9297 }; 9298 9299 var pad = function (number) { return ("0" + number).slice(-2); }; 9300 var int = function (bool) { return (bool === true ? 1 : 0); }; 9301 /* istanbul ignore next */ 9302 function debounce(func, wait, immediate) { 9303 if (immediate === void 0) { immediate = false; } 9304 var timeout; 9305 return function () { 9306 var context = this, args = arguments; 9307 timeout !== null && clearTimeout(timeout); 9308 timeout = window.setTimeout(function () { 9309 timeout = null; 9310 if (!immediate)
vendor: 8,428 bytes, lines 9311-9528
9311 func.apply(context, args); 9312 }, wait); 9313 if (immediate && !timeout) 9314 func.apply(context, args); 9315 }; 9316 } 9317 var arrayify = function (obj) { 9318 return obj instanceof Array ? obj : [obj]; 9319 }; 9320 9321 function toggleClass(elem, className, bool) { 9322 if (bool === true) 9323 return elem.classList.add(className); 9324 elem.classList.remove(className); 9325 } 9326 function createElement(tag, className, content) { 9327 var e = window.document.createElement(tag); 9328 className = className || ""; 9329 content = content || ""; 9330 e.className = className; 9331 if (content !== undefined) 9332 e.textContent = content; 9333 return e; 9334 } 9335 function clearNode(node) { 9336 while (node.firstChild) 9337 node.removeChild(node.firstChild); 9338 } 9339 function findParent(node, condition) { 9340 if (condition(node)) 9341 return node; 9342 else if (node.parentNode) 9343 return findParent(node.parentNode, condition); 9344 return undefined; // nothing found 9345 } 9346 function createNumberInput(inputClassName, opts) { 9347 var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown"); 9348 if (navigator.userAgent.indexOf("MSIE 9.0") === -1) { 9349 numInput.type = "number"; 9350 } 9351 else { 9352 numInput.type = "text"; 9353 numInput.pattern = "\\d*"; 9354 } 9355 if (opts !== undefined) 9356 for (var key in opts) 9357 numInput.setAttribute(key, opts[key]); 9358 wrapper.appendChild(numInput); 9359 wrapper.appendChild(arrowUp); 9360 wrapper.appendChild(arrowDown); 9361 return wrapper; 9362 } 9363 function getEventTarget(event) { 9364 if (typeof event.composedPath === "function") { 9365 var path = event.composedPath(); 9366 return path[0]; 9367 } 9368 return event.target; 9369 } 9370 9371 var doNothing = function () { return undefined; }; 9372 var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; }; 9373 var revFormat = { 9374 D: doNothing, 9375 F: function (dateObj, monthName, locale) { 9376 dateObj.setMonth(locale.months.longhand.indexOf(monthName)); 9377 }, 9378 G: function (dateObj, hour) { 9379 dateObj.setHours(parseFloat(hour)); 9380 }, 9381 H: function (dateObj, hour) { 9382 dateObj.setHours(parseFloat(hour)); 9383 }, 9384 J: function (dateObj, day) { 9385 dateObj.setDate(parseFloat(day)); 9386 }, 9387 K: function (dateObj, amPM, locale) { 9388 dateObj.setHours((dateObj.getHours() % 12) + 9389 12 * int(new RegExp(locale.amPM[1], "i").test(amPM))); 9390 }, 9391 M: function (dateObj, shortMonth, locale) { 9392 dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth)); 9393 }, 9394 S: function (dateObj, seconds) { 9395 dateObj.setSeconds(parseFloat(seconds)); 9396 }, 9397 U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); }, 9398 W: function (dateObj, weekNum, locale) { 9399 var weekNumber = parseInt(weekNum); 9400 var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0); 9401 date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek); 9402 return date; 9403 }, 9404 Y: function (dateObj, year) { 9405 dateObj.setFullYear(parseFloat(year)); 9406 }, 9407 Z: function (_, ISODate) { return new Date(ISODate); }, 9408 d: function (dateObj, day) { 9409 dateObj.setDate(parseFloat(day)); 9410 }, 9411 h: function (dateObj, hour) { 9412 dateObj.setHours(parseFloat(hour)); 9413 }, 9414 i: function (dateObj, minutes) { 9415 dateObj.setMinutes(parseFloat(minutes)); 9416 }, 9417 j: function (dateObj, day) { 9418 dateObj.setDate(parseFloat(day)); 9419 }, 9420 l: doNothing, 9421 m: function (dateObj, month) { 9422 dateObj.setMonth(parseFloat(month) - 1); 9423 }, 9424 n: function (dateObj, month) { 9425 dateObj.setMonth(parseFloat(month) - 1); 9426 }, 9427 s: function (dateObj, seconds) { 9428 dateObj.setSeconds(parseFloat(seconds)); 9429 }, 9430 u: function (_, unixMillSeconds) { 9431 return new Date(parseFloat(unixMillSeconds)); 9432 }, 9433 w: doNothing, 9434 y: function (dateObj, year) { 9435 dateObj.setFullYear(2000 + parseFloat(year)); 9436 } 9437 }; 9438 var tokenRegex = { 9439 D: "(\\w+)", 9440 F: "(\\w+)", 9441 G: "(\\d\\d|\\d)", 9442 H: "(\\d\\d|\\d)", 9443 J: "(\\d\\d|\\d)\\w+", 9444 K: "", 9445 M: "(\\w+)", 9446 S: "(\\d\\d|\\d)", 9447 U: "(.+)", 9448 W: "(\\d\\d|\\d)", 9449 Y: "(\\d{4})", 9450 Z: "(.+)", 9451 d: "(\\d\\d|\\d)", 9452 h: "(\\d\\d|\\d)", 9453 i: "(\\d\\d|\\d)", 9454 j: "(\\d\\d|\\d)", 9455 l: "(\\w+)", 9456 m: "(\\d\\d|\\d)", 9457 n: "(\\d\\d|\\d)", 9458 s: "(\\d\\d|\\d)", 9459 u: "(.+)", 9460 w: "(\\d\\d|\\d)", 9461 y: "(\\d{2})" 9462 }; 9463 var formats = { 9464 // get the date in UTC 9465 Z: function (date) { return date.toISOString(); }, 9466 // weekday name, short, e.g. Thu 9467 D: function (date, locale, options) { 9468 return locale.weekdays.shorthand[formats.w(date, locale, options)]; 9469 }, 9470 // full month name e.g. January 9471 F: function (date, locale, options) { 9472 return monthToStr(formats.n(date, locale, options) - 1, false, locale); 9473 }, 9474 // padded hour 1-12 9475 G: function (date, locale, options) { 9476 return pad(formats.h(date, locale, options)); 9477 }, 9478 // hours with leading zero e.g. 03 9479 H: function (date) { return pad(date.getHours()); }, 9480 // day (1-30) with ordinal suffix e.g. 1st, 2nd 9481 J: function (date, locale) { 9482 return locale.ordinal !== undefined 9483 ? date.getDate() + locale.ordinal(date.getDate()) 9484 : date.getDate(); 9485 }, 9486 // AM/PM 9487 K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; }, 9488 // shorthand month e.g. Jan, Sep, Oct, etc 9489 M: function (date, locale) { 9490 return monthToStr(date.getMonth(), true, locale); 9491 }, 9492 // seconds 00-59 9493 S: function (date) { return pad(date.getSeconds()); }, 9494 // unix timestamp 9495 U: function (date) { return date.getTime() / 1000; }, 9496 W: function (date, _, options) { 9497 return options.getWeek(date); 9498 }, 9499 // full year e.g. 2016 9500 Y: function (date) { return date.getFullYear(); }, 9501 // day in month, padded (01-30) 9502 d: function (date) { return pad(date.getDate()); }, 9503 // hour from 1-12 (am/pm) 9504 h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); }, 9505 // minutes, padded with leading zero e.g. 09 9506 i: function (date) { return pad(date.getMinutes()); }, 9507 // day in month (1-30) 9508 j: function (date) { return date.getDate(); }, 9509 // weekday name, full, e.g. Thursday 9510 l: function (date, locale) { 9511 return locale.weekdays.longhand[date.getDay()]; 9512 }, 9513 // padded month number (01-12) 9514 m: function (date) { return pad(date.getMonth() + 1); }, 9515 // the month number (1-12) 9516 n: function (date) { return date.getMonth() + 1; }, 9517 // seconds 0-59 9518 s: function (date) { return date.getSeconds(); }, 9519 // Unix Milliseconds 9520 u: function (date) { return date.getTime(); }, 9521 // number of the day of the week 9522 w: function (date) { return date.getDay(); }, 9523 // last two digits of year e.g. 16 for 2016 9524 y: function (date) { return String(date.getFullYear()).substring(2); } 9525 }; 9526 9527 var createDateFormatter = function (_a) { 9528 var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _
vendor: 34,214 bytes, lines 9528-10247
9528c; 9529 return function (dateObj, frmt, overrideLocale) { 9530 var locale = overrideLocale || l10n; 9531 if (config.formatDate !== undefined) { 9532 return config.formatDate(dateObj, frmt, locale); 9533 } 9534 return frmt 9535 .split("") 9536 .map(function (c, i, arr) { 9537 return formats[c] && arr[i - 1] !== "\\" 9538 ? formats[c](dateObj, locale, config) 9539 : c !== "\\" 9540 ? c 9541 : ""; 9542 }) 9543 .join(""); 9544 }; 9545 }; 9546 var createDateParser = function (_a) { 9547 var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c; 9548 return function (date, givenFormat, timeless, customLocale) { 9549 if (date !== 0 && !date) 9550 return undefined; 9551 var locale = customLocale || l10n; 9552 var parsedDate; 9553 var dateOrig = date; 9554 if (date instanceof Date) 9555 parsedDate = new Date(date.getTime()); 9556 else if (typeof date !== "string" && 9557 date.toFixed !== undefined // timestamp 9558 ) 9559 // create a copy 9560 parsedDate = new Date(date); 9561 else if (typeof date === "string") { 9562 // date string 9563 var format = givenFormat || (config || defaults).dateFormat; 9564 var datestr = String(date).trim(); 9565 if (datestr === "today") { 9566 parsedDate = new Date(); 9567 timeless = true; 9568 } 9569 else if (/Z$/.test(datestr) || 9570 /GMT$/.test(datestr) // datestrings w/ timezone 9571 ) 9572 parsedDate = new Date(date); 9573 else if (config && config.parseDate) 9574 parsedDate = config.parseDate(date, format); 9575 else { 9576 parsedDate = 9577 !config || !config.noCalendar 9578 ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) 9579 : new Date(new Date().setHours(0, 0, 0, 0)); 9580 var matched = void 0, ops = []; 9581 for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) { 9582 var token_1 = format[i]; 9583 var isBackSlash = token_1 === "\\"; 9584 var escaped = format[i - 1] === "\\" || isBackSlash; 9585 if (tokenRegex[token_1] && !escaped) { 9586 regexStr += tokenRegex[token_1]; 9587 var match = new RegExp(regexStr).exec(date); 9588 if (match && (matched = true)) { 9589 ops[token_1 !== "Y" ? "push" : "unshift"]({ 9590 fn: revFormat[token_1], 9591 val: match[++matchIndex] 9592 }); 9593 } 9594 } 9595 else if (!isBackSlash) 9596 regexStr += "."; // don't really care 9597 ops.forEach(function (_a) { 9598 var fn = _a.fn, val = _a.val; 9599 return (parsedDate = fn(parsedDate, val, locale) || parsedDate); 9600 }); 9601 } 9602 parsedDate = matched ? parsedDate : undefined; 9603 } 9604 } 9605 /* istanbul ignore next */ 9606 if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) { 9607 config.errorHandler(new Error("Invalid date provided: " + dateOrig)); 9608 return undefined; 9609 } 9610 if (timeless === true) 9611 parsedDate.setHours(0, 0, 0, 0); 9612 return parsedDate; 9613 }; 9614 }; 9615 /** 9616 * Compute the difference in dates, measured in ms 9617 */ 9618 function compareDates(date1, date2, timeless) { 9619 if (timeless === void 0) { timeless = true; } 9620 if (timeless !== false) { 9621 return (new Date(date1.getTime()).setHours(0, 0, 0, 0) - 9622 new Date(date2.getTime()).setHours(0, 0, 0, 0)); 9623 } 9624 return date1.getTime() - date2.getTime(); 9625 } 9626 var isBetween = function (ts, ts1, ts2) { 9627 return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2); 9628 }; 9629 var duration = { 9630 DAY: 86400000 9631 }; 9632 9633 if (typeof Object.assign !== "function") { 9634 Object.assign = function (target) { 9635 var args = []; 9636 for (var _i = 1; _i < arguments.length; _i++) { 9637 args[_i - 1] = arguments[_i]; 9638 } 9639 if (!target) { 9640 throw TypeError("Cannot convert undefined or null to object"); 9641 } 9642 var _loop_1 = function (source) { 9643 if (source) { 9644 Object.keys(source).forEach(function (key) { return (target[key] = source[key]); }); 9645 } 9646 }; 9647 for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { 9648 var source = args_1[_a]; 9649 _loop_1(source); 9650 } 9651 return target; 9652 }; 9653 } 9654 9655 var DEBOUNCED_CHANGE_MS = 300; 9656 function FlatpickrInstance(element, instanceConfig) { 9657 var self = { 9658 config: __assign({}, defaults, flatpickr.defaultConfig), 9659 l10n: english 9660 }; 9661 self.parseDate = createDateParser({ config: self.config, l10n: self.l10n }); 9662 self._handlers = []; 9663 self.pluginElements = []; 9664 self.loadedPlugins = []; 9665 self._bind = bind; 9666 self._setHoursFromDate = setHoursFromDate; 9667 self._positionCalendar = positionCalendar; 9668 self.changeMonth = changeMonth; 9669 self.changeYear = changeYear; 9670 self.clear = clear; 9671 self.close = close; 9672 self._createElement = createElement; 9673 self.destroy = destroy; 9674 self.isEnabled = isEnabled; 9675 self.jumpToDate = jumpToDate; 9676 self.open = open; 9677 self.redraw = redraw; 9678 self.set = set; 9679 self.setDate = setDate; 9680 self.toggle = toggle; 9681 function setupHelperFunctions() { 9682 self.utils = { 9683 getDaysInMonth: function (month, yr) { 9684 if (month === void 0) { month = self.currentMonth; } 9685 if (yr === void 0) { yr = self.currentYear; } 9686 if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0)) 9687 return 29; 9688 return self.l10n.daysInMonth[month]; 9689 } 9690 }; 9691 } 9692 function init() { 9693 self.element = self.input = element; 9694 self.isOpen = false; 9695 parseConfig(); 9696 setupLocale(); 9697 setupInputs(); 9698 setupDates(); 9699 setupHelperFunctions(); 9700 if (!self.isMobile) 9701 build(); 9702 bindEvents(); 9703 if (self.selectedDates.length || self.config.noCalendar) { 9704 if (self.config.enableTime) { 9705 setHoursFromDate(self.config.noCalendar 9706 ? self.latestSelectedDateObj || self.config.minDate 9707 : undefined); 9708 } 9709 updateValue(false); 9710 } 9711 setCalendarWidth(); 9712 self.showTimeInput = 9713 self.selectedDates.length > 0 || self.config.noCalendar; 9714 var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 9715 /* TODO: investigate this further 9716 9717 Currently, there is weird positioning behavior in safari causing pages 9718 to scroll up. https://github.com/chmln/flatpickr/issues/563 9719 9720 However, most browsers are not Safari and positioning is expensive when used 9721 in scale. https://github.com/chmln/flatpickr/issues/1096 9722 */ 9723 if (!self.isMobile && isSafari) { 9724 positionCalendar(); 9725 } 9726 triggerEvent("onReady"); 9727 } 9728 function bindToInstance(fn) { 9729 return fn.bind(self); 9730 } 9731 function setCalendarWidth() { 9732 var config = self.config; 9733 if (config.weekNumbers === false && config.showMonths === 1) 9734 return; 9735 else if (config.noCalendar !== true) { 9736 window.requestAnimationFrame(function () { 9737 if (self.calendarContainer !== undefined) { 9738 self.calendarContainer.style.visibility = "hidden"; 9739 self.calendarContainer.style.display = "block"; 9740 } 9741 if (self.daysContainer !== undefined) { 9742 var daysWidth = (self.days.offsetWidth + 1) * config.showMonths; 9743 self.daysContainer.style.width = daysWidth + "px"; 9744 self.calendarContainer.style.width = 9745 daysWidth + 9746 (self.weekWrapper !== undefined 9747 ? self.weekWrapper.offsetWidth 9748 : 0) + 9749 "px"; 9750 self.calendarContainer.style.removeProperty("visibility"); 9751 self.calendarContainer.style.removeProperty("display"); 9752 } 9753 }); 9754 } 9755 } 9756 /** 9757 * The handler for all events targeting the time inputs 9758 */ 9759 function updateTime(e) { 9760 if (self.selectedDates.length === 0) { 9761 setDefaultTime(); 9762 } 9763 if (e !== undefined && e.type !== "blur") { 9764 timeWrapper(e); 9765 } 9766 var prevValue = self._input.value; 9767 setHoursFromInputs(); 9768 updateValue(); 9769 if (self._input.value !== prevValue) { 9770 self._debouncedChange(); 9771 } 9772 } 9773 function ampm2military(hour, amPM) { 9774 return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]); 9775 } 9776 function military2ampm(hour) { 9777 switch (hour % 24) { 9778 case 0: 9779 case 12: 9780 return 12; 9781 default: 9782 return hour % 12; 9783 } 9784 } 9785 /** 9786 * Syncs the selected date object time with user's time input 9787 */ 9788 function setHoursFromInputs() { 9789 if (self.hourElement === undefined || self.minuteElement === undefined) 9790 return; 9791 var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined 9792 ? (parseInt(self.secondElement.value, 10) || 0) % 60 9793 : 0; 9794 if (self.amPM !== undefined) { 9795 hours = ampm2military(hours, self.amPM.textContent); 9796 } 9797 var limitMinHours = self.config.minTime !== undefined || 9798 (self.config.minDate && 9799 self.minDateHasTime && 9800 self.latestSelectedDateObj && 9801 compareDates(self.latestSelectedDateObj, self.config.minDate, true) === 9802 0); 9803 var limitMaxHours = self.config.maxTime !== undefined || 9804 (self.config.maxDate && 9805 self.maxDateHasTime && 9806 self.latestSelectedDateObj && 9807 compareDates(self.latestSelectedDateObj, self.config.maxDate, true) === 9808 0); 9809 if (limitMaxHours) { 9810 var maxTime = self.config.maxTime !== undefined 9811 ? self.config.maxTime 9812 : self.config.maxDate; 9813 hours = Math.min(hours, maxTime.getHours()); 9814 if (hours === maxTime.getHours()) 9815 minutes = Math.min(minutes, maxTime.getMinutes()); 9816 if (minutes === maxTime.getMinutes()) 9817 seconds = Math.min(seconds, maxTime.getSeconds()); 9818 } 9819 if (limitMinHours) { 9820 var minTime = self.config.minTime !== undefined 9821 ? self.config.minTime 9822 : self.config.minDate; 9823 hours = Math.max(hours, minTime.getHours()); 9824 if (hours === minTime.getHours()) 9825 minutes = Math.max(minutes, minTime.getMinutes()); 9826 if (minutes === minTime.getMinutes()) 9827 seconds = Math.max(seconds, minTime.getSeconds()); 9828 } 9829 setHours(hours, minutes, seconds); 9830 } 9831 /** 9832 * Syncs time input values with a date 9833 */ 9834 function setHoursFromDate(dateObj) { 9835 var date = dateObj || self.latestSelectedDateObj; 9836 if (date) 9837 setHours(date.getHours(), date.getMinutes(), date.getSeconds()); 9838 } 9839 function setDefaultHours() { 9840 var hours = self.config.defaultHour; 9841 var minutes = self.config.defaultMinute; 9842 var seconds = self.config.defaultSeconds; 9843 if (self.config.minDate !== undefined) { 9844 var minHr = self.config.minDate.getHours(); 9845 var minMinutes = self.config.minDate.getMinutes(); 9846 hours = Math.max(hours, minHr); 9847 if (hours === minHr) 9848 minutes = Math.max(minMinutes, minutes); 9849 if (hours === minHr && minutes === minMinutes) 9850 seconds = self.config.minDate.getSeconds(); 9851 } 9852 if (self.config.maxDate !== undefined) { 9853 var maxHr = self.config.maxDate.getHours(); 9854 var maxMinutes = self.config.maxDate.getMinutes(); 9855 hours = Math.min(hours, maxHr); 9856 if (hours === maxHr) 9857 minutes = Math.min(maxMinutes, minutes); 9858 if (hours === maxHr && minutes === maxMinutes) 9859 seconds = self.config.maxDate.getSeconds(); 9860 } 9861 setHours(hours, minutes, seconds); 9862 } 9863 /** 9864 * Sets the hours, minutes, and optionally seconds 9865 * of the latest selected date object and the 9866 * corresponding time inputs 9867 * @param {Number} hours the hour. whether its military 9868 * or am-pm gets inferred from config 9869 * @param {Number} minutes the minutes 9870 * @param {Number} seconds the seconds (optional) 9871 */ 9872 function setHours(hours, minutes, seconds) { 9873 if (self.latestSelectedDateObj !== undefined) { 9874 self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0); 9875 } 9876 if (!self.hourElement || !self.minuteElement || self.isMobile) 9877 return; 9878 self.hourElement.value = pad(!self.config.time_24hr 9879 ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0) 9880 : hours); 9881 self.minuteElement.value = pad(minutes); 9882 if (self.amPM !== undefined) 9883 self.amPM.textContent = self.l10n.amPM[int(hours >= 12)]; 9884 if (self.secondElement !== undefined) 9885 self.secondElement.value = pad(seconds); 9886 } 9887 /** 9888 * Handles the year input and incrementing events 9889 * @param {Event} event the keyup or increment event 9890 */ 9891 function onYearInput(event) { 9892 var year = parseInt(event.target.value) + (event.delta || 0); 9893 if (year / 1000 > 1 || 9894 (event.key === "Enter" && !/[^\d]/.test(year.toString()))) { 9895 changeYear(year); 9896 } 9897 } 9898 /** 9899 * Essentially addEventListener + tracking 9900 * @param {Element} element the element to addEventListener to 9901 * @param {String} event the event name 9902 * @param {Function} handler the event handler 9903 */ 9904 function bind(element, event, handler, options) { 9905 if (event instanceof Array) 9906 return event.forEach(function (ev) { return bind(element, ev, handler, options); }); 9907 if (element instanceof Array) 9908 return element.forEach(function (el) { return bind(el, event, handler, options); }); 9909 element.addEventListener(event, handler, options); 9910 self._handlers.push({ 9911 element: element, 9912 event: event, 9913 handler: handler, 9914 options: options 9915 }); 9916 } 9917 /** 9918 * A mousedown handler which mimics click. 9919 * Minimizes latency, since we don't need to wait for mouseup in most cases. 9920 * Also, avoids handling right clicks. 9921 * 9922 * @param {Function} handler the event handler 9923 */ 9924 function onClick(handler) { 9925 return function (evt) { 9926 evt.which === 1 && handler(evt); 9927 }; 9928 } 9929 function triggerChange() { 9930 triggerEvent("onChange"); 9931 } 9932 /** 9933 * Adds all the necessary event listeners 9934 */ 9935 function bindEvents() { 9936 if (self.config.wrap) { 9937 ["open", "close", "toggle", "clear"].forEach(function (evt) { 9938 Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function (el) { 9939 return bind(el, "click", self[evt]); 9940 }); 9941 }); 9942 } 9943 if (self.isMobile) { 9944 setupMobile(); 9945 return; 9946 } 9947 var debouncedResize = debounce(onResize, 50); 9948 self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS); 9949 if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent)) 9950 bind(self.daysContainer, "mouseover", function (e) { 9951 if (self.config.mode === "range") 9952 onMouseOver(e.target); 9953 }); 9954 bind(window.document.body, "keydown", onKeyDown); 9955 if (!self.config.inline && !self.config.static) 9956 bind(window, "resize", debouncedResize); 9957 if (window.ontouchstart !== undefined) 9958 bind(window.document, "touchstart", documentClick); 9959 else 9960 bind(window.document, "mousedown", onClick(documentClick)); 9961 bind(window.document, "focus", documentClick, { capture: true }); 9962 if (self.config.clickOpens === true) { 9963 bind(self._input, "focus", self.open); 9964 bind(self._input, "mousedown", onClick(self.open)); 9965 } 9966 if (self.daysContainer !== undefined) { 9967 bind(self.monthNav, "mousedown", onClick(onMonthNavClick)); 9968 bind(self.monthNav, ["keyup", "increment"], onYearInput); 9969 bind(self.daysContainer, "mousedown", onClick(selectDate)); 9970 } 9971 if (self.timeContainer !== undefined && 9972 self.minuteElement !== undefined && 9973 self.hourElement !== undefined) { 9974 var selText = function (e) { 9975 return e.target.select(); 9976 }; 9977 bind(self.timeContainer, ["increment"], updateTime); 9978 bind(self.timeContainer, "blur", updateTime, { capture: true }); 9979 bind(self.timeContainer, "mousedown", onClick(timeIncrement)); 9980 bind([self.hourElement, self.minuteElement], ["focus", "click"], selText); 9981 if (self.secondElement !== undefined) 9982 bind(self.secondElement, "focus", function () { return self.secondElement && self.secondElement.select(); }); 9983 if (self.amPM !== undefined) { 9984 bind(self.amPM, "mousedown", onClick(function (e) { 9985 updateTime(e); 9986 triggerChange(); 9987 })); 9988 } 9989 } 9990 } 9991 /** 9992 * Set the calendar view to a particular date. 9993 * @param {Date} jumpDate the date to set the view to 9994 * @param {boolean} triggerChange if change events should be triggered 9995 */ 9996 function jumpToDate(jumpDate, triggerChange) { 9997 var jumpTo = jumpDate !== undefined 9998 ? self.parseDate(jumpDate) 9999 : self.latestSelectedDateObj || 10000 (self.config.minDate && self.config.minDate > self.now 10001 ? self.config.minDate 10002 : self.config.maxDate && self.config.maxDate < self.now 10003 ? self.config.maxDate 10004 : self.now); 10005 var oldYear = self.currentYear; 10006 var oldMonth = self.currentMonth; 10007 try { 10008 if (jumpTo !== undefined) { 10009 self.currentYear = jumpTo.getFullYear(); 10010 self.currentMonth = jumpTo.getMonth(); 10011 } 10012 } 10013 catch (e) { 10014 /* istanbul ignore next */ 10015 e.message = "Invalid date supplied: " + jumpTo; 10016 self.config.errorHandler(e); 10017 } 10018 if (triggerChange && self.currentYear !== oldYear) { 10019 triggerEvent("onYearChange"); 10020 buildMonthSwitch(); 10021 } 10022 if (triggerChange && 10023 (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) { 10024 triggerEvent("onMonthChange"); 10025 } 10026 self.redraw(); 10027 } 10028 /** 10029 * The up/down arrow handler for time inputs 10030 * @param {Event} e the click event 10031 */ 10032 function timeIncrement(e) { 10033 if (~e.target.className.indexOf("arrow")) 10034 incrementNumInput(e, e.target.classList.contains("arrowUp") ? 1 : -1); 10035 } 10036 /** 10037 * Increments/decrements the value of input associ- 10038 * ated with the up/down arrow by dispatching an 10039 * "increment" event on the input. 10040 * 10041 * @param {Event} e the click event 10042 * @param {Number} delta the diff (usually 1 or -1) 10043 * @param {Element} inputElem the input element 10044 */ 10045 function incrementNumInput(e, delta, inputElem) { 10046 var target = e && e.target; 10047 var input = inputElem || 10048 (target && target.parentNode && target.parentNode.firstChild); 10049 var event = createEvent("increment"); 10050 event.delta = delta; 10051 input && input.dispatchEvent(event); 10052 } 10053 function build() { 10054 var fragment = window.document.createDocumentFragment(); 10055 self.calendarContainer = createElement("div", "flatpickr-calendar"); 10056 self.calendarContainer.tabIndex = -1; 10057 if (!self.config.noCalendar) { 10058 fragment.appendChild(buildMonthNav()); 10059 self.innerContainer = createElement("div", "flatpickr-innerContainer"); 10060 if (self.config.weekNumbers) { 10061 var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers; 10062 self.innerContainer.appendChild(weekWrapper); 10063 self.weekNumbers = weekNumbers; 10064 self.weekWrapper = weekWrapper; 10065 } 10066 self.rContainer = createElement("div", "flatpickr-rContainer"); 10067 self.rContainer.appendChild(buildWeekdays()); 10068 if (!self.daysContainer) { 10069 self.daysContainer = createElement("div", "flatpickr-days"); 10070 self.daysContainer.tabIndex = -1; 10071 } 10072 buildDays(); 10073 self.rContainer.appendChild(self.daysContainer); 10074 self.innerContainer.appendChild(self.rContainer); 10075 fragment.appendChild(self.innerContainer); 10076 } 10077 if (self.config.enableTime) { 10078 fragment.appendChild(buildTime()); 10079 } 10080 toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range"); 10081 toggleClass(self.calendarContainer, "animate", self.config.animate === true); 10082 toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1); 10083 self.calendarContainer.appendChild(fragment); 10084 var customAppend = self.config.appendTo !== undefined && 10085 self.config.appendTo.nodeType !== undefined; 10086 if (self.config.inline || self.config.static) { 10087 self.calendarContainer.classList.add(self.config.inline ? "inline" : "static"); 10088 if (self.config.inline) { 10089 if (!customAppend && self.element.parentNode) 10090 self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling); 10091 else if (self.config.appendTo !== undefined) 10092 self.config.appendTo.appendChild(self.calendarContainer); 10093 } 10094 if (self.config.static) { 10095 var wrapper = createElement("div", "flatpickr-wrapper"); 10096 if (self.element.parentNode) 10097 self.element.parentNode.insertBefore(wrapper, self.element); 10098 wrapper.appendChild(self.element); 10099 if (self.altInput) 10100 wrapper.appendChild(self.altInput); 10101 wrapper.appendChild(self.calendarContainer); 10102 } 10103 } 10104 if (!self.config.static && !self.config.inline) 10105 (self.config.appendTo !== undefined 10106 ? self.config.appendTo 10107 : window.document.body).appendChild(self.calendarContainer); 10108 } 10109 function createDay(className, date, dayNumber, i) { 10110 var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", "flatpickr-day " + className, date.getDate().toString()); 10111 dayElement.dateObj = date; 10112 dayElement.$i = i; 10113 dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat)); 10114 if (className.indexOf("hidden") === -1 && 10115 compareDates(date, self.now) === 0) { 10116 self.todayDateElem = dayElement; 10117 dayElement.classList.add("today"); 10118 dayElement.setAttribute("aria-current", "date"); 10119 } 10120 if (dateIsEnabled) { 10121 dayElement.tabIndex = -1; 10122 if (isDateSelected(date)) { 10123 dayElement.classList.add("selected"); 10124 self.selectedDateElem = dayElement; 10125 if (self.config.mode === "range") { 10126 toggleClass(dayElement, "startRange", self.selectedDates[0] && 10127 compareDates(date, self.selectedDates[0], true) === 0); 10128 toggleClass(dayElement, "endRange", self.selectedDates[1] && 10129 compareDates(date, self.selectedDates[1], true) === 0); 10130 if (className === "nextMonthDay") 10131 dayElement.classList.add("inRange"); 10132 } 10133 } 10134 } 10135 else { 10136 dayElement.classList.add("flatpickr-disabled"); 10137 } 10138 if (self.config.mode === "range") { 10139 if (isDateInRange(date) && !isDateSelected(date)) 10140 dayElement.classList.add("inRange"); 10141 } 10142 if (self.weekNumbers && 10143 self.config.showMonths === 1 && 10144 className !== "prevMonthDay" && 10145 dayNumber % 7 === 1) { 10146 self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + self.config.getWeek(date) + "</span>"); 10147 } 10148 triggerEvent("onDayCreate", dayElement); 10149 return dayElement; 10150 } 10151 function focusOnDayElem(targetNode) { 10152 targetNode.focus(); 10153 if (self.config.mode === "range") 10154 onMouseOver(targetNode); 10155 } 10156 function getFirstAvailableDay(delta) { 10157 var startMonth = delta > 0 ? 0 : self.config.showMonths - 1; 10158 var endMonth = delta > 0 ? self.config.showMonths : -1; 10159 for (var m = startMonth; m != endMonth; m += delta) { 10160 var month = self.daysContainer.children[m]; 10161 var startIndex = delta > 0 ? 0 : month.children.length - 1; 10162 var endIndex = delta > 0 ? month.children.length : -1; 10163 for (var i = startIndex; i != endIndex; i += delta) { 10164 var c = month.children[i]; 10165 if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj)) 10166 return c; 10167 } 10168 } 10169 return undefined; 10170 } 10171 function getNextAvailableDay(current, delta) { 10172 var givenMonth = current.className.indexOf("Month") === -1 10173 ? current.dateObj.getMonth() 10174 : self.currentMonth; 10175 var endMonth = delta > 0 ? self.config.showMonths : -1; 10176 var loopDelta = delta > 0 ? 1 : -1; 10177 for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) { 10178 var month = self.daysContainer.children[m]; 10179 var startIndex = givenMonth - self.currentMonth === m 10180 ? current.$i + delta 10181 : delta < 0 10182 ? month.children.length - 1 10183 : 0; 10184 var numMonthDays = month.children.length; 10185 for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) { 10186 var c = month.children[i]; 10187 if (c.className.indexOf("hidden") === -1 && 10188 isEnabled(c.dateObj) && 10189 Math.abs(current.$i - i) >= Math.abs(delta)) 10190 return focusOnDayElem(c); 10191 } 10192 } 10193 self.changeMonth(loopDelta); 10194 focusOnDay(getFirstAvailableDay(loopDelta), 0); 10195 return undefined; 10196 } 10197 function focusOnDay(current, offset) { 10198 var dayFocused = isInView(document.activeElement || document.body); 10199 var startElem = current !== undefined 10200 ? current 10201 : dayFocused 10202 ? document.activeElement 10203 : self.selectedDateElem !== undefined && isInView(self.selectedDateElem) 10204 ? self.selectedDateElem 10205 : self.todayDateElem !== undefined && isInView(self.todayDateElem) 10206 ? self.todayDateElem 10207 : getFirstAvailableDay(offset > 0 ? 1 : -1); 10208 if (startElem === undefined) 10209 return self._input.focus(); 10210 if (!dayFocused) 10211 return focusOnDayElem(startElem); 10212 getNextAvailableDay(startElem, offset); 10213 } 10214 function buildMonthDays(year, month) { 10215 var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7; 10216 var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12); 10217 var daysInMonth = self.utils.getDaysInMonth(month), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay"; 10218 var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0; 10219 // prepend days from the ending of previous month 10220 for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) { 10221 days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex)); 10222 } 10223 // Start at 1 since there is no 0th day 10224 for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) { 10225 days.appendChild(createDay("", new Date(year, month, dayNumber), dayNumber, dayIndex)); 10226 } 10227 // append days from the next month 10228 for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth && 10229 (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) { 10230 days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex)); 10231 } 10232 //updateNavigationCurrentMonth(); 10233 var dayContainer = createElement("div", "dayContainer"); 10234 dayContainer.appendChild(days); 10235 return dayContainer; 10236 } 10237 function buildDays() { 10238 if (self.daysContainer === undefined) { 10239 return; 10240 } 10241 clearNode(self.daysContainer); 10242 // TODO: week numbers for each month 10243 if (self.weekNumbers) 10244 clearNode(self.weekNumbers); 10245 var frag = document.createDocumentFragment(); 10246 for (var i = 0; i < self.config.showMonths; i++) { 10247 var d = new Date(self.currentYear, self.currentMonth, 1);
vendor: 15,991 bytes, lines 10248-10567
10248 d.setMonth(self.currentMonth + i); 10249 frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth())); 10250 } 10251 self.daysContainer.appendChild(frag); 10252 self.days = self.daysContainer.firstChild; 10253 if (self.config.mode === "range" && self.selectedDates.length === 1) { 10254 onMouseOver(); 10255 } 10256 } 10257 function buildMonthSwitch() { 10258 if (self.config.showMonths > 1 || 10259 self.config.monthSelectorType !== "dropdown") 10260 return; 10261 var shouldBuildMonth = function (month) { 10262 if (self.config.minDate !== undefined && 10263 self.currentYear === self.config.minDate.getFullYear() && 10264 month < self.config.minDate.getMonth()) { 10265 return false; 10266 } 10267 return !(self.config.maxDate !== undefined && 10268 self.currentYear === self.config.maxDate.getFullYear() && 10269 month > self.config.maxDate.getMonth()); 10270 }; 10271 self.monthsDropdownContainer.tabIndex = -1; 10272 self.monthsDropdownContainer.innerHTML = ""; 10273 for (var i = 0; i < 12; i++) { 10274 if (!shouldBuildMonth(i)) 10275 continue; 10276 var month = createElement("option", "flatpickr-monthDropdown-month"); 10277 month.value = new Date(self.currentYear, i).getMonth().toString(); 10278 month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n); 10279 month.tabIndex = -1; 10280 if (self.currentMonth === i) { 10281 month.selected = true; 10282 } 10283 self.monthsDropdownContainer.appendChild(month); 10284 } 10285 } 10286 function buildMonth() { 10287 var container = createElement("div", "flatpickr-month"); 10288 var monthNavFragment = window.document.createDocumentFragment(); 10289 var monthElement; 10290 if (self.config.showMonths > 1 || 10291 self.config.monthSelectorType === "static") { 10292 monthElement = createElement("span", "cur-month"); 10293 } 10294 else { 10295 self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months"); 10296 bind(self.monthsDropdownContainer, "change", function (e) { 10297 var target = e.target; 10298 var selectedMonth = parseInt(target.value, 10); 10299 self.changeMonth(selectedMonth - self.currentMonth); 10300 triggerEvent("onMonthChange"); 10301 }); 10302 buildMonthSwitch(); 10303 monthElement = self.monthsDropdownContainer; 10304 } 10305 var yearInput = createNumberInput("cur-year", { tabindex: "-1" }); 10306 var yearElement = yearInput.getElementsByTagName("input")[0]; 10307 yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel); 10308 if (self.config.minDate) { 10309 yearElement.setAttribute("min", self.config.minDate.getFullYear().toString()); 10310 } 10311 if (self.config.maxDate) { 10312 yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString()); 10313 yearElement.disabled = 10314 !!self.config.minDate && 10315 self.config.minDate.getFullYear() === self.config.maxDate.getFullYear(); 10316 } 10317 var currentMonth = createElement("div", "flatpickr-current-month"); 10318 currentMonth.appendChild(monthElement); 10319 currentMonth.appendChild(yearInput); 10320 monthNavFragment.appendChild(currentMonth); 10321 container.appendChild(monthNavFragment); 10322 return { 10323 container: container, 10324 yearElement: yearElement, 10325 monthElement: monthElement 10326 }; 10327 } 10328 function buildMonths() { 10329 clearNode(self.monthNav); 10330 self.monthNav.appendChild(self.prevMonthNav); 10331 if (self.config.showMonths) { 10332 self.yearElements = []; 10333 self.monthElements = []; 10334 } 10335 for (var m = self.config.showMonths; m--;) { 10336 var month = buildMonth(); 10337 self.yearElements.push(month.yearElement); 10338 self.monthElements.push(month.monthElement); 10339 self.monthNav.appendChild(month.container); 10340 } 10341 self.monthNav.appendChild(self.nextMonthNav); 10342 } 10343 function buildMonthNav() { 10344 self.monthNav = createElement("div", "flatpickr-months"); 10345 self.yearElements = []; 10346 self.monthElements = []; 10347 self.prevMonthNav = createElement("span", "flatpickr-prev-month"); 10348 self.prevMonthNav.innerHTML = self.config.prevArrow; 10349 self.nextMonthNav = createElement("span", "flatpickr-next-month"); 10350 self.nextMonthNav.innerHTML = self.config.nextArrow; 10351 buildMonths(); 10352 Object.defineProperty(self, "_hidePrevMonthArrow", { 10353 get: function () { return self.__hidePrevMonthArrow; }, 10354 set: function (bool) { 10355 if (self.__hidePrevMonthArrow !== bool) { 10356 toggleClass(self.prevMonthNav, "flatpickr-disabled", bool); 10357 self.__hidePrevMonthArrow = bool; 10358 } 10359 } 10360 }); 10361 Object.defineProperty(self, "_hideNextMonthArrow", { 10362 get: function () { return self.__hideNextMonthArrow; }, 10363 set: function (bool) { 10364 if (self.__hideNextMonthArrow !== bool) { 10365 toggleClass(self.nextMonthNav, "flatpickr-disabled", bool); 10366 self.__hideNextMonthArrow = bool; 10367 } 10368 } 10369 }); 10370 self.currentYearElement = self.yearElements[0]; 10371 updateNavigationCurrentMonth(); 10372 return self.monthNav; 10373 } 10374 function buildTime() { 10375 self.calendarContainer.classList.add("hasTime"); 10376 if (self.config.noCalendar) 10377 self.calendarContainer.classList.add("noCalendar"); 10378 self.timeContainer = createElement("div", "flatpickr-time"); 10379 self.timeContainer.tabIndex = -1; 10380 var separator = createElement("span", "flatpickr-time-separator", ":"); 10381 var hourInput = createNumberInput("flatpickr-hour", { 10382 "aria-label": self.l10n.hourAriaLabel 10383 }); 10384 self.hourElement = hourInput.getElementsByTagName("input")[0]; 10385 var minuteInput = createNumberInput("flatpickr-minute", { 10386 "aria-label": self.l10n.minuteAriaLabel 10387 }); 10388 self.minuteElement = minuteInput.getElementsByTagName("input")[0]; 10389 self.hourElement.tabIndex = self.minuteElement.tabIndex = -1; 10390 self.hourElement.value = pad(self.latestSelectedDateObj 10391 ? self.latestSelectedDateObj.getHours() 10392 : self.config.time_24hr 10393 ? self.config.defaultHour 10394 : military2ampm(self.config.defaultHour)); 10395 self.minuteElement.value = pad(self.latestSelectedDateObj 10396 ? self.latestSelectedDateObj.getMinutes() 10397 : self.config.defaultMinute); 10398 self.hourElement.setAttribute("step", self.config.hourIncrement.toString()); 10399 self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString()); 10400 self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1"); 10401 self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12"); 10402 self.minuteElement.setAttribute("min", "0"); 10403 self.minuteElement.setAttribute("max", "59"); 10404 self.timeContainer.appendChild(hourInput); 10405 self.timeContainer.appendChild(separator); 10406 self.timeContainer.appendChild(minuteInput); 10407 if (self.config.time_24hr) 10408 self.timeContainer.classList.add("time24hr"); 10409 if (self.config.enableSeconds) { 10410 self.timeContainer.classList.add("hasSeconds"); 10411 var secondInput = createNumberInput("flatpickr-second"); 10412 self.secondElement = secondInput.getElementsByTagName("input")[0]; 10413 self.secondElement.value = pad(self.latestSelectedDateObj 10414 ? self.latestSelectedDateObj.getSeconds() 10415 : self.config.defaultSeconds); 10416 self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step")); 10417 self.secondElement.setAttribute("min", "0"); 10418 self.secondElement.setAttribute("max", "59"); 10419 self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":")); 10420 self.timeContainer.appendChild(secondInput); 10421 } 10422 if (!self.config.time_24hr) { 10423 // add self.amPM if appropriate 10424 self.amPM = createElement("span", "flatpickr-am-pm", self.l10n.amPM[int((self.latestSelectedDateObj 10425 ? self.hourElement.value 10426 : self.config.defaultHour) > 11)]); 10427 self.amPM.title = self.l10n.toggleTitle; 10428 self.amPM.tabIndex = -1; 10429 self.timeContainer.appendChild(self.amPM); 10430 } 10431 return self.timeContainer; 10432 } 10433 function buildWeekdays() { 10434 if (!self.weekdayContainer) 10435 self.weekdayContainer = createElement("div", "flatpickr-weekdays"); 10436 else 10437 clearNode(self.weekdayContainer); 10438 for (var i = self.config.showMonths; i--;) { 10439 var container = createElement("div", "flatpickr-weekdaycontainer"); 10440 self.weekdayContainer.appendChild(container); 10441 } 10442 updateWeekdays(); 10443 return self.weekdayContainer; 10444 } 10445 function updateWeekdays() { 10446 if (!self.weekdayContainer) { 10447 return; 10448 } 10449 var firstDayOfWeek = self.l10n.firstDayOfWeek; 10450 var weekdays = self.l10n.weekdays.shorthand.slice(); 10451 if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) { 10452 weekdays = weekdays.splice(firstDayOfWeek, weekdays.length).concat(weekdays.splice(0, firstDayOfWeek)); 10453 } 10454 for (var i = self.config.showMonths; i--;) { 10455 self.weekdayContainer.children[i].innerHTML = "\n <span class='flatpickr-weekday'>\n " + weekdays.join("</span><span class='flatpickr-weekday'>") + "\n </span>\n "; 10456 } 10457 } 10458 /* istanbul ignore next */ 10459 function buildWeeks() { 10460 self.calendarContainer.classList.add("hasWeeks"); 10461 var weekWrapper = createElement("div", "flatpickr-weekwrapper"); 10462 weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation)); 10463 var weekNumbers = createElement("div", "flatpickr-weeks"); 10464 weekWrapper.appendChild(weekNumbers); 10465 return { 10466 weekWrapper: weekWrapper, 10467 weekNumbers: weekNumbers 10468 }; 10469 } 10470 function changeMonth(value, isOffset) { 10471 if (isOffset === void 0) { isOffset = true; } 10472 var delta = isOffset ? value : value - self.currentMonth; 10473 if ((delta < 0 && self._hidePrevMonthArrow === true) || 10474 (delta > 0 && self._hideNextMonthArrow === true)) 10475 return; 10476 self.currentMonth += delta; 10477 if (self.currentMonth < 0 || self.currentMonth > 11) { 10478 self.currentYear += self.currentMonth > 11 ? 1 : -1; 10479 self.currentMonth = (self.currentMonth + 12) % 12; 10480 triggerEvent("onYearChange"); 10481 buildMonthSwitch(); 10482 } 10483 buildDays(); 10484 triggerEvent("onMonthChange"); 10485 updateNavigationCurrentMonth(); 10486 } 10487 function clear(triggerChangeEvent, toInitial) { 10488 if (triggerChangeEvent === void 0) { triggerChangeEvent = true; } 10489 if (toInitial === void 0) { toInitial = true; } 10490 self.input.value = ""; 10491 if (self.altInput !== undefined) 10492 self.altInput.value = ""; 10493 if (self.mobileInput !== undefined) 10494 self.mobileInput.value = ""; 10495 self.selectedDates = []; 10496 self.latestSelectedDateObj = undefined; 10497 if (toInitial === true) { 10498 self.currentYear = self._initialDate.getFullYear(); 10499 self.currentMonth = self._initialDate.getMonth(); 10500 } 10501 self.showTimeInput = false; 10502 if (self.config.enableTime === true) { 10503 setDefaultHours(); 10504 } 10505 self.redraw(); 10506 if (triggerChangeEvent) 10507 // triggerChangeEvent is true (default) or an Event 10508 triggerEvent("onChange"); 10509 } 10510 function close() { 10511 self.isOpen = false; 10512 if (!self.isMobile) { 10513 if (self.calendarContainer !== undefined) { 10514 self.calendarContainer.classList.remove("open"); 10515 } 10516 if (self._input !== undefined) { 10517 self._input.classList.remove("active"); 10518 } 10519 } 10520 triggerEvent("onClose"); 10521 } 10522 function destroy() { 10523 if (self.config !== undefined) 10524 triggerEvent("onDestroy"); 10525 for (var i = self._handlers.length; i--;) { 10526 var h = self._handlers[i]; 10527 h.element.removeEventListener(h.event, h.handler, h.options); 10528 } 10529 self._handlers = []; 10530 if (self.mobileInput) { 10531 if (self.mobileInput.parentNode) 10532 self.mobileInput.parentNode.removeChild(self.mobileInput); 10533 self.mobileInput = undefined; 10534 } 10535 else if (self.calendarContainer && self.calendarContainer.parentNode) { 10536 if (self.config.static && self.calendarContainer.parentNode) { 10537 var wrapper = self.calendarContainer.parentNode; 10538 wrapper.lastChild && wrapper.removeChild(wrapper.lastChild); 10539 if (wrapper.parentNode) { 10540 while (wrapper.firstChild) 10541 wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper); 10542 wrapper.parentNode.removeChild(wrapper); 10543 } 10544 } 10545 else 10546 self.calendarContainer.parentNode.removeChild(self.calendarContainer); 10547 } 10548 if (self.altInput) { 10549 self.input.type = "text"; 10550 if (self.altInput.parentNode) 10551 self.altInput.parentNode.removeChild(self.altInput); 10552 delete self.altInput; 10553 } 10554 if (self.input) { 10555 self.input.type = self.input._type; 10556 self.input.classList.remove("flatpickr-input"); 10557 self.input.removeAttribute("readonly"); 10558 self.input.value = ""; 10559 } 10560 [ 10561 "_showTimeInput", 10562 "latestSelectedDateObj", 10563 "_hideNextMonthArrow", 10564 "_hidePrevMonthArrow", 10565 "__hideNextMonthArrow", 10566 "__hidePrevMonthArrow", 10567 "isMobile",
vendor: 4,588 bytes, lines 10568-10668
10568 "isOpen", 10569 "selectedDateElem", 10570 "minDateHasTime", 10571 "maxDateHasTime", 10572 "days", 10573 "daysContainer", 10574 "_input", 10575 "_positionElement", 10576 "innerContainer", 10577 "rContainer", 10578 "monthNav", 10579 "todayDateElem", 10580 "calendarContainer", 10581 "weekdayContainer", 10582 "prevMonthNav", 10583 "nextMonthNav", 10584 "monthsDropdownContainer", 10585 "currentMonthElement", 10586 "currentYearElement", 10587 "navigationCurrentMonth", 10588 "selectedDateElem", 10589 "config", 10590 ].forEach(function (k) { 10591 try { 10592 delete self[k]; 10593 } 10594 catch (_) { } 10595 }); 10596 } 10597 function isCalendarElem(elem) { 10598 if (self.config.appendTo && self.config.appendTo.contains(elem)) 10599 return true; 10600 return self.calendarContainer.contains(elem); 10601 } 10602 function documentClick(e) { 10603 if (self.isOpen && !self.config.inline) { 10604 var eventTarget_1 = getEventTarget(e); 10605 var isCalendarElement = isCalendarElem(eventTarget_1); 10606 var isInput = eventTarget_1 === self.input || 10607 eventTarget_1 === self.altInput || 10608 self.element.contains(eventTarget_1) || 10609 // web components 10610 // e.path is not present in all browsers. circumventing typechecks 10611 (e.path && 10612 e.path.indexOf && 10613 (~e.path.indexOf(self.input) || 10614 ~e.path.indexOf(self.altInput))); 10615 var lostFocus = e.type === "blur" 10616 ? isInput && 10617 e.relatedTarget && 10618 !isCalendarElem(e.relatedTarget) 10619 : !isInput && 10620 !isCalendarElement && 10621 !isCalendarElem(e.relatedTarget); 10622 var isIgnored = !self.config.ignoredFocusElements.some(function (elem) { 10623 return elem.contains(eventTarget_1); 10624 }); 10625 if (lostFocus && isIgnored) { 10626 if (self.timeContainer !== undefined && 10627 self.minuteElement !== undefined && 10628 self.hourElement !== undefined) { 10629 updateTime(); 10630 } 10631 self.close(); 10632 if (self.config.mode === "range" && self.selectedDates.length === 1) { 10633 self.clear(false); 10634 self.redraw(); 10635 } 10636 } 10637 } 10638 } 10639 function changeYear(newYear) { 10640 if (!newYear || 10641 (self.config.minDate && newYear < self.config.minDate.getFullYear()) || 10642 (self.config.maxDate && newYear > self.config.maxDate.getFullYear())) 10643 return; 10644 var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum; 10645 self.currentYear = newYearNum || self.currentYear; 10646 if (self.config.maxDate && 10647 self.currentYear === self.config.maxDate.getFullYear()) { 10648 self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth); 10649 } 10650 else if (self.config.minDate && 10651 self.currentYear === self.config.minDate.getFullYear()) { 10652 self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth); 10653 } 10654 if (isNewYear) { 10655 self.redraw(); 10656 triggerEvent("onYearChange"); 10657 buildMonthSwitch(); 10658 } 10659 } 10660 function isEnabled(date, timeless) { 10661 if (timeless === void 0) { timeless = true; } 10662 var dateToCheck = self.parseDate(date, undefined, timeless); // timeless 10663 if ((self.config.minDate && 10664 dateToCheck && 10665 compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) || 10666 (self.config.maxDate && 10667 dateToCheck && 10668 compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) >
10668 0)) 10669 return false; 10670 if (self.config.enable.length === 0 && self.config.disable.length === 0) 10671 return true; 10672 if (dateToCheck === undefined) 10673 return false; 10674 var bool = self.config.enable.length > 0, array = bool ? self.config.enable : self.config.disable; 10675 for (var i = 0, d = void 0; i < array.length; i++) { 10676 d = array[i]; 10677 if (typeof d === "function" && 10678 d(dateToCheck) // disabled by function 10679 ) 10680 return bool; 10681 else if (d instanceof Date && 10682 dateToCheck !== undefined && 10683 d.getTime() === dateToCheck.getTime()) 10684 // disabled by date 10685 return bool; 10686 else if (typeof d === "string" && dateToCheck !== undefined) { 10687 // disabled by date string 10688 var parsed = self.parseDate(d, undefined, true); 10689 return parsed && parsed.getTime() === dateToCheck.getTime() 10690 ? bool 10691 : !bool; 10692 } 10693 else if ( 10694 // disabled by range 10695 typeof d === "object" && 10696 dateToCheck !== undefined && 10697 d.from && 10698 d.to && 10699 dateToCheck.getTime() >= d.from.getTime() && 10700 dateToCheck.getTime() <= d.to.getTime()) 10701 return bool; 10702 } 10703 return !bool; 10704 } 10705 function isInView(elem) { 10706 if (self.daysContainer !== undefined) 10707 return (elem.className.indexOf("hidden") === -1 && 10708 self.daysContainer.contains(elem)); 10709 return false; 10710 } 10711 function onKeyDown(e) { 10712 // e.key e.keyCode 10713 // "Backspace" 8 10714 // "Tab" 9 10715 // "Enter" 13 10716 // "Escape" (IE "Esc") 27 10717 // "ArrowLeft" (IE "Left") 37 10718 // "ArrowUp" (IE "Up") 38 10719 // "ArrowRight" (IE "Right") 39 10720 // "ArrowDown" (IE "Down") 40 10721 // "Delete" (IE "Del") 46 10722 var isInput = e.target === self._input; 10723 var allowInput = self.config.allowInput; 10724 var allowKeydown = self.isOpen && (!allowInput || !isInput); 10725 var allowInlineKeydown = self.config.inline && isInput && !allowInput; 10726 if (e.keyCode === 13 && isInput) { 10727 if (allowInput) { 10728 self.setDate(self._input.value, true, e.target === self.altInput 10729 ? self.config.altFormat 10730 : self.config.dateFormat); 10731 return e.target.blur(); 10732 } 10733 else { 10734 self.open(); 10735 } 10736 } 10737 else if (isCalendarElem(e.target) || 10738 allowKeydown || 10739 allowInlineKeydown) { 10740 var isTimeObj = !!self.timeContainer && 10741 self.timeContainer.contains(e.target); 10742 switch (e.keyCode) { 10743 case 13: 10744 if (isTimeObj) { 10745 e.preventDefault(); 10746 updateTime(); 10747 focusAndClose(); 10748 } 10749 else 10750 selectDate(e); 10751 break; 10752 case 27: // escape 10753 e.preventDefault(); 10754 focusAndClose(); 10755 break; 10756 case 8: 10757 case 46: 10758 if (isInput && !self.config.allowInput) { 10759 e.preventDefault(); 10760 self.clear(); 10761 } 10762 break; 10763 case 37: 10764 case 39: 10765 if (!isTimeObj && !isInput) { 10766 e.preventDefault(); 10767 if (self.daysContainer !== undefined && 10768 (allowInput === false || 10769 (document.activeElement && isInView(document.activeElement)))) { 10770 var delta_1 = e.keyCode === 39 ? 1 : -1; 10771 if (!e.ctrlKey) 10772 focusOnDay(undefined, delta_1); 10773 else { 10774 e.stopPropagation(); 10775 changeMonth(delta_1); 10776 focusOnDay(getFirstAvailableDay(1), 0); 10777 } 10778 } 10779 } 10780 else if (self.hourElement) 10781 self.hourElement.focus(); 10782 break; 10783 case 38: 10784 case 40: 10785 e.preventDefault(); 10786 var delta = e.keyCode === 40 ? 1 : -1; 10787 if ((self.daysContainer && e.target.$i !== undefined) || 10788 e.target === self.input || 10789 e.target === self.altInput) { 10790 if (e.ctrlKey) { 10791 e.stopPropagation(); 10792 changeYear(self.currentYear - delta); 10793 focusOnDay(getFirstAvailableDay(1), 0); 10794 } 10795 else if (!isTimeObj) 10796 focusOnDay(undefined, delta * 7); 10797 } 10798 else if (e.target === self.currentYearElement) { 10799 changeYear(self.currentYear - delta); 10800 } 10801 else if (self.config.enableTime) { 10802 if (!isTimeObj && self.hourElement) 10803 self.hourElement.focus(); 10804 updateTime(e); 10805 self._debouncedChange(); 10806 } 10807 break; 10808 case 9: 10809 if (isTimeObj) { 10810 var elems = [ 10811 self.hourElement, 10812 self.minuteElement, 10813 self.secondElement, 10814 self.amPM, 10815 ] 10816 .concat(self.pluginElements) 10817 .filter(function (x) { return x; }); 10818 var i = elems.indexOf(e.target); 10819 if (i !== -1) { 10820 var target = elems[i + (e.shiftKey ? -1 : 1)]; 10821 e.preventDefault(); 10822 (target || self._input).focus(); 10823 } 10824 } 10825 else if (!self.config.noCalendar && 10826 self.daysContainer && 10827 self.daysContainer.contains(e.target) && 10828 e.shiftKey) { 10829 e.preventDefault(); 10830 self._input.focus(); 10831 } 10832 break; 10833 default: 10834 break; 10835 } 10836 } 10837 if (self.amPM !== undefined && e.target === self.amPM) { 10838 switch (e.key) { 10839 case self.l10n.amPM[0].charAt(0): 10840 case self.l10n.amPM[0].charAt(0).toLowerCase(): 10841 self.amPM.textContent = self.l10n.amPM[0]; 10842 setHoursFromInputs();
vendor: 4,246 bytes, lines 10843-10924
10843 updateValue(); 10844 break; 10845 case self.l10n.amPM[1].charAt(0): 10846 case self.l10n.amPM[1].charAt(0).toLowerCase(): 10847 self.amPM.textContent = self.l10n.amPM[1]; 10848 setHoursFromInputs(); 10849 updateValue(); 10850 break; 10851 } 10852 } 10853 if (isInput || isCalendarElem(e.target)) { 10854 triggerEvent("onKeyDown", e); 10855 } 10856 } 10857 function onMouseOver(elem) { 10858 if (self.selectedDates.length !== 1 || 10859 (elem && 10860 (!elem.classList.contains("flatpickr-day") || 10861 elem.classList.contains("flatpickr-disabled")))) 10862 return; 10863 var hoverDate = elem 10864 ? elem.dateObj.getTime() 10865 : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime()); 10866 var containsDisabled = false; 10867 var minRange = 0, maxRange = 0; 10868 for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) { 10869 if (!isEnabled(new Date(t), true)) { 10870 containsDisabled = 10871 containsDisabled || (t > rangeStartDate && t < rangeEndDate); 10872 if (t < initialDate && (!minRange || t > minRange)) 10873 minRange = t; 10874 else if (t > initialDate && (!maxRange || t < maxRange)) 10875 maxRange = t; 10876 } 10877 } 10878 for (var m = 0; m < self.config.showMonths; m++) { 10879 var month = self.daysContainer.children[m]; 10880 var _loop_1 = function (i, l) { 10881 var dayElem = month.children[i], date = dayElem.dateObj; 10882 var timestamp = date.getTime(); 10883 var outOfRange = (minRange > 0 && timestamp < minRange) || 10884 (maxRange > 0 && timestamp > maxRange); 10885 if (outOfRange) { 10886 dayElem.classList.add("notAllowed"); 10887 ["inRange", "startRange", "endRange"].forEach(function (c) { 10888 dayElem.classList.remove(c); 10889 }); 10890 return "continue"; 10891 } 10892 else if (containsDisabled && !outOfRange) 10893 return "continue"; 10894 ["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) { 10895 dayElem.classList.remove(c); 10896 }); 10897 if (elem !== undefined) { 10898 elem.classList.add(hoverDate <= self.selectedDates[0].getTime() 10899 ? "startRange" 10900 : "endRange"); 10901 if (initialDate < hoverDate && timestamp === initialDate) 10902 dayElem.classList.add("startRange"); 10903 else if (initialDate > hoverDate && timestamp === initialDate) 10904 dayElem.classList.add("endRange"); 10905 if (timestamp >= minRange && 10906 (maxRange === 0 || timestamp <= maxRange) && 10907 isBetween(timestamp, initialDate, hoverDate)) 10908 dayElem.classList.add("inRange"); 10909 } 10910 }; 10911 for (var i = 0, l = month.children.length; i < l; i++) { 10912 _loop_1(i, l); 10913 } 10914 } 10915 } 10916 function onResize() { 10917 if (self.isOpen && !self.config.static && !self.config.inline) 10918 positionCalendar(); 10919 } 10920 function setDefaultTime() { 10921 self.setDate(self.config.minDate !== undefined 10922 ? new Date(self.config.minDate.getTime()) 10923 : new Date(), true); 10924 setDefaultHours();
10925 updateValue(); 10926 } 10927 function open(e, positionElement) { 10928 if (positionElement === void 0) { positionElement = self._positionElement; } 10929 if (self.isMobile === true) { 10930 if (e) { 10931 e.preventDefault(); 10932 e.target && e.target.blur(); 10933 } 10934 if (self.mobileInput !== undefined) { 10935 self.mobileInput.focus(); 10936 self.mobileInput.click(); 10937 } 10938 triggerEvent("onOpen"); 10939 return; 10940 } 10941 if (self._input.disabled || self.config.inline) 10942 return; 10943 var wasOpen = self.isOpen; 10944 self.isOpen = true; 10945 if (!wasOpen) { 10946 self.calendarContainer.classList.add("open"); 10947 self._input.classList.add("active"); 10948 triggerEvent("onOpen"); 10949 positionCalendar(positionElement); 10950 } 10951 if (self.config.enableTime === true && self.config.noCalendar === true) { 10952 if (self.selectedDates.length === 0) { 10953 setDefaultTime(); 10954 } 10955 if (self.config.allowInput === false && 10956 (e === undefined || 10957 !self.timeContainer.contains(e.relatedTarget))) { 10958 setTimeout(function () { return self.hourElement.select(); }, 50); 10959 } 10960 } 10961 } 10962 function minMaxDateSetter(type) { 10963 return function (date) { 10964 var dateObj = (self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat)); 10965 var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"]; 10966 if (dateObj !== undefined) { 10967 self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] = 10968 dateObj.getHours() > 0 || 10969 dateObj.getMinutes() > 0 || 10970 dateObj.getSeconds() > 0; 10971 } 10972 if (self.selectedDates) { 10973 self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); }); 10974 if (!self.selectedDates.length && type === "min") 10975 setHoursFromDate(dateObj); 10976 updateValue(); 10977 } 10978 if (self.daysContainer) { 10979 redraw(); 10980 if (dateObj !== undefined) 10981 self.currentYearElement[type] = dateObj.getFullYear().toString(); 10982 else 10983 self.currentYearElement.removeAttribute(type); 10984 self.currentYearElement.disabled = 10985 !!inverseDateObj && 10986 dateObj !== undefined && 10987 inverseDateObj.getFullYear() === dateObj.getFullYear(); 10988 } 10989 }; 10990 } 10991 function parseConfig() { 10992 var boolOpts = [ 10993 "wrap", 10994 "weekNumbers", 10995 "allowInput", 10996 "clickOpens", 10997 "time_24hr", 10998 "enableTime", 10999 "noCalendar", 11000 "altInput", 11001 "shorthandCurrentMonth", 11002 "inline", 11003 "static", 11004 "enableSeconds", 11005 "disableMobile", 11006 ]; 11007 var userConfig = __assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {}))); 11008 var formats = {}; 11009 self.config.parseDate = userConfig.parseDate; 11010 self.config.formatDate = userConfig.formatDate; 11011 Object.defineProperty(self.config, "enable", { 11012 get: function () { return self.config._enable; }, 11013 set: function (dates) { 11014 self.config._enable = parseDateRules(dates); 11015 } 11016 }); 11017 Object.defineProperty(self.config, "disable", { 11018 get: function () { return self.config._disable; }, 11019 set: function (dates) { 11020 self.config._disable = parseDateRules(dates); 11021 } 11022 }); 11023 var timeMode = userConfig.mode === "time"; 11024 if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) { 11025 var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat; 11026 formats.dateFormat = 11027 userConfig.noCalendar || timeMode 11028 ? "H:i" + (userConfig.enableSeconds ? ":S" : "") 11029 : defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : ""); 11030 } 11031 if (userConfig.altInput && 11032 (userConfig.enableTime || timeMode) && 11033 !userConfig.altFormat) { 11034 var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat; 11035 formats.altFormat = 11036 userConfig.noCalendar || timeMode 11037 ? "h:i" + (userConfig.enableSeconds ? ":S K" : " K")
11038 : defaultAltFormat + (" h:i" + (userConfig.enableSeconds ? ":S" : "") + " K"); 11039 } 11040 if (!userConfig.altInputClass) { 11041 self.config.altInputClass = 11042 self.input.className + " " + self.config.altInputClass; 11043 } 11044 Object.defineProperty(self.config, "minDate", { 11045 get: function () { return self.config._minDate; }, 11046 set: minMaxDateSetter("min") 11047 }); 11048 Object.defineProperty(self.config, "maxDate", { 11049 get: function () { return self.config._maxDate; }, 11050 set: minMaxDateSetter("max") 11051 }); 11052 var minMaxTimeSetter = function (type) { return function (val) { 11053 self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S"); 11054 }; }; 11055 Object.defineProperty(self.config, "minTime", { 11056 get: function () { return self.config._minTime; }, 11057 set: minMaxTimeSetter("min") 11058 }); 11059 Object.defineProperty(self.config, "maxTime", { 11060 get: function () { return self.config._maxTime; }, 11061 set: minMaxTimeSetter("max") 11062 }); 11063 if (userConfig.mode === "time") { 11064 self.config.noCalendar = true; 11065 self.config.enableTime = true; 11066 } 11067 Object.assign(self.config, formats, userConfig); 11068 for (var i = 0; i < boolOpts.length; i++) 11069 self.config[boolOpts[i]] = 11070 self.config[boolOpts[i]] === true || 11071 self.config[boolOpts[i]] === "true"; 11072 HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) { 11073 self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance); 11074 }); 11075 self.isMobile = 11076 !self.config.disableMobile && 11077 !self.config.inline && 11078 self.config.mode === "single" && 11079 !self.config.disable.length && 11080 !self.config.enable.length && 11081 !self.config.weekNumbers && 11082 /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 11083 for (var i = 0; i < self.config.plugins.length; i++) { 11084 var pluginConf = self.config.plugins[i](self) || {}; 11085 for (var key in pluginConf) { 11086 if (HOOKS.indexOf(key) > -1) { 11087 self.config[key] = arrayify(pluginConf[key]) 11088 .map(bindToInstance) 11089 .concat(self.config[key]); 11090 } 11091 else if (typeof userConfig[key] === "undefined") 11092 self.config[key] = pluginConf[key]; 11093 } 11094 } 11095 triggerEvent("onParseConfig"); 11096 } 11097 function setupLocale() { 11098 if (typeof self.config.locale !== "object" && 11099 typeof flatpickr.l10ns[self.config.locale] === "undefined") 11100 self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale)); 11101 self.l10n = __assign({}, flatpickr.l10ns["default"], (typeof self.config.locale === "object" 11102 ? self.config.locale 11103 : self.config.locale !== "default" 11104 ? flatpickr.l10ns[self.config.locale] 11105 : undefined)); 11106 tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")"; 11107 var userConfig = __assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {}))); 11108 if (userConfig.time_24hr === undefined && 11109 flatpickr.defaultConfig.time_24hr === undefined) { 11110 self.config.time_24hr = self.l10n.time_24hr; 11111 } 11112 self.formatDate = createDateFormatter(self); 11113 self.parseDate = createDateParser({ config: self.config, l10n: self.l10n }); 11114 } 11115 function positionCalendar(customPositionElement) { 11116 if (self.calendarContainer === undefined) 11117 return; 11118 triggerEvent("onPreCalendarPosition"); 11119 var positionElement = customPositionElement || self._positionElement; 11120 var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(" "), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === "above" || 11121 (configPosVertical !== "below" && 11122 distanceFromBottom < calendarHeight && 11123 inputBounds.top > calendarHeight); 11124 var top = window.pageYOffset + 11125 inputBounds.top + 11126 (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2); 11127 toggleClass(self.calendarContainer, "arrowTop", !showOnTop); 11128 toggleClass(self.calendarContainer, "arrowBottom", showOnTop); 11129 if (self.config.inline) 11130 return; 11131 var left = window.pageXOffset + 11132 inputBounds.left -
vendor: 5,162 bytes, lines 11133-11236
11133 (configPosHorizontal != null && configPosHorizontal === "center" 11134 ? (calendarWidth - inputBounds.width) / 2 11135 : 0); 11136 var right = window.document.body.offsetWidth - (window.pageXOffset + inputBounds.right); 11137 var rightMost = left + calendarWidth > window.document.body.offsetWidth; 11138 var centerMost = right + calendarWidth > window.document.body.offsetWidth; 11139 toggleClass(self.calendarContainer, "rightMost", rightMost); 11140 if (self.config.static) 11141 return; 11142 self.calendarContainer.style.top = top + "px"; 11143 if (!rightMost) { 11144 self.calendarContainer.style.left = left + "px"; 11145 self.calendarContainer.style.right = "auto"; 11146 } 11147 else if (!centerMost) { 11148 self.calendarContainer.style.left = "auto"; 11149 self.calendarContainer.style.right = right + "px"; 11150 } 11151 else { 11152 var doc = document.styleSheets[0]; 11153 // some testing environments don't have css support 11154 if (doc === undefined) 11155 return; 11156 var bodyWidth = window.document.body.offsetWidth; 11157 var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2); 11158 var centerBefore = ".flatpickr-calendar.centerMost:before"; 11159 var centerAfter = ".flatpickr-calendar.centerMost:after"; 11160 var centerIndex = doc.cssRules.length; 11161 var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}"; 11162 toggleClass(self.calendarContainer, "rightMost", false); 11163 toggleClass(self.calendarContainer, "centerMost", true); 11164 doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex); 11165 self.calendarContainer.style.left = centerLeft + "px"; 11166 self.calendarContainer.style.right = "auto"; 11167 } 11168 } 11169 function redraw() { 11170 if (self.config.noCalendar || self.isMobile) 11171 return; 11172 updateNavigationCurrentMonth(); 11173 buildDays(); 11174 } 11175 function focusAndClose() { 11176 self._input.focus(); 11177 if (window.navigator.userAgent.indexOf("MSIE") !== -1 || 11178 navigator.msMaxTouchPoints !== undefined) { 11179 // hack - bugs in the way IE handles focus keeps the calendar open 11180 setTimeout(self.close, 0); 11181 } 11182 else { 11183 self.close(); 11184 } 11185 } 11186 function selectDate(e) { 11187 e.preventDefault(); 11188 e.stopPropagation(); 11189 var isSelectable = function (day) { 11190 return day.classList && 11191 day.classList.contains("flatpickr-day") && 11192 !day.classList.contains("flatpickr-disabled") && 11193 !day.classList.contains("notAllowed"); 11194 }; 11195 var t = findParent(e.target, isSelectable); 11196 if (t === undefined) 11197 return; 11198 var target = t; 11199 var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime())); 11200 var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth || 11201 selectedDate.getMonth() > 11202 self.currentMonth + self.config.showMonths - 1) && 11203 self.config.mode !== "range"; 11204 self.selectedDateElem = target; 11205 if (self.config.mode === "single") 11206 self.selectedDates = [selectedDate]; 11207 else if (self.config.mode === "multiple") { 11208 var selectedIndex = isDateSelected(selectedDate); 11209 if (selectedIndex) 11210 self.selectedDates.splice(parseInt(selectedIndex), 1); 11211 else 11212 self.selectedDates.push(selectedDate); 11213 } 11214 else if (self.config.mode === "range") { 11215 if (self.selectedDates.length === 2) { 11216 self.clear(false, false); 11217 } 11218 self.latestSelectedDateObj = selectedDate; 11219 self.selectedDates.push(selectedDate); 11220 // unless selecting same date twice, sort ascendingly 11221 if (compareDates(selectedDate, self.selectedDates[0], true) !== 0) 11222 self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); }); 11223 } 11224 setHoursFromInputs(); 11225 if (shouldChangeMonth) { 11226 var isNewYear = self.currentYear !== selectedDate.getFullYear(); 11227 self.currentYear = selectedDate.getFullYear(); 11228 self.currentMonth = selectedDate.getMonth(); 11229 if (isNewYear) { 11230 triggerEvent("onYearChange"); 11231 buildMonthSwitch(); 11232 } 11233 triggerEvent("onMonthChange"); 11234 } 11235 updateNavigationCurrentMonth(); 11236 buildDays();
11237 updateValue(); 11238 if (self.config.enableTime) 11239 setTimeout(function () { return (self.showTimeInput = true); }, 50); 11240 // maintain focus 11241 if (!shouldChangeMonth && 11242 self.config.mode !== "range" && 11243 self.config.showMonths === 1) 11244 focusOnDayElem(target); 11245 else if (self.selectedDateElem !== undefined && 11246 self.hourElement === undefined) { 11247 self.selectedDateElem && self.selectedDateElem.focus(); 11248 } 11249 if (self.hourElement !== undefined) 11250 self.hourElement !== undefined && self.hourElement.focus(); 11251 if (self.config.closeOnSelect) { 11252 var single = self.config.mode === "single" && !self.config.enableTime; 11253 var range = self.config.mode === "range" && 11254 self.selectedDates.length === 2 && 11255 !self.config.enableTime; 11256 if (single || range) { 11257 focusAndClose(); 11258 } 11259 } 11260 triggerChange(); 11261 } 11262 var CALLBACKS = { 11263 locale: [setupLocale, updateWeekdays], 11264 showMonths: [buildMonths, setCalendarWidth, buildWeekdays], 11265 minDate: [jumpToDate], 11266 maxDate: [jumpToDate] 11267 }; 11268 function set(option, value) { 11269 if (option !== null && typeof option === "object") { 11270 Object.assign(self.config, option); 11271 for (var key in option) { 11272 if (CALLBACKS[key] !== undefined) 11273 CALLBACKS[key].forEach(function (x) { return x(); }); 11274 } 11275 } 11276 else { 11277 self.config[option] = value; 11278 if (CALLBACKS[option] !== undefined) 11279 CALLBACKS[option].forEach(function (x) { return x(); }); 11280 else if (HOOKS.indexOf(option) > -1) 11281 self.config[option] = arrayify(value); 11282 } 11283 self.redraw(); 11284 updateValue(false); 11285 } 11286 function setSelectedDate(inputDate, format) { 11287 var dates = []; 11288 if (inputDate instanceof Array) 11289 dates = inputDate.map(function (d) { return self.parseDate(d, format); }); 11290 else if (inputDate instanceof Date || typeof inputDate === "number") 11291 dates = [self.parseDate(inputDate, format)]; 11292 else if (typeof inputDate === "string") { 11293 switch (self.config.mode) { 11294 case "single": 11295 case "time": 11296 dates = [self.parseDate(inputDate, format)]; 11297 break; 11298 case "multiple": 11299 dates = inputDate 11300 .split(self.config.conjunction) 11301 .map(function (date) { return self.parseDate(date, format); }); 11302 break; 11303 case "range": 11304 dates = inputDate 11305 .split(self.l10n.rangeSeparator) 11306 .map(function (date) { return self.parseDate(date, format); }); 11307 break; 11308 default: 11309 break; 11310 } 11311 } 11312 else 11313 self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate))); 11314 self.selectedDates = dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); }); 11315 if (self.config.mode === "range") 11316 self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); }); 11317 } 11318 function setDate(date, triggerChange, format) { 11319 if (triggerChange === void 0) { triggerChange = false; } 11320 if (format === void 0) { format = self.config.dateFormat; } 11321 if ((date !== 0 && !date) || (date instanceof Array && date.length === 0)) 11322 return self.clear(triggerChange); 11323 setSelectedDate(date, format); 11324 self.showTimeInput = self.selectedDates.length > 0;
vendor: 15,004 bytes, lines 11325-11637
11325 self.latestSelectedDateObj = 11326 self.selectedDates[self.selectedDates.length - 1]; 11327 self.redraw(); 11328 jumpToDate(); 11329 setHoursFromDate(); 11330 if (self.selectedDates.length === 0) { 11331 self.clear(false); 11332 } 11333 updateValue(triggerChange); 11334 if (triggerChange) 11335 triggerEvent("onChange"); 11336 } 11337 function parseDateRules(arr) { 11338 return arr 11339 .slice() 11340 .map(function (rule) { 11341 if (typeof rule === "string" || 11342 typeof rule === "number" || 11343 rule instanceof Date) { 11344 return self.parseDate(rule, undefined, true); 11345 } 11346 else if (rule && 11347 typeof rule === "object" && 11348 rule.from && 11349 rule.to) 11350 return { 11351 from: self.parseDate(rule.from, undefined), 11352 to: self.parseDate(rule.to, undefined) 11353 }; 11354 return rule; 11355 }) 11356 .filter(function (x) { return x; }); // remove falsy values 11357 } 11358 function setupDates() { 11359 self.selectedDates = []; 11360 self.now = self.parseDate(self.config.now) || new Date(); 11361 // Workaround IE11 setting placeholder as the input's value 11362 var preloadedDate = self.config.defaultDate || 11363 ((self.input.nodeName === "INPUT" || 11364 self.input.nodeName === "TEXTAREA") && 11365 self.input.placeholder && 11366 self.input.value === self.input.placeholder 11367 ? null 11368 : self.input.value); 11369 if (preloadedDate) 11370 setSelectedDate(preloadedDate, self.config.dateFormat); 11371 self._initialDate = 11372 self.selectedDates.length > 0 11373 ? self.selectedDates[0] 11374 : self.config.minDate && 11375 self.config.minDate.getTime() > self.now.getTime() 11376 ? self.config.minDate 11377 : self.config.maxDate && 11378 self.config.maxDate.getTime() < self.now.getTime() 11379 ? self.config.maxDate 11380 : self.now; 11381 self.currentYear = self._initialDate.getFullYear(); 11382 self.currentMonth = self._initialDate.getMonth(); 11383 if (self.selectedDates.length > 0) 11384 self.latestSelectedDateObj = self.selectedDates[0]; 11385 if (self.config.minTime !== undefined) 11386 self.config.minTime = self.parseDate(self.config.minTime, "H:i"); 11387 if (self.config.maxTime !== undefined) 11388 self.config.maxTime = self.parseDate(self.config.maxTime, "H:i"); 11389 self.minDateHasTime = 11390 !!self.config.minDate && 11391 (self.config.minDate.getHours() > 0 || 11392 self.config.minDate.getMinutes() > 0 || 11393 self.config.minDate.getSeconds() > 0); 11394 self.maxDateHasTime = 11395 !!self.config.maxDate && 11396 (self.config.maxDate.getHours() > 0 || 11397 self.config.maxDate.getMinutes() > 0 || 11398 self.config.maxDate.getSeconds() > 0); 11399 Object.defineProperty(self, "showTimeInput", { 11400 get: function () { return self._showTimeInput; }, 11401 set: function (bool) { 11402 self._showTimeInput = bool; 11403 if (self.calendarContainer) 11404 toggleClass(self.calendarContainer, "showTimeInput", bool); 11405 self.isOpen && positionCalendar(); 11406 } 11407 }); 11408 } 11409 function setupInputs() { 11410 self.input = self.config.wrap 11411 ? element.querySelector("[data-input]") 11412 : element; 11413 /* istanbul ignore next */ 11414 if (!self.input) { 11415 self.config.errorHandler(new Error("Invalid input element specified")); 11416 return; 11417 } 11418 // hack: store previous type to restore it after destroy() 11419 self.input._type = self.input.type; 11420 self.input.type = "text"; 11421 self.input.classList.add("flatpickr-input"); 11422 self._input = self.input; 11423 if (self.config.altInput) { 11424 // replicate self.element 11425 self.altInput = createElement(self.input.nodeName, self.config.altInputClass); 11426 self._input = self.altInput; 11427 self.altInput.placeholder = self.input.placeholder; 11428 self.altInput.disabled = self.input.disabled; 11429 self.altInput.required = self.input.required; 11430 self.altInput.tabIndex = self.input.tabIndex; 11431 self.altInput.type = "text"; 11432 self.input.setAttribute("type", "hidden"); 11433 if (!self.config.static && self.input.parentNode) 11434 self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling); 11435 } 11436 if (!self.config.allowInput) 11437 self._input.setAttribute("readonly", "readonly"); 11438 self._positionElement = self.config.positionElement || self._input; 11439 } 11440 function setupMobile() { 11441 var inputType = self.config.enableTime 11442 ? self.config.noCalendar 11443 ? "time" 11444 : "datetime-local" 11445 : "date"; 11446 self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile"); 11447 self.mobileInput.step = self.input.getAttribute("step") || "any"; 11448 self.mobileInput.tabIndex = 1; 11449 self.mobileInput.type = inputType; 11450 self.mobileInput.disabled = self.input.disabled; 11451 self.mobileInput.required = self.input.required; 11452 self.mobileInput.placeholder = self.input.placeholder; 11453 self.mobileFormatStr = 11454 inputType === "datetime-local" 11455 ? "Y-m-d\\TH:i:S" 11456 : inputType === "date" 11457 ? "Y-m-d" 11458 : "H:i:S"; 11459 if (self.selectedDates.length > 0) { 11460 self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr); 11461 } 11462 if (self.config.minDate) 11463 self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d"); 11464 if (self.config.maxDate) 11465 self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d"); 11466 self.input.type = "hidden"; 11467 if (self.altInput !== undefined) 11468 self.altInput.type = "hidden"; 11469 try { 11470 if (self.input.parentNode) 11471 self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling); 11472 } 11473 catch (_a) { } 11474 bind(self.mobileInput, "change", function (e) { 11475 self.setDate(e.target.value, false, self.mobileFormatStr); 11476 triggerEvent("onChange"); 11477 triggerEvent("onClose"); 11478 }); 11479 } 11480 function toggle(e) { 11481 if (self.isOpen === true) 11482 return self.close(); 11483 self.open(e); 11484 } 11485 function triggerEvent(event, data) { 11486 // If the instance has been destroyed already, all hooks have been removed 11487 if (self.config === undefined) 11488 return; 11489 var hooks = self.config[event]; 11490 if (hooks !== undefined && hooks.length > 0) { 11491 for (var i = 0; hooks[i] && i < hooks.length; i++) 11492 hooks[i](self.selectedDates, self.input.value, self, data); 11493 } 11494 if (event === "onChange") { 11495 self.input.dispatchEvent(createEvent("change")); 11496 // many front-end frameworks bind to the input event 11497 self.input.dispatchEvent(createEvent("input")); 11498 } 11499 } 11500 function createEvent(name) { 11501 var e = document.createEvent("Event"); 11502 e.initEvent(name, true, true); 11503 return e; 11504 } 11505 function isDateSelected(date) { 11506 for (var i = 0; i < self.selectedDates.length; i++) { 11507 if (compareDates(self.selectedDates[i], date) === 0) 11508 return "" + i; 11509 } 11510 return false; 11511 } 11512 function isDateInRange(date) { 11513 if (self.config.mode !== "range" || self.selectedDates.length < 2) 11514 return false; 11515 return (compareDates(date, self.selectedDates[0]) >= 0 && 11516 compareDates(date, self.selectedDates[1]) <= 0); 11517 } 11518 function updateNavigationCurrentMonth() { 11519 if (self.config.noCalendar || self.isMobile || !self.monthNav) 11520 return; 11521 self.yearElements.forEach(function (yearElement, i) { 11522 var d = new Date(self.currentYear, self.currentMonth, 1); 11523 d.setMonth(self.currentMonth + i); 11524 if (self.config.showMonths > 1 || 11525 self.config.monthSelectorType === "static") { 11526 self.monthElements[i].textContent = 11527 monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " "; 11528 } 11529 else { 11530 self.monthsDropdownContainer.value = d.getMonth().toString(); 11531 } 11532 yearElement.value = d.getFullYear().toString(); 11533 }); 11534 self._hidePrevMonthArrow = 11535 self.config.minDate !== undefined && 11536 (self.currentYear === self.config.minDate.getFullYear() 11537 ? self.currentMonth <= self.config.minDate.getMonth() 11538 : self.currentYear < self.config.minDate.getFullYear()); 11539 self._hideNextMonthArrow = 11540 self.config.maxDate !== undefined && 11541 (self.currentYear === self.config.maxDate.getFullYear() 11542 ? self.currentMonth + 1 > self.config.maxDate.getMonth() 11543 : self.currentYear > self.config.maxDate.getFullYear()); 11544 } 11545 function getDateStr(format) { 11546 return self.selectedDates 11547 .map(function (dObj) { return self.formatDate(dObj, format); }) 11548 .filter(function (d, i, arr) { 11549 return self.config.mode !== "range" || 11550 self.config.enableTime || 11551 arr.indexOf(d) === i; 11552 }) 11553 .join(self.config.mode !== "range" 11554 ? self.config.conjunction 11555 : self.l10n.rangeSeparator); 11556 } 11557 /** 11558 * Updates the values of inputs associated with the calendar 11559 */ 11560 function updateValue(triggerChange) { 11561 if (triggerChange === void 0) { triggerChange = true; } 11562 if (self.mobileInput !== undefined && self.mobileFormatStr) { 11563 self.mobileInput.value = 11564 self.latestSelectedDateObj !== undefined 11565 ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) 11566 : ""; 11567 } 11568 self.input.value = getDateStr(self.config.dateFormat); 11569 if (self.altInput !== undefined) { 11570 self.altInput.value = getDateStr(self.config.altFormat); 11571 } 11572 if (triggerChange !== false) 11573 triggerEvent("onValueUpdate"); 11574 } 11575 function onMonthNavClick(e) { 11576 var isPrevMonth = self.prevMonthNav.contains(e.target); 11577 var isNextMonth = self.nextMonthNav.contains(e.target); 11578 if (isPrevMonth || isNextMonth) { 11579 changeMonth(isPrevMonth ? -1 : 1); 11580 } 11581 else if (self.yearElements.indexOf(e.target) >= 0) { 11582 e.target.select(); 11583 } 11584 else if (e.target.classList.contains("arrowUp")) { 11585 self.changeYear(self.currentYear + 1); 11586 } 11587 else if (e.target.classList.contains("arrowDown")) { 11588 self.changeYear(self.currentYear - 1); 11589 } 11590 } 11591 function timeWrapper(e) { 11592 e.preventDefault(); 11593 var isKeyDown = e.type === "keydown", input = e.target; 11594 if (self.amPM !== undefined && e.target === self.amPM) { 11595 self.amPM.textContent = 11596 self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])]; 11597 } 11598 var min = parseFloat(input.getAttribute("min")), max = parseFloat(input.getAttribute("max")), step = parseFloat(input.getAttribute("step")), curValue = parseInt(input.value, 10), delta = e.delta || 11599 (isKeyDown ? (e.which === 38 ? 1 : -1) : 0); 11600 var newValue = curValue + step * delta; 11601 if (typeof input.value !== "undefined" && input.value.length === 2) { 11602 var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement; 11603 if (newValue < min) { 11604 newValue = 11605 max + 11606 newValue + 11607 int(!isHourElem) + 11608 (int(isHourElem) && int(!self.amPM)); 11609 if (isMinuteElem) 11610 incrementNumInput(undefined, -1, self.hourElement); 11611 } 11612 else if (newValue > max) { 11613 newValue = 11614 input === self.hourElement ? newValue - max - int(!self.amPM) : min; 11615 if (isMinuteElem) 11616 incrementNumInput(undefined, 1, self.hourElement); 11617 } 11618 if (self.amPM && 11619 isHourElem && 11620 (step === 1 11621 ? newValue + curValue === 23 11622 : Math.abs(newValue - curValue) > step)) { 11623 self.amPM.textContent = 11624 self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])]; 11625 } 11626 input.value = pad(newValue); 11627 } 11628 } 11629 init(); 11630 return self; 11631 } 11632 /* istanbul ignore next */ 11633 function _flatpickr(nodeList, config) { 11634 // static list 11635 var nodes = Array.prototype.slice 11636 .call(nodeList) 11637 .filter(function (x) { return x instanceof HTMLElement; });
11638 var instances = []; 11639 for (var i = 0; i < nodes.length; i++) { 11640 var node = nodes[i]; 11641 try { 11642 if (node.getAttribute("data-fp-omit") !== null) 11643 continue; 11644 if (node._flatpickr !== undefined) { 11645 node._flatpickr.destroy(); 11646 node._flatpickr = undefined; 11647 } 11648 node._flatpickr = FlatpickrInstance(node, config || {}); 11649 instances.push(node._flatpickr); 11650 } 11651 catch (e) { 11652 console.error(e); 11653 } 11654 } 11655 return instances.length === 1 ? instances[0] : instances; 11656 } 11657 /* istanbul ignore next */ 11658 if (typeof HTMLElement !== "undefined" && 11659 typeof HTMLCollection !== "undefined" && 11660 typeof NodeList !== "undefined") { 11661 // browser env 11662 HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) { 11663 return _flatpickr(this, config); 11664 }; 11665 HTMLElement.prototype.flatpickr = function (config) { 11666 return _flatpickr([this], config); 11667 }; 11668 } 11669 /* istanbul ignore next */ 11670 var flatpickr = function (selector, config) { 11671 if (typeof selector === "string") { 11672 return _flatpickr(window.document.querySelectorAll(selector), config); 11673 } 11674 else if (selector instanceof Node) { 11675 return _flatpickr([selector], config); 11676 } 11677 else { 11678 return _flatpickr(selector, config); 11679 } 11680 }; 11681 /* istanbul ignore next */ 11682 flatpickr.defaultConfig = {}; 11683 flatpickr.l10ns = { 11684 en: __assign({}, english), 11685 "default": __assign({}, english) 11686 }; 11687 flatpickr.localize = function (l10n) { 11688 flatpickr.l10ns["default"] = __assign({}, flatpickr.l10ns["default"], l10n); 11689 }; 11690 flatpickr.setDefaults = function (config) { 11691 flatpickr.defaultConfig = __assign({}, flatpickr.defaultConfig, config); 11692 }; 11693 flatpickr.parseDate = createDateParser({}); 11694 flatpickr.formatDate = createDateFormatter({}); 11695 flatpickr.compareDates = compareDates; 11696 /* istanbul ignore next */ 11697 if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") { 11698 jQuery.fn.flatpickr = function (config) { 11699 return _flatpickr(this, config); 11700 }; 11701 } 11702 // eslint-disable-next-line @typescript-eslint/camelcase 11703 Date.prototype.fp_incr = function (days) { 11704 return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days)); 11705 }; 11706 if (typeof window !== "undefined") { 11707 window.flatpickr = flatpickr; 11708 } 11709 11710 return flatpickr; 11711 11712})); 11713; 11714/*! jQuery Mobile v1.4.5 | Copyright 2010, 2014 jQuery Foundation, Inc. | jquery.org/license */ 11715 11716(function(e, t, n) { 11717 typeof define == "function" && define.amd ? define(["jquery"], function(r) { 11718 return n(r, e, t), r.mobile 11719 }) : n(e.jQuery, e, t) 11720})(this, document, function(e, t, n, r) { 11721 (function(e, t, n, r) { 11722 function T(e) { 11723 while (e && typeof e.originalEvent != "undefined") e = e.originalEvent; 11724 return e 11725 } 11726 11727 function N(t, n) { 11728 var i = t.type, 11729 s, o, a, l, c, h, p, d, v; 11730 t = e.Event(t), t.type = n, s = t.originalEvent, o = e.event.props, i.search(/^(mouse|click)/) > -1 && (o = f); 11731 if (s) 11732 for (p = o.length, l; p;) l = o[--p], t[l] = s[l]; 11733 i.search(/mouse(down|up)|click/) > -1 && !t.which && (t.which = 1); 11734 if (i.search(/^touch/) !== -1) { 11735 a = T(s), i = a.touches, c = a.changedTouches, h = i && i.length ? i[0] : c && c.length ? c[0] : r; 11736 if (h) 11737 for (d = 0, v = u.length; d < v; d++) l = u[d], t[l] = h[l] 11738 } 11739 return t 11740 } 11741 11742 function C(t) { 11743 var n = {}, 11744 r, s; 11745 while (t) { 11746 r = e.data(t, i); 11747 for (s in r) r[s] && (n[s] = n.hasVirtualBinding = !0); 11748 t = t.parentNode 11749 } 11750 return n 11751 } 11752 11753 function k(t, n) { 11754 var r; 11755 while (t) { 11756 r = e.data(t, i); 11757 if (r && (!n || r[n])) return t; 11758 t = t.parentNode 11759 } 11760 return null 11761 } 11762 11763 function L() { 11764 g = !1 11765 } 11766 11767 function A() { 11768 g = !0 11769 } 11770 11771 function O() { 11772 E = 0, v.length = 0, m = !1, A() 11773 } 11774 11775 function M() { 11776 L() 11777 } 11778 11779 function _() { 11780 D(), c = setTimeout(function() { 11781 c = 0, O() 11782 }, e.vmouse.resetTimerDuration) 11783 } 11784 11785 function D() { 11786 c && (clearTimeout(c), c = 0) 11787 } 11788 11789 function P(t, n, r) { 11790 var i; 11791 if (r && r[t] || !r && k(n.target, t)) i = N(n, t), e(n.target).trigger(i); 11792 return i 11793 } 11794 11795 function H(t) { 11796 var n = e.data(t.target, s), 11797 r; 11798 !m && (!E || E !== n) && (r = P("v" + t.type, t), r && (r.isDefaultPrevented() && t.preventDefault(), r.isPropagationStopped() && t.stopPropagation(), r.isImmediatePropagationStopped() && t.stopImmediatePropagation())) 11799 } 11800 11801 function B(t) { 11802 var n = T(t).touches, 11803 r, i, o; 11804 n && n.length === 1 && (r = t.target, i = C(r), i.hasVirtualBinding && (E = w++, e.data(r, s, E), D(), M(), d = !1, o = T(t).touches[0], h = o.pageX, p = o.pageY, P("vmouseover", t, i), P("vmousedown", t, i))) 11805 } 11806 11807 function j(e) { 11808 if (g) return; 11809 d || P("vmousecancel", e, C(e.target)), d = !0, _() 11810 } 11811 11812 function F(t) { 11813 if (g) return; 11814 var n = T(t).touches[0], 11815 r = d, 11816 i = e.vmouse.moveDistanceThreshold, 11817 s = C(t.target);
vendor: 8,014 bytes, lines 11818-12044
11818 d = d || Math.abs(n.pageX - h) > i || Math.abs(n.pageY - p) > i, d && !r && P("vmousecancel", t, s), P("vmousemove", t, s), _() 11819 } 11820 11821 function I(e) { 11822 if (g) return; 11823 A(); 11824 var t = C(e.target), 11825 n, r; 11826 P("vmouseup", e, t), d || (n = P("vclick", e, t), n && n.isDefaultPrevented() && (r = T(e).changedTouches[0], v.push({ 11827 touchID: E, 11828 x: r.clientX, 11829 y: r.clientY 11830 }), m = !0)), P("vmouseout", e, t), d = !1, _() 11831 } 11832 11833 function q(t) { 11834 var n = e.data(t, i), 11835 r; 11836 if (n) 11837 for (r in n) 11838 if (n[r]) return !0; 11839 return !1 11840 } 11841 11842 function R() {} 11843 11844 function U(t) { 11845 var n = t.substr(1); 11846 return { 11847 setup: function() { 11848 q(this) || e.data(this, i, {}); 11849 var r = e.data(this, i); 11850 r[t] = !0, l[t] = (l[t] || 0) + 1, l[t] === 1 && b.bind(n, H), e(this).bind(n, R), y && (l.touchstart = (l.touchstart || 0) + 1, l.touchstart === 1 && b.bind("touchstart", B).bind("touchend", I).bind("touchmove", F).bind("scroll", j)) 11851 }, 11852 teardown: function() { 11853 --l[t], l[t] || b.unbind(n, H), y && (--l.touchstart, l.touchstart || b.unbind("touchstart", B).unbind("touchmove", F).unbind("touchend", I).unbind("scroll", j)); 11854 var r = e(this), 11855 s = e.data(this, i); 11856 s && (s[t] = !1), r.unbind(n, R), q(this) || r.removeData(i) 11857 } 11858 } 11859 } 11860 var i = "virtualMouseBindings", 11861 s = "virtualTouchID", 11862 o = "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "), 11863 u = "clientX clientY pageX pageY screenX screenY".split(" "), 11864 a = e.event.mouseHooks ? e.event.mouseHooks.props : [], 11865 f = e.event.props.concat(a), 11866 l = {}, 11867 c = 0, 11868 h = 0, 11869 p = 0, 11870 d = !1, 11871 v = [], 11872 m = !1, 11873 g = !1, 11874 y = "addEventListener" in n, 11875 b = e(n), 11876 w = 1, 11877 E = 0, 11878 S, x; 11879 e.vmouse = { 11880 moveDistanceThreshold: 10, 11881 clickDistanceThreshold: 10, 11882 resetTimerDuration: 1500 11883 }; 11884 for (x = 0; x < o.length; x++) e.event.special[o[x]] = U(o[x]); 11885 y && n.addEventListener("click", function(t) { 11886 var n = v.length, 11887 r = t.target, 11888 i, o, u, a, f, l; 11889 if (n) { 11890 i = t.clientX, o = t.clientY, S = e.vmouse.clickDistanceThreshold, u = r; 11891 while (u) { 11892 for (a = 0; a < n; a++) { 11893 f = v[a], l = 0; 11894 if (u === r && Math.abs(f.x - i) < S && Math.abs(f.y - o) < S || e.data(u, s) === f.touchID) { 11895 t.preventDefault(), t.stopPropagation(); 11896 return 11897 } 11898 } 11899 u = u.parentNode 11900 } 11901 } 11902 }, !0) 11903 })(e, t, n), 11904 function(e) { 11905 e.mobile = {} 11906 }(e), 11907 function(e, t) { 11908 var r = { 11909 touch: "ontouchend" in n 11910 }; 11911 e.mobile.support = e.mobile.support || {}, e.extend(e.support, r), e.extend(e.mobile.support, r) 11912 }(e), 11913 function(e, t, r) { 11914 function l(t, n, i, s) { 11915 var o = i.type; 11916 i.type = n, s ? e.event.trigger(i, r, t) : e.event.dispatch.call(t, i), i.type = o 11917 } 11918 var i = e(n), 11919 s = e.mobile.support.touch, 11920 o = "touchmove scroll", 11921 u = s ? "touchstart" : "mousedown", 11922 a = s ? "touchend" : "mouseup", 11923 f = s ? "touchmove" : "mousemove"; 11924 e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "), function(t, n) { 11925 e.fn[n] = function(e) { 11926 return e ? this.bind(n, e) : this.trigger(n) 11927 }, e.attrFn && (e.attrFn[n] = !0) 11928 }), e.event.special.scrollstart = { 11929 enabled: !0, 11930 setup: function() { 11931 function s(e, n) { 11932 r = n, l(t, r ? "scrollstart" : "scrollstop", e) 11933 } 11934 var t = this, 11935 n = e(t), 11936 r, i; 11937 n.bind(o, function(t) { 11938 if (!e.event.special.scrollstart.enabled) return; 11939 r || s(t, !0), clearTimeout(i), i = setTimeout(function() { 11940 s(t, !1) 11941 }, 50) 11942 }) 11943 }, 11944 teardown: function() { 11945 e(this).unbind(o) 11946 } 11947 }, e.event.special.tap = { 11948 tapholdThreshold: 750, 11949 emitTapOnTaphold: !0, 11950 setup: function() { 11951 var t = this, 11952 n = e(t), 11953 r = !1; 11954 n.bind("vmousedown", function(s) { 11955 function a() { 11956 clearTimeout(u) 11957 } 11958 11959 function f() { 11960 a(), n.unbind("vclick", c).unbind("vmouseup", a), i.unbind("vmousecancel", f) 11961 } 11962 11963 function c(e) { 11964 f(), !r && o === e.target ? l(t, "tap", e) : r && e.preventDefault() 11965 } 11966 r = !1; 11967 if (s.which && s.which !== 1) return !1; 11968 var o = s.target, 11969 u; 11970 n.bind("vmouseup", a).bind("vclick", c), i.bind("vmousecancel", f), u = setTimeout(function() { 11971 e.event.special.tap.emitTapOnTaphold || (r = !0), l(t, "taphold", e.Event("taphold", { 11972 target: o 11973 })) 11974 }, e.event.special.tap.tapholdThreshold) 11975 }) 11976 }, 11977 teardown: function() { 11978 e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"), i.unbind("vmousecancel") 11979 } 11980 }, e.event.special.swipe = { 11981 scrollSupressionThreshold: 30, 11982 durationThreshold: 1e3, 11983 horizontalDistanceThreshold: 30, 11984 verticalDistanceThreshold: 30, 11985 getLocation: function(e) { 11986 var n = t.pageXOffset, 11987 r = t.pageYOffset, 11988 i = e.clientX, 11989 s = e.clientY; 11990 if (e.pageY === 0 && Math.floor(s) > Math.floor(e.pageY) || e.pageX === 0 && Math.floor(i) > Math.floor(e.pageX)) i -= n, s -= r; 11991 else if (s < e.pageY - r || i < e.pageX - n) i = e.pageX - n, s = e.pageY - r; 11992 return { 11993 x: i, 11994 y: s 11995 } 11996 }, 11997 start: function(t) { 11998 var n = t.originalEvent.touches ? t.originalEvent.touches[0] : t, 11999 r = e.event.special.swipe.getLocation(n); 12000 return { 12001 time: (new Date).getTime(), 12002 coords: [r.x, r.y], 12003 origin: e(t.target) 12004 } 12005 }, 12006 stop: function(t) { 12007 var n = t.originalEvent.touches ? t.originalEvent.touches[0] : t, 12008 r = e.event.special.swipe.getLocation(n); 12009 return { 12010 time: (new Date).getTime(), 12011 coords: [r.x, r.y] 12012 } 12013 }, 12014 handleSwipe: function(t, n, r, i) { 12015 if (n.time - t.time < e.event.special.swipe.durationThreshold && Math.abs(t.coords[0] - n.coords[0]) > e.event.special.swipe.horizontalDistanceThreshold && Math.abs(t.coords[1] - n.coords[1]) < e.event.special.swipe.verticalDistanceThreshold) { 12016 var s = t.coords[0] > n.coords[0] ? "swipeleft" : "swiperight"; 12017 return l(r, "swipe", e.Event("swipe", { 12018 target: i, 12019 swipestart: t, 12020 swipestop: n 12021 }), !0), l(r, s, e.Event(s, { 12022 target: i, 12023 swipestart: t, 12024 swipestop: n 12025 }), !0), !0 12026 } 12027 return !1 12028 }, 12029 eventInProgress: !1, 12030 setup: function() { 12031 var t, n = this, 12032 r = e(n), 12033 s = {}; 12034 t = e.data(this, "mobile-events"), t || (t = { 12035 length: 0 12036 }, e.data(this, "mobile-events", t)), t.length++, t.swipe = s, s.start = function(t) { 12037 if (e.event.special.swipe.eventInProgress) return; 12038 e.event.special.swipe.eventInProgress = !0; 12039 var r, o = e.event.special.swipe.start(t), 12040 u = t.target, 12041 l = !1; 12042 s.move = function(t) { 12043 if (!o || t.isDefaultPrevented()) return; 12044 r = e.event.special.swipe.stop(t), l || (l = e.event.special.swipe.handleSwipe(o, r, n, u), l && (e.event.special.swipe.eventInProgress = !1)), Math.abs(o.coords[0] - r.co
vendor: 29,410 bytes, lines 12044-13294
12044ords[0]) > e.event.special.swipe.scrollSupressionThreshold && t.preventDefault() 12045 }, s.stop = function() { 12046 l = !0, e.event.special.swipe.eventInProgress = !1, i.off(f, s.move), s.move = null 12047 }, i.on(f, s.move).one(a, s.stop) 12048 }, r.on(u, s.start) 12049 }, 12050 teardown: function() { 12051 var t, n; 12052 t = e.data(this, "mobile-events"), t && (n = t.swipe, delete t.swipe, t.length--, t.length === 0 && e.removeData(this, "mobile-events")), n && (n.start && e(this).off(u, n.start), n.move && i.off(f, n.move), n.stop && i.off(a, n.stop)) 12053 } 12054 }, e.each({ 12055 scrollstop: "scrollstart", 12056 taphold: "tap", 12057 swipeleft: "swipe.left", 12058 swiperight: "swipe.right" 12059 }, function(t, n) { 12060 e.event.special[t] = { 12061 setup: function() { 12062 e(this).bind(n, e.noop) 12063 }, 12064 teardown: function() { 12065 e(this).unbind(n) 12066 } 12067 } 12068 }) 12069 }(e, this) 12070});; 12071/*! Magnific Popup - v1.1.0 - 2016-02-20 12072* http://dimsemenov.com/plugins/magnific-popup/ 12073* Copyright (c) 2016 Dmitry Semenov; */ 12074;(function (factory) { 12075if (typeof define === 'function' && define.amd) { 12076 // AMD. Register as an anonymous module. 12077 define(['jquery'], factory); 12078 } else if (typeof exports === 'object') { 12079 // Node/CommonJS 12080 factory(require('jquery')); 12081 } else { 12082 // Browser globals 12083 factory(window.jQuery || window.Zepto); 12084 } 12085 }(function($) { 12086 12087/*>>core*/ 12088/** 12089 * 12090 * Magnific Popup Core JS file 12091 * 12092 */ 12093 12094 12095/** 12096 * Private static constants 12097 */ 12098var CLOSE_EVENT = 'Close', 12099 BEFORE_CLOSE_EVENT = 'BeforeClose', 12100 AFTER_CLOSE_EVENT = 'AfterClose', 12101 BEFORE_APPEND_EVENT = 'BeforeAppend', 12102 MARKUP_PARSE_EVENT = 'MarkupParse', 12103 OPEN_EVENT = 'Open', 12104 CHANGE_EVENT = 'Change', 12105 NS = 'mfp', 12106 EVENT_NS = '.' + NS, 12107 READY_CLASS = 'mfp-ready', 12108 REMOVING_CLASS = 'mfp-removing', 12109 PREVENT_CLOSE_CLASS = 'mfp-prevent-close'; 12110 12111 12112/** 12113 * Private vars 12114 */ 12115/*jshint -W079 */ 12116var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this' 12117 MagnificPopup = function(){}, 12118 _isJQ = !!(window.jQuery), 12119 _prevStatus, 12120 _window = $(window), 12121 _document, 12122 _prevContentType, 12123 _wrapClasses, 12124 _currPopupType; 12125 12126 12127/** 12128 * Private functions 12129 */ 12130var _mfpOn = function(name, f) { 12131 mfp.ev.on(NS + name + EVENT_NS, f); 12132 }, 12133 _getEl = function(className, appendTo, html, raw) { 12134 var el = document.createElement('div'); 12135 el.className = 'mfp-'+className; 12136 if(html) { 12137 el.innerHTML = html; 12138 } 12139 if(!raw) { 12140 el = $(el); 12141 if(appendTo) { 12142 el.appendTo(appendTo); 12143 } 12144 } else if(appendTo) { 12145 appendTo.appendChild(el); 12146 } 12147 return el; 12148 }, 12149 _mfpTrigger = function(e, data) { 12150 mfp.ev.triggerHandler(NS + e, data); 12151 12152 if(mfp.st.callbacks) { 12153 // converts "mfpEventName" to "eventName" callback and triggers it if it's present 12154 e = e.charAt(0).toLowerCase() + e.slice(1); 12155 if(mfp.st.callbacks[e]) { 12156 mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]); 12157 } 12158 } 12159 }, 12160 _getCloseBtn = function(type) { 12161 if(type !== _currPopupType || !mfp.currTemplate.closeBtn) { 12162 mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) ); 12163 _currPopupType = type; 12164 } 12165 return mfp.currTemplate.closeBtn; 12166 }, 12167 // Initialize Magnific Popup only when called at least once 12168 _checkInstance = function() { 12169 if(!$.magnificPopup.instance) { 12170 /*jshint -W020 */ 12171 mfp = new MagnificPopup(); 12172 mfp.init(); 12173 $.magnificPopup.instance = mfp; 12174 } 12175 }, 12176 // CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr 12177 supportsTransitions = function() { 12178 var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist 12179 v = ['ms','O','Moz','Webkit']; // 'v' for vendor 12180 12181 if( s['transition'] !== undefined ) { 12182 return true; 12183 } 12184 12185 while( v.length ) { 12186 if( v.pop() + 'Transition' in s ) { 12187 return true; 12188 } 12189 } 12190 12191 return false; 12192 }; 12193 12194 12195 12196/** 12197 * Public functions 12198 */ 12199MagnificPopup.prototype = { 12200 12201 constructor: MagnificPopup, 12202 12203 /** 12204 * Initializes Magnific Popup plugin. 12205 * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed 12206 */ 12207 init: function() { 12208 var appVersion = navigator.appVersion; 12209 mfp.isLowIE = mfp.isIE8 = document.all && !document.addEventListener; 12210 mfp.isAndroid = (/android/gi).test(appVersion); 12211 mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion); 12212 mfp.supportsTransition = supportsTransitions(); 12213 12214 // We disable fixed positioned lightbox on devices that don't handle it nicely. 12215 // If you know a better way of detecting this - let me know. 12216 mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) ); 12217 _document = $(document); 12218 12219 mfp.popupsCache = {}; 12220 }, 12221 12222 /** 12223 * Opens popup 12224 * @param data [description] 12225 */ 12226 open: function(data) { 12227 12228 var i; 12229 12230 if(data.isObj === false) { 12231 // convert jQuery collection to array to avoid conflicts later 12232 mfp.items = data.items.toArray(); 12233 12234 mfp.index = 0; 12235 var items = data.items, 12236 item; 12237 for(i = 0; i < items.length; i++) { 12238 item = items[i]; 12239 if(item.parsed) { 12240 item = item.el[0]; 12241 } 12242 if(item === data.el[0]) { 12243 mfp.index = i; 12244 break; 12245 } 12246 } 12247 } else { 12248 mfp.items = $.isArray(data.items) ? data.items : [data.items]; 12249 mfp.index = data.index || 0; 12250 } 12251 12252 // if popup is already opened - we just update the content 12253 if(mfp.isOpen) { 12254 mfp.updateItemHTML(); 12255 return; 12256 } 12257 12258 mfp.types = []; 12259 _wrapClasses = ''; 12260 if(data.mainEl && data.mainEl.length) { 12261 mfp.ev = data.mainEl.eq(0); 12262 } else { 12263 mfp.ev = _document; 12264 } 12265 12266 if(data.key) { 12267 if(!mfp.popupsCache[data.key]) { 12268 mfp.popupsCache[data.key] = {}; 12269 } 12270 mfp.currTemplate = mfp.popupsCache[data.key]; 12271 } else { 12272 mfp.currTemplate = {}; 12273 } 12274 12275 12276 12277 mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data ); 12278 mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos; 12279 12280 if(mfp.st.modal) { 12281 mfp.st.closeOnContentClick = false; 12282 mfp.st.closeOnBgClick = false; 12283 mfp.st.showCloseBtn = false; 12284 mfp.st.enableEscapeKey = false; 12285 } 12286 12287 12288 // Building markup 12289 // main containers are created only once 12290 if(!mfp.bgOverlay) { 12291 12292 // Dark overlay 12293 mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() { 12294 mfp.close(); 12295 }); 12296 12297 mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) { 12298 if(mfp._checkIfClose(e.target)) { 12299 mfp.close(); 12300 } 12301 }); 12302 12303 mfp.container = _getEl('container', mfp.wrap); 12304 } 12305 12306 mfp.contentContainer = _getEl('content'); 12307 if(mfp.st.preloader) { 12308 mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading); 12309 } 12310 12311 12312 // Initializing modules 12313 var modules = $.magnificPopup.modules; 12314 for(i = 0; i < modules.length; i++) { 12315 var n = modules[i]; 12316 n = n.charAt(0).toUpperCase() + n.slice(1); 12317 mfp['init'+n].call(mfp); 12318 } 12319 _mfpTrigger('BeforeOpen'); 12320 12321 12322 if(mfp.st.showCloseBtn) { 12323 // Close button 12324 if(!mfp.st.closeBtnInside) { 12325 mfp.wrap.append( _getCloseBtn() ); 12326 } else { 12327 _mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) { 12328 values.close_replaceWith = _getCloseBtn(item.type); 12329 }); 12330 _wrapClasses += ' mfp-close-btn-in'; 12331 } 12332 } 12333 12334 if(mfp.st.alignTop) { 12335 _wrapClasses += ' mfp-align-top'; 12336 } 12337 12338 12339 12340 if(mfp.fixedContentPos) { 12341 mfp.wrap.css({ 12342 overflow: mfp.st.overflowY, 12343 overflowX: 'hidden', 12344 overflowY: mfp.st.overflowY 12345 }); 12346 } else { 12347 mfp.wrap.css({ 12348 top: _window.scrollTop(), 12349 position: 'absolute' 12350 }); 12351 } 12352 if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) { 12353 mfp.bgOverlay.css({ 12354 height: _document.height(), 12355 position: 'absolute' 12356 }); 12357 } 12358 12359 12360 12361 if(mfp.st.enableEscapeKey) { 12362 // Close on ESC key 12363 _document.on('keyup' + EVENT_NS, function(e) { 12364 if(e.keyCode === 27) { 12365 mfp.close(); 12366 } 12367 }); 12368 } 12369 12370 _window.on('resize' + EVENT_NS, function() { 12371 mfp.updateSize(); 12372 }); 12373 12374 12375 if(!mfp.st.closeOnContentClick) { 12376 _wrapClasses += ' mfp-auto-cursor'; 12377 } 12378 12379 if(_wrapClasses) 12380 mfp.wrap.addClass(_wrapClasses); 12381 12382 12383 // this triggers recalculation of layout, so we get it once to not to trigger twice 12384 var windowHeight = mfp.wH = _window.height(); 12385 12386 12387 var windowStyles = {}; 12388 12389 if( mfp.fixedContentPos ) { 12390 if(mfp._hasScrollBar(windowHeight)){ 12391 var s = mfp._getScrollbarSize(); 12392 if(s) { 12393 windowStyles.marginRight = s; 12394 } 12395 } 12396 } 12397 12398 if(mfp.fixedContentPos) { 12399 if(!mfp.isIE7) { 12400 windowStyles.overflow = 'hidden'; 12401 } else { 12402 // ie7 double-scroll bug 12403 $('body, html').css('overflow', 'hidden'); 12404 } 12405 } 12406 12407 12408 12409 var classesToadd = mfp.st.mainClass; 12410 if(mfp.isIE7) { 12411 classesToadd += ' mfp-ie7'; 12412 } 12413 if(classesToadd) { 12414 mfp._addClassToMFP( classesToadd ); 12415 } 12416 12417 // add content 12418 mfp.updateItemHTML(); 12419 12420 _mfpTrigger('BuildControls'); 12421 12422 // remove scrollbar, add margin e.t.c 12423 $('html').css(windowStyles); 12424 12425 // add everything to DOM 12426 mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || $(document.body) ); 12427 12428 // Save last focused element 12429 mfp._lastFocusedEl = document.activeElement; 12430 12431 // Wait for next cycle to allow CSS transition 12432 setTimeout(function() { 12433 12434 if(mfp.content) { 12435 mfp._addClassToMFP(READY_CLASS); 12436 mfp._setFocus(); 12437 } else { 12438 // if content is not defined (not loaded e.t.c) we add class only for BG 12439 mfp.bgOverlay.addClass(READY_CLASS); 12440 } 12441 12442 // Trap the focus in popup 12443 _document.on('focusin' + EVENT_NS, mfp._onFocusIn); 12444 12445 }, 16); 12446 12447 mfp.isOpen = true; 12448 mfp.updateSize(windowHeight); 12449 _mfpTrigger(OPEN_EVENT); 12450 12451 return data; 12452 }, 12453 12454 /** 12455 * Closes the popup 12456 */ 12457 close: function() { 12458 if(!mfp.isOpen) return; 12459 _mfpTrigger(BEFORE_CLOSE_EVENT); 12460 12461 mfp.isOpen = false; 12462 // for CSS3 animation 12463 if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition ) { 12464 mfp._addClassToMFP(REMOVING_CLASS); 12465 setTimeout(function() { 12466 mfp._close(); 12467 }, mfp.st.removalDelay); 12468 } else { 12469 mfp._close(); 12470 } 12471 }, 12472 12473 /** 12474 * Helper for close() function 12475 */ 12476 _close: function() { 12477 _mfpTrigger(CLOSE_EVENT); 12478 12479 var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' '; 12480 12481 mfp.bgOverlay.detach(); 12482 mfp.wrap.detach(); 12483 mfp.container.empty(); 12484 12485 if(mfp.st.mainClass) { 12486 classesToRemove += mfp.st.mainClass + ' '; 12487 } 12488 12489 mfp._removeClassFromMFP(classesToRemove); 12490 12491 if(mfp.fixedContentPos) { 12492 var windowStyles = {marginRight: ''}; 12493 if(mfp.isIE7) { 12494 $('body, html').css('overflow', ''); 12495 } else { 12496 windowStyles.overflow = ''; 12497 } 12498 $('html').css(windowStyles); 12499 } 12500 12501 _document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS); 12502 mfp.ev.off(EVENT_NS); 12503 12504 // clean up DOM elements that aren't removed 12505 mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style'); 12506 mfp.bgOverlay.attr('class', 'mfp-bg'); 12507 mfp.container.attr('class', 'mfp-container'); 12508 12509 // remove close button from target element 12510 if(mfp.st.showCloseBtn && 12511 (!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) { 12512 if(mfp.currTemplate.closeBtn) 12513 mfp.currTemplate.closeBtn.detach(); 12514 } 12515 12516 12517 if(mfp.st.autoFocusLast && mfp._lastFocusedEl) { 12518 $(mfp._lastFocusedEl).focus(); // put tab focus back 12519 } 12520 mfp.currItem = null; 12521 mfp.content = null; 12522 mfp.currTemplate = null; 12523 mfp.prevHeight = 0; 12524 12525 _mfpTrigger(AFTER_CLOSE_EVENT); 12526 }, 12527 12528 updateSize: function(winHeight) { 12529 12530 if(mfp.isIOS) { 12531 // fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2 12532 var zoomLevel = document.documentElement.clientWidth / window.innerWidth; 12533 var height = window.innerHeight * zoomLevel; 12534 mfp.wrap.css('height', height); 12535 mfp.wH = height; 12536 } else { 12537 mfp.wH = winHeight || _window.height(); 12538 } 12539 // Fixes #84: popup incorrectly positioned with position:relative on body 12540 if(!mfp.fixedContentPos) { 12541 mfp.wrap.css('height', mfp.wH); 12542 } 12543 12544 _mfpTrigger('Resize'); 12545 12546 }, 12547 12548 /** 12549 * Set content of popup based on current index 12550 */ 12551 updateItemHTML: function() { 12552 var item = mfp.items[mfp.index]; 12553 12554 // Detach and perform modifications 12555 mfp.contentContainer.detach(); 12556 12557 if(mfp.content) 12558 mfp.content.detach(); 12559 12560 if(!item.parsed) { 12561 item = mfp.parseEl( mfp.index ); 12562 } 12563 12564 var type = item.type; 12565 12566 _mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]); 12567 // BeforeChange event works like so: 12568 // _mfpOn('BeforeChange', function(e, prevType, newType) { }); 12569 12570 mfp.currItem = item; 12571 12572 if(!mfp.currTemplate[type]) { 12573 var markup = mfp.st[type] ? mfp.st[type].markup : false; 12574 12575 // allows to modify markup 12576 _mfpTrigger('FirstMarkupParse', markup); 12577 12578 if(markup) { 12579 mfp.currTemplate[type] = $(markup); 12580 } else { 12581 // if there is no markup found we just define that template is parsed 12582 mfp.currTemplate[type] = true; 12583 } 12584 } 12585 12586 if(_prevContentType && _prevContentType !== item.type) { 12587 mfp.container.removeClass('mfp-'+_prevContentType+'-holder'); 12588 } 12589 12590 var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]); 12591 mfp.appendContent(newContent, type); 12592 12593 item.preloaded = true; 12594 12595 _mfpTrigger(CHANGE_EVENT, item); 12596 _prevContentType = item.type; 12597 12598 // Append container back after its content changed 12599 mfp.container.prepend(mfp.contentContainer); 12600 12601 _mfpTrigger('AfterChange'); 12602 }, 12603 12604 12605 /** 12606 * Set HTML content of popup 12607 */ 12608 appendContent: function(newContent, type) { 12609 mfp.content = newContent; 12610 12611 if(newContent) { 12612 if(mfp.st.showCloseBtn && mfp.st.closeBtnInside && 12613 mfp.currTemplate[type] === true) { 12614 // if there is no markup, we just append close button element inside 12615 if(!mfp.content.find('.mfp-close').length) { 12616 mfp.content.append(_getCloseBtn()); 12617 } 12618 } else { 12619 mfp.content = newContent; 12620 } 12621 } else { 12622 mfp.content = ''; 12623 } 12624 12625 _mfpTrigger(BEFORE_APPEND_EVENT); 12626 mfp.container.addClass('mfp-'+type+'-holder'); 12627 12628 mfp.contentContainer.append(mfp.content); 12629 }, 12630 12631 12632 /** 12633 * Creates Magnific Popup data object based on given data 12634 * @param {int} index Index of item to parse 12635 */ 12636 parseEl: function(index) { 12637 var item = mfp.items[index], 12638 type; 12639 12640 if(item.tagName) { 12641 item = { el: $(item) }; 12642 } else { 12643 type = item.type; 12644 item = { data: item, src: item.src }; 12645 } 12646 12647 if(item.el) { 12648 var types = mfp.types; 12649 12650 // check for 'mfp-TYPE' class 12651 for(var i = 0; i < types.length; i++) { 12652 if( item.el.hasClass('mfp-'+types[i]) ) { 12653 type = types[i]; 12654 break; 12655 } 12656 } 12657 12658 item.src = item.el.attr('data-mfp-src'); 12659 if(!item.src) { 12660 item.src = item.el.attr('href'); 12661 } 12662 } 12663 12664 item.type = type || mfp.st.type || 'inline'; 12665 item.index = index; 12666 item.parsed = true; 12667 mfp.items[index] = item; 12668 _mfpTrigger('ElementParse', item); 12669 12670 return mfp.items[index]; 12671 }, 12672 12673 12674 /** 12675 * Initializes single popup or a group of popups 12676 */ 12677 addGroup: function(el, options) { 12678 var eHandler = function(e) { 12679 e.mfpEl = this; 12680 mfp._openClick(e, el, options); 12681 }; 12682 12683 if(!options) { 12684 options = {}; 12685 } 12686 12687 var eName = 'click.magnificPopup'; 12688 options.mainEl = el; 12689 12690 if(options.items) { 12691 options.isObj = true; 12692 el.off(eName).on(eName, eHandler); 12693 } else { 12694 options.isObj = false; 12695 if(options.delegate) { 12696 el.off(eName).on(eName, options.delegate , eHandler); 12697 } else { 12698 options.items = el; 12699 el.off(eName).on(eName, eHandler); 12700 } 12701 } 12702 }, 12703 _openClick: function(e, el, options) { 12704 var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick; 12705 12706 12707 if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey ) ) { 12708 return; 12709 } 12710 12711 var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn; 12712 12713 if(disableOn) { 12714 if($.isFunction(disableOn)) { 12715 if( !disableOn.call(mfp) ) { 12716 return true; 12717 } 12718 } else { // else it's number 12719 if( _window.width() < disableOn ) { 12720 return true; 12721 } 12722 } 12723 } 12724 12725 if(e.type) { 12726 e.preventDefault(); 12727 12728 // This will prevent popup from closing if element is inside and popup is already opened 12729 if(mfp.isOpen) { 12730 e.stopPropagation(); 12731 } 12732 } 12733 12734 options.el = $(e.mfpEl); 12735 if(options.delegate) { 12736 options.items = el.find(options.delegate); 12737 } 12738 mfp.open(options); 12739 }, 12740 12741 12742 /** 12743 * Updates text on preloader 12744 */ 12745 updateStatus: function(status, text) { 12746 12747 if(mfp.preloader) { 12748 if(_prevStatus !== status) { 12749 mfp.container.removeClass('mfp-s-'+_prevStatus); 12750 } 12751 12752 if(!text && status === 'loading') { 12753 text = mfp.st.tLoading; 12754 } 12755 12756 var data = { 12757 status: status, 12758 text: text 12759 }; 12760 // allows to modify status 12761 _mfpTrigger('UpdateStatus', data); 12762 12763 status = data.status; 12764 text = data.text; 12765 12766 mfp.preloader.html(text); 12767 12768 mfp.preloader.find('a').on('click', function(e) { 12769 e.stopImmediatePropagation(); 12770 }); 12771 12772 mfp.container.addClass('mfp-s-'+status); 12773 _prevStatus = status; 12774 } 12775 }, 12776 12777 12778 /* 12779 "Private" helpers that aren't private at all 12780 */ 12781 // Check to close popup or not 12782 // "target" is an element that was clicked 12783 _checkIfClose: function(target) { 12784 12785 if($(target).hasClass(PREVENT_CLOSE_CLASS)) { 12786 return; 12787 } 12788 12789 var closeOnContent = mfp.st.closeOnContentClick; 12790 var closeOnBg = mfp.st.closeOnBgClick; 12791 12792 if(closeOnContent && closeOnBg) { 12793 return true; 12794 } else { 12795 12796 // We close the popup if click is on close button or on preloader. Or if there is no content. 12797 if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) { 12798 return true; 12799 } 12800 12801 // if click is outside the content 12802 if( (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) { 12803 if(closeOnBg) { 12804 // last check, if the clicked element is in DOM, (in case it's removed onclick) 12805 if( $.contains(document, target) ) { 12806 return true; 12807 } 12808 } 12809 } else if(closeOnContent) { 12810 return true; 12811 } 12812 12813 } 12814 return false; 12815 }, 12816 _addClassToMFP: function(cName) { 12817 mfp.bgOverlay.addClass(cName); 12818 mfp.wrap.addClass(cName); 12819 }, 12820 _removeClassFromMFP: function(cName) { 12821 this.bgOverlay.removeClass(cName); 12822 mfp.wrap.removeClass(cName); 12823 }, 12824 _hasScrollBar: function(winHeight) { 12825 return ( (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) ); 12826 }, 12827 _setFocus: function() { 12828 (mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus(); 12829 }, 12830 _onFocusIn: function(e) { 12831 if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) { 12832 mfp._setFocus(); 12833 return false; 12834 } 12835 }, 12836 _parseMarkup: function(template, values, item) { 12837 var arr; 12838 if(item.data) { 12839 values = $.extend(item.data, values); 12840 } 12841 _mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] ); 12842 12843 $.each(values, function(key, value) { 12844 if(value === undefined || value === false) { 12845 return true; 12846 } 12847 arr = key.split('_'); 12848 if(arr.length > 1) { 12849 var el = template.find(EVENT_NS + '-'+arr[0]); 12850 12851 if(el.length > 0) { 12852 var attr = arr[1]; 12853 if(attr === 'replaceWith') { 12854 if(el[0] !== value[0]) { 12855 el.replaceWith(value); 12856 } 12857 } else if(attr === 'img') { 12858 if(el.is('img')) { 12859 el.attr('src', value); 12860 } else { 12861 el.replaceWith( $('<img>').attr('src', value).attr('class', el.attr('class')) ); 12862 } 12863 } else { 12864 el.attr(arr[1], value); 12865 } 12866 } 12867 12868 } else { 12869 template.find(EVENT_NS + '-'+key).html(value); 12870 } 12871 }); 12872 }, 12873 12874 _getScrollbarSize: function() { 12875 // thx David 12876 if(mfp.scrollbarSize === undefined) { 12877 var scrollDiv = document.createElement("div"); 12878 scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;'; 12879 document.body.appendChild(scrollDiv); 12880 mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth; 12881 document.body.removeChild(scrollDiv); 12882 } 12883 return mfp.scrollbarSize; 12884 } 12885 12886}; /* MagnificPopup core prototype end */ 12887 12888 12889 12890 12891/** 12892 * Public static functions 12893 */ 12894$.magnificPopup = { 12895 instance: null, 12896 proto: MagnificPopup.prototype, 12897 modules: [], 12898 12899 open: function(options, index) { 12900 _checkInstance(); 12901 12902 if(!options) { 12903 options = {}; 12904 } else { 12905 options = $.extend(true, {}, options); 12906 } 12907 12908 options.isObj = true; 12909 options.index = index || 0; 12910 return this.instance.open(options); 12911 }, 12912 12913 close: function() { 12914 return $.magnificPopup.instance && $.magnificPopup.instance.close(); 12915 }, 12916 12917 registerModule: function(name, module) { 12918 if(module.options) { 12919 $.magnificPopup.defaults[name] = module.options; 12920 } 12921 $.extend(this.proto, module.proto); 12922 this.modules.push(name); 12923 }, 12924 12925 defaults: { 12926 12927 // Info about options is in docs: 12928 // http://dimsemenov.com/plugins/magnific-popup/documentation.html#options 12929 12930 disableOn: 0, 12931 12932 key: null, 12933 12934 midClick: false, 12935 12936 mainClass: '', 12937 12938 preloader: true, 12939 12940 focus: '', // CSS selector of input to focus after popup is opened 12941 12942 closeOnContentClick: false, 12943 12944 closeOnBgClick: true, 12945 12946 closeBtnInside: true, 12947 12948 showCloseBtn: true, 12949 12950 enableEscapeKey: true, 12951 12952 modal: false, 12953 12954 alignTop: false, 12955 12956 removalDelay: 0, 12957 12958 prependTo: null, 12959 12960 fixedContentPos: 'auto', 12961 12962 fixedBgPos: 'auto', 12963 12964 overflowY: 'auto', 12965 12966 closeMarkup: '<button title="%title%" type="button" class="mfp-close">×</button>', 12967 12968 tClose: 'Close (Esc)', 12969 12970 tLoading: 'Loading...', 12971 12972 autoFocusLast: true 12973 12974 } 12975}; 12976 12977 12978 12979$.fn.magnificPopup = function(options) { 12980 _checkInstance(); 12981 12982 var jqEl = $(this); 12983 12984 // We call some API method of first param is a string 12985 if (typeof options === "string" ) { 12986 12987 if(options === 'open') { 12988 var items, 12989 itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup, 12990 index = parseInt(arguments[1], 10) || 0; 12991 12992 if(itemOpts.items) { 12993 items = itemOpts.items[index]; 12994 } else { 12995 items = jqEl; 12996 if(itemOpts.delegate) { 12997 items = items.find(itemOpts.delegate); 12998 } 12999 items = items.eq( index ); 13000 } 13001 mfp._openClick({mfpEl:items}, jqEl, itemOpts); 13002 } else { 13003 if(mfp.isOpen) 13004 mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1)); 13005 } 13006 13007 } else { 13008 // clone options obj 13009 options = $.extend(true, {}, options); 13010 13011 /* 13012 * As Zepto doesn't support .data() method for objects 13013 * and it works only in normal browsers 13014 * we assign "options" object directly to the DOM element. FTW! 13015 */ 13016 if(_isJQ) { 13017 jqEl.data('magnificPopup', options); 13018 } else { 13019 jqEl[0].magnificPopup = options; 13020 } 13021 13022 mfp.addGroup(jqEl, options); 13023 13024 } 13025 return jqEl; 13026}; 13027 13028/*>>core*/ 13029 13030/*>>inline*/ 13031 13032var INLINE_NS = 'inline', 13033 _hiddenClass, 13034 _inlinePlaceholder, 13035 _lastInlineElement, 13036 _putInlineElementsBack = function() { 13037 if(_lastInlineElement) { 13038 _inlinePlaceholder.after( _lastInlineElement.addClass(_hiddenClass) ).detach(); 13039 _lastInlineElement = null; 13040 } 13041 }; 13042 13043$.magnificPopup.registerModule(INLINE_NS, { 13044 options: { 13045 hiddenClass: 'hide', // will be appended with `mfp-` prefix 13046 markup: '', 13047 tNotFound: 'Content not found' 13048 }, 13049 proto: { 13050 13051 initInline: function() { 13052 mfp.types.push(INLINE_NS); 13053 13054 _mfpOn(CLOSE_EVENT+'.'+INLINE_NS, function() { 13055 _putInlineElementsBack(); 13056 }); 13057 }, 13058 13059 getInline: function(item, template) { 13060 13061 _putInlineElementsBack(); 13062 13063 if(item.src) { 13064 var inlineSt = mfp.st.inline, 13065 el = $(item.src); 13066 13067 if(el.length) { 13068 13069 // If target element has parent - we replace it with placeholder and put it back after popup is closed 13070 var parent = el[0].parentNode; 13071 if(parent && parent.tagName) { 13072 if(!_inlinePlaceholder) { 13073 _hiddenClass = inlineSt.hiddenClass; 13074 _inlinePlaceholder = _getEl(_hiddenClass); 13075 _hiddenClass = 'mfp-'+_hiddenClass; 13076 } 13077 // replace target inline element with placeholder 13078 _lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass); 13079 } 13080 13081 mfp.updateStatus('ready'); 13082 } else { 13083 mfp.updateStatus('error', inlineSt.tNotFound); 13084 el = $('<div>'); 13085 } 13086 13087 item.inlineElement = el; 13088 return el; 13089 } 13090 13091 mfp.updateStatus('ready'); 13092 mfp._parseMarkup(template, {}, item); 13093 return template; 13094 } 13095 } 13096}); 13097 13098/*>>inline*/ 13099 13100/*>>ajax*/ 13101var AJAX_NS = 'ajax', 13102 _ajaxCur, 13103 _removeAjaxCursor = function() { 13104 if(_ajaxCur) { 13105 $(document.body).removeClass(_ajaxCur); 13106 } 13107 }, 13108 _destroyAjaxRequest = function() { 13109 _removeAjaxCursor(); 13110 if(mfp.req) { 13111 mfp.req.abort(); 13112 } 13113 }; 13114 13115$.magnificPopup.registerModule(AJAX_NS, { 13116 13117 options: { 13118 settings: null, 13119 cursor: 'mfp-ajax-cur', 13120 tError: '<a href="%url%">The content</a> could not be loaded.' 13121 }, 13122 13123 proto: { 13124 initAjax: function() { 13125 mfp.types.push(AJAX_NS); 13126 _ajaxCur = mfp.st.ajax.cursor; 13127 13128 _mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest); 13129 _mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest); 13130 }, 13131 getAjax: function(item) { 13132 13133 if(_ajaxCur) { 13134 $(document.body).addClass(_ajaxCur); 13135 } 13136 13137 mfp.updateStatus('loading'); 13138 13139 var opts = $.extend({ 13140 url: item.src, 13141 success: function(data, textStatus, jqXHR) { 13142 var temp = { 13143 data:data, 13144 xhr:jqXHR 13145 }; 13146 13147 _mfpTrigger('ParseAjax', temp); 13148 13149 mfp.appendContent( $(temp.data), AJAX_NS ); 13150 13151 item.finished = true; 13152 13153 _removeAjaxCursor(); 13154 13155 mfp._setFocus(); 13156 13157 setTimeout(function() { 13158 mfp.wrap.addClass(READY_CLASS); 13159 }, 16); 13160 13161 mfp.updateStatus('ready'); 13162 13163 _mfpTrigger('AjaxContentAdded'); 13164 }, 13165 error: function() { 13166 _removeAjaxCursor(); 13167 item.finished = item.loadError = true; 13168 mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src)); 13169 } 13170 }, mfp.st.ajax.settings); 13171 13172 mfp.req = $.ajax(opts); 13173 13174 return ''; 13175 } 13176 } 13177}); 13178 13179/*>>ajax*/ 13180 13181/*>>image*/ 13182var _imgInterval, 13183 _getTitle = function(item) { 13184 if(item.data && item.data.title !== undefined) 13185 return item.data.title; 13186 13187 var src = mfp.st.image.titleSrc; 13188 13189 if(src) { 13190 if($.isFunction(src)) { 13191 return src.call(mfp, item); 13192 } else if(item.el) { 13193 return item.el.attr(src) || ''; 13194 } 13195 } 13196 return ''; 13197 }; 13198 13199$.magnificPopup.registerModule('image', { 13200 13201 options: { 13202 markup: '<div class="mfp-figure">'+ 13203 '<div class="mfp-close"></div>'+ 13204 '<figure>'+ 13205 '<div class="mfp-img"></div>'+ 13206 '<figcaption>'+ 13207 '<div class="mfp-bottom-bar">'+ 13208 '<div class="mfp-title"></div>'+ 13209 '<div class="mfp-counter"></div>'+ 13210 '</div>'+ 13211 '</figcaption>'+ 13212 '</figure>'+ 13213 '</div>', 13214 cursor: 'mfp-zoom-out-cur', 13215 titleSrc: 'title', 13216 verticalFit: true, 13217 tError: '<a href="%url%">The image</a> could not be loaded.' 13218 }, 13219 13220 proto: { 13221 initImage: function() { 13222 var imgSt = mfp.st.image, 13223 ns = '.image'; 13224 13225 mfp.types.push('image'); 13226 13227 _mfpOn(OPEN_EVENT+ns, function() { 13228 if(mfp.currItem.type === 'image' && imgSt.cursor) { 13229 $(document.body).addClass(imgSt.cursor); 13230 } 13231 }); 13232 13233 _mfpOn(CLOSE_EVENT+ns, function() { 13234 if(imgSt.cursor) { 13235 $(document.body).removeClass(imgSt.cursor); 13236 } 13237 _window.off('resize' + EVENT_NS); 13238 }); 13239 13240 _mfpOn('Resize'+ns, mfp.resizeImage); 13241 if(mfp.isLowIE) { 13242 _mfpOn('AfterChange', mfp.resizeImage); 13243 } 13244 }, 13245 resizeImage: function() { 13246 var item = mfp.currItem; 13247 if(!item || !item.img) return; 13248 13249 if(mfp.st.image.verticalFit) { 13250 var decr = 0; 13251 // fix box-sizing in ie7/8 13252 if(mfp.isLowIE) { 13253 decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10); 13254 } 13255 item.img.css('max-height', mfp.wH-decr); 13256 } 13257 }, 13258 _onImageHasSize: function(item) { 13259 if(item.img) { 13260 13261 item.hasSize = true; 13262 13263 if(_imgInterval) { 13264 clearInterval(_imgInterval); 13265 } 13266 13267 item.isCheckingImgSize = false; 13268 13269 _mfpTrigger('ImageHasSize', item); 13270 13271 if(item.imgHidden) { 13272 if(mfp.content) 13273 mfp.content.removeClass('mfp-loading'); 13274 13275 item.imgHidden = false; 13276 } 13277 13278 } 13279 }, 13280 13281 /** 13282 * Function that loops until the image has size to display elements that rely on it asap 13283 */ 13284 findImageSize: function(item) { 13285 13286 var counter = 0, 13287 img = item.img[0], 13288 mfpSetInterval = function(delay) { 13289 13290 if(_imgInterval) { 13291 clearInterval(_imgInterval); 13292 } 13293 // decelerating interval that checks for size of an image 13294 _imgInterval = setInterval(function() {
13295 if(img.naturalWidth > 0) { 13296 mfp._onImageHasSize(item); 13297 return; 13298 } 13299 13300 if(counter > 200) { 13301 clearInterval(_imgInterval); 13302 } 13303 13304 counter++; 13305 if(counter === 3) { 13306 mfpSetInterval(10); 13307 } else if(counter === 40) { 13308 mfpSetInterval(50); 13309 } else if(counter === 100) { 13310 mfpSetInterval(500); 13311 } 13312 }, delay); 13313 }; 13314 13315 mfpSetInterval(1); 13316 }, 13317 13318 getImage: function(item, template) { 13319 13320 var guard = 0, 13321 13322 // image load complete handler 13323 onLoadComplete = function() { 13324 if(item) { 13325 if (item.img[0].complete) { 13326 item.img.off('.mfploader'); 13327 13328 if(item === mfp.currItem){ 13329 mfp._onImageHasSize(item); 13330 13331 mfp.updateStatus('ready'); 13332 } 13333 13334 item.hasSize = true; 13335 item.loaded = true; 13336 13337 _mfpTrigger('ImageLoadComplete'); 13338 13339 } 13340 else { 13341 // if image complete check fails 200 times (20 sec), we assume that there was an error. 13342 guard++; 13343 if(guard < 200) { 13344 setTimeout(onLoadComplete,100); 13345 } else { 13346 onLoadError(); 13347 } 13348 } 13349 } 13350 }, 13351 13352 // image error handler 13353 onLoadError = function() { 13354 if(item) { 13355 item.img.off('.mfploader'); 13356 if(item === mfp.currItem){ 13357 mfp._onImageHasSize(item); 13358 mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) ); 13359 } 13360 13361 item.hasSize = true; 13362 item.loaded = true; 13363 item.loadError = true; 13364 } 13365 }, 13366 imgSt = mfp.st.image; 13367 13368 13369 var el = template.find('.mfp-img'); 13370 if(el.length) { 13371 var img = document.createElement('img'); 13372 img.className = 'mfp-img'; 13373 if(item.el && item.el.find('img').length) { 13374 img.alt = item.el.find('img').attr('alt'); 13375 } 13376 item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError); 13377 img.src = item.src; 13378 13379 // without clone() "error" event is not firing when IMG is replaced by new IMG
vendor: 9,233 bytes, lines 13380-13775
13380 // TODO: find a way to avoid such cloning 13381 if(el.is('img')) { 13382 item.img = item.img.clone(); 13383 } 13384 13385 img = item.img[0]; 13386 if(img.naturalWidth > 0) { 13387 item.hasSize = true; 13388 } else if(!img.width) { 13389 item.hasSize = false; 13390 } 13391 } 13392 13393 mfp._parseMarkup(template, { 13394 title: _getTitle(item), 13395 img_replaceWith: item.img 13396 }, item); 13397 13398 mfp.resizeImage(); 13399 13400 if(item.hasSize) { 13401 if(_imgInterval) clearInterval(_imgInterval); 13402 13403 if(item.loadError) { 13404 template.addClass('mfp-loading'); 13405 mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) ); 13406 } else { 13407 template.removeClass('mfp-loading'); 13408 mfp.updateStatus('ready'); 13409 } 13410 return template; 13411 } 13412 13413 mfp.updateStatus('loading'); 13414 item.loading = true; 13415 13416 if(!item.hasSize) { 13417 item.imgHidden = true; 13418 template.addClass('mfp-loading'); 13419 mfp.findImageSize(item); 13420 } 13421 13422 return template; 13423 } 13424 } 13425}); 13426 13427/*>>image*/ 13428 13429/*>>zoom*/ 13430var hasMozTransform, 13431 getHasMozTransform = function() { 13432 if(hasMozTransform === undefined) { 13433 hasMozTransform = document.createElement('p').style.MozTransform !== undefined; 13434 } 13435 return hasMozTransform; 13436 }; 13437 13438$.magnificPopup.registerModule('zoom', { 13439 13440 options: { 13441 enabled: false, 13442 easing: 'ease-in-out', 13443 duration: 300, 13444 opener: function(element) { 13445 return element.is('img') ? element : element.find('img'); 13446 } 13447 }, 13448 13449 proto: { 13450 13451 initZoom: function() { 13452 var zoomSt = mfp.st.zoom, 13453 ns = '.zoom', 13454 image; 13455 13456 if(!zoomSt.enabled || !mfp.supportsTransition) { 13457 return; 13458 } 13459 13460 var duration = zoomSt.duration, 13461 getElToAnimate = function(image) { 13462 var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'), 13463 transition = 'all '+(zoomSt.duration/1000)+'s ' + zoomSt.easing, 13464 cssObj = { 13465 position: 'fixed', 13466 zIndex: 9999, 13467 left: 0, 13468 top: 0, 13469 '-webkit-backface-visibility': 'hidden' 13470 }, 13471 t = 'transition'; 13472 13473 cssObj['-webkit-'+t] = cssObj['-moz-'+t] = cssObj['-o-'+t] = cssObj[t] = transition; 13474 13475 newImg.css(cssObj); 13476 return newImg; 13477 }, 13478 showMainContent = function() { 13479 mfp.content.css('visibility', 'visible'); 13480 }, 13481 openTimeout, 13482 animatedImg; 13483 13484 _mfpOn('BuildControls'+ns, function() { 13485 if(mfp._allowZoom()) { 13486 13487 clearTimeout(openTimeout); 13488 mfp.content.css('visibility', 'hidden'); 13489 13490 // Basically, all code below does is clones existing image, puts in on top of the current one and animated it 13491 13492 image = mfp._getItemToZoom(); 13493 13494 if(!image) { 13495 showMainContent(); 13496 return; 13497 } 13498 13499 animatedImg = getElToAnimate(image); 13500 13501 animatedImg.css( mfp._getOffset() ); 13502 13503 mfp.wrap.append(animatedImg); 13504 13505 openTimeout = setTimeout(function() { 13506 animatedImg.css( mfp._getOffset( true ) ); 13507 openTimeout = setTimeout(function() { 13508 13509 showMainContent(); 13510 13511 setTimeout(function() { 13512 animatedImg.remove(); 13513 image = animatedImg = null; 13514 _mfpTrigger('ZoomAnimationEnded'); 13515 }, 16); // avoid blink when switching images 13516 13517 }, duration); // this timeout equals animation duration 13518 13519 }, 16); // by adding this timeout we avoid short glitch at the beginning of animation 13520 13521 13522 // Lots of timeouts... 13523 } 13524 }); 13525 _mfpOn(BEFORE_CLOSE_EVENT+ns, function() { 13526 if(mfp._allowZoom()) { 13527 13528 clearTimeout(openTimeout); 13529 13530 mfp.st.removalDelay = duration; 13531 13532 if(!image) { 13533 image = mfp._getItemToZoom(); 13534 if(!image) { 13535 return; 13536 } 13537 animatedImg = getElToAnimate(image); 13538 } 13539 13540 animatedImg.css( mfp._getOffset(true) ); 13541 mfp.wrap.append(animatedImg); 13542 mfp.content.css('visibility', 'hidden'); 13543 13544 setTimeout(function() { 13545 animatedImg.css( mfp._getOffset() ); 13546 }, 16); 13547 } 13548 13549 }); 13550 13551 _mfpOn(CLOSE_EVENT+ns, function() { 13552 if(mfp._allowZoom()) { 13553 showMainContent(); 13554 if(animatedImg) { 13555 animatedImg.remove(); 13556 } 13557 image = null; 13558 } 13559 }); 13560 }, 13561 13562 _allowZoom: function() { 13563 return mfp.currItem.type === 'image'; 13564 }, 13565 13566 _getItemToZoom: function() { 13567 if(mfp.currItem.hasSize) { 13568 return mfp.currItem.img; 13569 } else { 13570 return false; 13571 } 13572 }, 13573 13574 // Get element postion relative to viewport 13575 _getOffset: function(isLarge) { 13576 var el; 13577 if(isLarge) { 13578 el = mfp.currItem.img; 13579 } else { 13580 el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem); 13581 } 13582 13583 var offset = el.offset(); 13584 var paddingTop = parseInt(el.css('padding-top'),10); 13585 var paddingBottom = parseInt(el.css('padding-bottom'),10); 13586 offset.top -= ( $(window).scrollTop() - paddingTop ); 13587 13588 13589 /* 13590 13591 Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa. 13592 13593 */ 13594 var obj = { 13595 width: el.width(), 13596 // fix Zepto height+padding issue 13597 height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop 13598 }; 13599 13600 // I hate to do this, but there is no another option 13601 if( getHasMozTransform() ) { 13602 obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)'; 13603 } else { 13604 obj.left = offset.left; 13605 obj.top = offset.top; 13606 } 13607 return obj; 13608 } 13609 13610 } 13611}); 13612 13613 13614 13615/*>>zoom*/ 13616 13617/*>>iframe*/ 13618 13619var IFRAME_NS = 'iframe', 13620 _emptyPage = '//about:blank', 13621 13622 _fixIframeBugs = function(isShowing) { 13623 if(mfp.currTemplate[IFRAME_NS]) { 13624 var el = mfp.currTemplate[IFRAME_NS].find('iframe'); 13625 if(el.length) { 13626 // reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug 13627 if(!isShowing) { 13628 el[0].src = _emptyPage; 13629 } 13630 13631 // IE8 black screen bug fix 13632 if(mfp.isIE8) { 13633 el.css('display', isShowing ? 'block' : 'none'); 13634 } 13635 } 13636 } 13637 }; 13638 13639$.magnificPopup.registerModule(IFRAME_NS, { 13640 13641 options: { 13642 markup: '<div class="mfp-iframe-scaler">'+ 13643 '<div class="mfp-close"></div>'+ 13644 '<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>'+ 13645 '</div>', 13646 13647 srcAction: 'iframe_src', 13648 13649 // we don't care and support only one default type of URL by default 13650 patterns: { 13651 youtube: { 13652 index: 'youtube.com', 13653 id: 'v=', 13654 src: '//www.youtube.com/embed/%id%?autoplay=1' 13655 }, 13656 vimeo: { 13657 index: 'vimeo.com/', 13658 id: '/', 13659 src: '//player.vimeo.com/video/%id%?autoplay=1' 13660 }, 13661 gmaps: { 13662 index: '//maps.google.', 13663 src: '%id%&output=embed' 13664 } 13665 } 13666 }, 13667 13668 proto: { 13669 initIframe: function() { 13670 mfp.types.push(IFRAME_NS); 13671 13672 _mfpOn('BeforeChange', function(e, prevType, newType) { 13673 if(prevType !== newType) { 13674 if(prevType === IFRAME_NS) { 13675 _fixIframeBugs(); // iframe if removed 13676 } else if(newType === IFRAME_NS) { 13677 _fixIframeBugs(true); // iframe is showing 13678 } 13679 }// else { 13680 // iframe source is switched, don't do anything 13681 //} 13682 }); 13683 13684 _mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function() { 13685 _fixIframeBugs(); 13686 }); 13687 }, 13688 13689 getIframe: function(item, template) { 13690 var embedSrc = item.src; 13691 var iframeSt = mfp.st.iframe; 13692 13693 $.each(iframeSt.patterns, function() { 13694 if(embedSrc.indexOf( this.index ) > -1) { 13695 if(this.id) { 13696 if(typeof this.id === 'string') { 13697 embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length); 13698 } else { 13699 embedSrc = this.id.call( this, embedSrc ); 13700 } 13701 } 13702 embedSrc = this.src.replace('%id%', embedSrc ); 13703 return false; // break; 13704 } 13705 }); 13706 13707 var dataObj = {}; 13708 if(iframeSt.srcAction) { 13709 dataObj[iframeSt.srcAction] = embedSrc; 13710 } 13711 mfp._parseMarkup(template, dataObj, item); 13712 13713 mfp.updateStatus('ready'); 13714 13715 return template; 13716 } 13717 } 13718}); 13719 13720 13721 13722/*>>iframe*/ 13723 13724/*>>gallery*/ 13725/** 13726 * Get looped index depending on number of slides 13727 */ 13728var _getLoopedId = function(index) { 13729 var numSlides = mfp.items.length; 13730 if(index > numSlides - 1) { 13731 return index - numSlides; 13732 } else if(index < 0) { 13733 return numSlides + index; 13734 } 13735 return index; 13736 }, 13737 _replaceCurrTotal = function(text, curr, total) { 13738 return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total); 13739 }; 13740 13741$.magnificPopup.registerModule('gallery', { 13742 13743 options: { 13744 enabled: false, 13745 arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', 13746 preload: [0,2], 13747 navigateByImgClick: true, 13748 arrows: true, 13749 13750 tPrev: 'Previous (Left arrow key)', 13751 tNext: 'Next (Right arrow key)', 13752 tCounter: '%curr% of %total%' 13753 }, 13754 13755 proto: { 13756 initGallery: function() { 13757 13758 var gSt = mfp.st.gallery, 13759 ns = '.mfp-gallery'; 13760 13761 mfp.direction = true; // true - next, false - prev 13762 13763 if(!gSt || !gSt.enabled ) return false; 13764 13765 _wrapClasses += ' mfp-gallery'; 13766 13767 _mfpOn(OPEN_EVENT+ns, function() { 13768 13769 if(gSt.navigateByImgClick) { 13770 mfp.wrap.on('click'+ns, '.mfp-img', function() { 13771 if(mfp.items.length > 1) { 13772 mfp.next(); 13773 return false; 13774 } 13775 });
13776 } 13777 13778 _document.on('keydown'+ns, function(e) { 13779 if (e.keyCode === 37) { 13780 mfp.prev(); 13781 } else if (e.keyCode === 39) { 13782 mfp.next(); 13783 } 13784 }); 13785 }); 13786 13787 _mfpOn('UpdateStatus'+ns, function(e, data) { 13788 if(data.text) { 13789 data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length); 13790 } 13791 }); 13792 13793 _mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) { 13794 var l = mfp.items.length; 13795 values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : ''; 13796 }); 13797 13798 _mfpOn('BuildControls' + ns, function() { 13799 if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) { 13800 var markup = gSt.arrowMarkup, 13801 arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS), 13802 arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS); 13803 13804 arrowLeft.click(function() { 13805 mfp.prev(); 13806 }); 13807 arrowRight.click(function() { 13808 mfp.next(); 13809 }); 13810 13811 mfp.container.append(arrowLeft.add(arrowRight)); 13812 } 13813 }); 13814 13815 _mfpOn(CHANGE_EVENT+ns, function() { 13816 if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout); 13817 13818 mfp._preloadTimeout = setTimeout(function() { 13819 mfp.preloadNearbyImages(); 13820 mfp._preloadTimeout = null; 13821 }, 16); 13822 }); 13823 13824 13825 _mfpOn(CLOSE_EVENT+ns, function() { 13826 _document.off(ns); 13827 mfp.wrap.off('click'+ns); 13828 mfp.arrowRight = mfp.arrowLeft = null; 13829 }); 13830 13831 }, 13832 next: function() { 13833 mfp.direction = true; 13834 mfp.index = _getLoopedId(mfp.index + 1); 13835 mfp.updateItemHTML(); 13836 }, 13837 prev: function() { 13838 mfp.direction = false; 13839 mfp.index = _getLoopedId(mfp.index - 1); 13840 mfp.updateItemHTML(); 13841 }, 13842 goTo: function(newIndex) { 13843 mfp.direction = (newIndex >= mfp.index); 13844 mfp.index = newIndex; 13845 mfp.updateItemHTML(); 13846 }, 13847 preloadNearbyImages: function() { 13848 var p = mfp.st.gallery.preload, 13849 preloadBefore = Math.min(p[0], mfp.items.length), 13850 preloadAfter = Math.min(p[1], mfp.items.length), 13851 i; 13852 13853 for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) { 13854 mfp._preloadItem(mfp.index+i); 13855 } 13856 for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) { 13857 mfp._preloadItem(mfp.index-i); 13858 } 13859 }, 13860 _preloadItem: function(index) { 13861 index = _getLoopedId(index); 13862 13863 if(mfp.items[index].preloaded) { 13864 return; 13865 } 13866 13867 var item = mfp.items[index]; 13868 if(!item.parsed) { 13869 item = mfp.parseEl( index ); 13870 } 13871 13872 _mfpTrigger('LazyLoad', item); 13873 13874 if(item.type === 'image') { 13875 item.img = $('<img class="mfp-img" />').on('load.mfploader', function() { 13876 item.hasSize = true; 13877 }).on('error.mfploader', function() { 13878 item.hasSize = true; 13879 item.loadError = true; 13880 _mfpTrigger('LazyLoadError', item); 13881 }).attr('src', item.src); 13882 } 13883 13884 13885 item.preloaded = true; 13886 } 13887 } 13888}); 13889 13890/*>>gallery*/ 13891 13892/*>>retina*/ 13893 13894var RETINA_NS = 'retina'; 13895 13896$.magnificPopup.registerModule(RETINA_NS, { 13897 options: { 13898 replaceSrc: function(item) { 13899 return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; }); 13900 }, 13901 ratio: 1 // Function or number. Set to 1 to disable. 13902 }, 13903 proto: { 13904 initRetina: function() { 13905 if(window.devicePixelRatio > 1) { 13906 13907 var st = mfp.st.retina, 13908 ratio = st.ratio; 13909 13910 ratio = !isNaN(ratio) ? ratio : ratio(); 13911 13912 if(ratio > 1) { 13913 _mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) { 13914 item.img.css({ 13915 'max-width': item.img[0].naturalWidth / ratio, 13916 'width': '100%' 13917 }); 13918 }); 13919 _mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) { 13920 item.src = st.replaceSrc(item, ratio); 13921 }); 13922 } 13923 } 13924 13925 } 13926 } 13927}); 13928 13929/*>>retina*/ 13930 _checkInstance(); }));; 13931/*! Browser bundle of nunjucks 2.4.2 */ 13932var nunjucks=function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var i=n(1),r=n(2),s=n(15),o=n(14),a=n(3);e.exports={},e.exports.Environment=r.Environment,e.exports.Template=r.Template,e.exports.Loader=s,e.exports.FileSystemLoader=o.FileSystemLoader,e.exports.PrecompiledLoader=o.PrecompiledLoader,e.exports.WebLoader=o.WebLoader,e.exports.compiler=n(7),e.exports.parser=n(8),e.exports.lexer=n(9),e.exports.runtime=n(12),e.exports.lib=i,e.exports.nodes=n(10),e.exports.installJinjaCompat=n(18);var l;e.exports.configure=function(e,t){t=t||{},i.isObject(e)&&(t=e,e=null);var n;return o.FileSystemLoader?n=new o.FileSystemLoader(e,{watch:t.watch,noCache:t.noCache}):o.WebLoader&&(n=new o.WebLoader(e,{useCache:t.web&&t.web.useCache,async:t.web&&t.web.async})),l=new r.Environment(n,t),t&&t.express&&l.express(t.express),l},e.exports.compile=function(t,n,i,r){return l||e.exports.configure(),new e.exports.Template(t,n,i,r)},e.exports.render=function(t,n,i){return l||e.exports.configure(),l.render(t,n,i)},e.exports.renderString=function(t,n,i){return l||e.exports.configure(),l.render
13932String(t,n,i)},a&&(e.exports.precompile=a.precompile,e.exports.precompileString=a.precompileString)},function(e,t){"use strict";var n=Array.prototype,i=Object.prototype,r={"&":"&",'"':""","'":"'","<":"<",">":">"},s=/[&"'<>]/g,o=function(e){return r[e]},t=e.exports={};t.prettifyError=function(e,n,i){if(i.Update||(i=new t.TemplateError(i)),i.Update(e),!n){var r=i;i=new Error(r.message),i.name=r.name}return i},t.TemplateError=function(e,t,n){var i=this;if(e instanceof Error){i=e,e=e.name+": "+e.message;try{i.name=""}catch(r){i=this}}else Error.captureStackTrace&&Error.captureStackTrace(i);return i.name="Template render error",i.message=e,i.lineno=t,i.colno=n,i.firstUpdate=!0,i.Update=function(e){var t="("+(e||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?t+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(t+=" [Line "+this.lineno+"]")),t+="\n ",this.firstUpdate&&(t+=" "),this.message=t+(this.message||""),this.firstUpdate=!1,this},i},t.TemplateError.prototype=Error.prototype,t.escape=function(e){return e.replace(s,o)},t.isFunction=function(e){return"[object Function]"===i.toString.call(e)},t.isArray=Array.isArray||function(e){return"[object Array]"===i.toString.call(e)},t.isString=function(e){return"[object String]"===i.toString.call(e)},t.isObject=function(e){return"[object Object]"===i.toString.call(e)},t.groupBy=function(e,n){for(var i={},r=t.isFunction(n)?n:function(e){return e[n]},s=0;s<e.length;s++){var o=e[s],a=r(o,s);(i[a]||(i[a]=[])).push(o)}return i},t.toArray=function(e){return Array.prototype.slice.call(e)},t.without=function(e){var n=[];if(!e)return n;for(var i=-1,r=e.length,s=t.toArray(arguments).slice(1);++i<r;)-1===t.indexOf(s,e[i])&&n.push(e[i]);return n},t.extend=function(e,t){for(var n in t)e[n]=t[n];return e},t.repeat=function(e,t){for(var n="",i=0;t>i;i++)n+=e;return n},t.each=function(e,t,i){if(null!=e)if(n.each&&e.each===n.each)e.forEach(t,i);else if(e.length===+e.length)for(var r=0,s=e.length;s>r;r++)t.call(i,e[r],r,e)},t.map=function(e,t){var i=[];if(null==e)return i;if(n.map&&e.map===n.map)return e.map(t);for(var r=0;r<e.length;r++)i[i.length]=t(e[r],r);return e.length===+e.length&&(i.length=e.length),i},t.asyncIter=function(e,t,n){function i(){r++,r<e.length?t(e[r],r,i,n):n()}var r=-1;i()},t.asyncFor=function(e,n,i){function r(){a++;var t=s[a];o>a?n(t,e[t],a,o,r):i()}var s=t.keys(e),o=s.length,a=-1;r()},t.indexOf=Array.prototype.indexOf?function(e,t,n){return Array.prototype.indexOf.call(e,t,n)}:function(e,t,n){var i=this.length>>>0;for(n=+n||0,Math.abs(n)===1/0&&(n=0),0>n&&(n+=i,0>n&&(n=0));i>n;n++)if(e[n]===t)return n;return-1},Array.prototype.map||(Array.prototype.map=function(){throw new Error("map is unimplemented for this js engine")}),t.keys=function(e){if(Object.prototype.keys)return e.keys();var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},t.inOperator=function(e,n){if(t.isArray(n))return-1!==t.indexOf(n,e);if(t.isObject(n))return e in n;if(t.isString(n))return-1!==n.indexOf(e);throw new Error('Cannot use "in" operator to search for "'+e+'" in unexpected types.')}},function(e,t,n){"use strict";function i(e,t,n){o(function(){e(t,n)})}var r,s=n(3),o=n(4),a=n(1),l=n(6),c=n(7),h=n(13),u=n(14),p=n(12),f=n(17),m=p.Frame;u.PrecompiledLoader=n(16);var d=l.extend({init:function(e,t){t=this.opts=t||{},this.opts.dev=!!t.dev,this.opts.autoescape=null!=t.autoescape?t.autoescape:!0,this.opts.throwOnUndefined=!!t.throwOnUndefined,this.opts.trimBlocks=!!t.trimBlocks,this.opts.lstripBlocks=!!t.lstripBlocks,this.loaders=[],e?this.loaders=a.isArray(e)?e:[e]:u.FileSystemLoader?this.loaders=[new u.FileSystemLoader("views")]:u.WebLoader&&(this.loaders=[new u.WebLoader("/views")]),window.nunjucksPrecompiled&&this.loaders.unshift(new u.PrecompiledLoader(window.nunjucksPrecompiled)),this.initCache(),this.globals=f(),this.filters={},this.asyncFilters=[],this.extensions={},this.extensionsList=[];for(var n in h)this.addFilter(n,h[n])},initCache:function(){a.each(this.loaders,function(e){e.cache={},"function"==typeof e.on&&e.on("update",function(t){e.cache[t]=null})})},addExtension:function(e,t){return t._name=e,this.extensions[e]=t,this.extensionsList.push(t),this},removeExtension:function(e){var t=this.getExtension(e);t&&(this.extensionsList=a.without(this.extensionsList,t),delete this.extensions[e])},getExtension:function(e){return this.extensions[e]},hasExtension:function(e){return!!this.extensions[e]},addGlobal:function(e,t){return this.globals[e]=t,this},getGlobal:function(e){if("undefined"==typeof this.globals[e])throw new Error("global not found: "+e);return this.globals[e]},addFilter:function(e,t,n){var i=t;return n&&this.asyncFilters.push(e),this.filters[e]=i,this},getFilter:function(e){if(!this.filters[e])throw new Error("filter not found: "+e);return this.filters[e]},resolveTemplate:function(e,t,n){var i=e.isRelative&&t?e.isRelative(n):!1;return i&&e.resolve?e.resolve(t,n):n},getTemplate:function(e,t,n,i,s){var o=this,l=null;if(e&&e.raw&&(e=e.raw),a.isFunction(n)&&(s=n,n=null,t=t||!1),a.isFunction(t)&&(s=t,t=!1),e instanceof r)l=e;else{if("string"!=typeof e)throw new Error("template names must be a string: "+e);for(var c=0;c<this.loaders.length;c++){var h=this.resolveTemplate(this.loaders[c],n,e);if(l=this.loaders[c].cache[h])break}}if(!l){var u,p=this,f=function(n,o){if(o||n||i||(n=new Error("template not found: "+e)),n){if(!s)throw n;s(n)}else{var a;o?(a=new r(o.src,p,o.path,t),o.noCache||(o.loader.cache[e]=a)):a=new r("",p,"",t),s?s(null,a):u=a}};return a.asyncIter(this.loaders,function(t,i,r,s){function a(e,n){e?s(e):n?(n.loader=t,s(null,n)):r()}e=o.resolveTemplate(t,n,e),t.async?t.getSource(e,a):a(null,t.getSource(e))},f),u}return t&&l.compile(),s?void s(null,l):l},express:function(e){function t(e,t){if(this.name=e,this.path=e,this.defaultEngine=t.defaultEngine,this.ext=s.extname(e),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=("."!==this.defaultEngine[0]?".":"")+this.defaultEngine)}var n=this;return t.prototype.render=function(e,t){n.render(this.name,e,t)},e.set("view",t),this},render:function(e,t,n){a.isFunction(t)&&(n=t,t=null);var r=null;return this.getTemplate(e,function(e,s){if(e&&n)i(n,e);else{if(e)throw e;r=s.render(t,n)}}),r},renderString:function(e,t,n,i){a.isFunction(n)&&(i=n,n={}),n=n||{};var s=new r(e,this,n.path);return s.render(t,i)}}),v=l.extend({init:function(e,t,n){this.env=n||new d,this.ctx={};for(var i in e)e.hasOwnProperty(i)&&(this.ctx[i]=e[i]);this.blocks={},this.exported=[];for(var r in t)this.addBlock(r,t[r])},lookup:function(e){return e in this.env.globals&&!(e in this.ctx)?this.env.globals[e]:this.ctx[e]},setVariable:function(e,t){this.ctx[e]=t},getVariables:function(){return this.ctx},addBlock:function(e,t){return this.blocks[e]=this.blocks[e]||[],this.blocks[e].push(t),this},getBlock:function(e){if(!this.blocks[e])throw new Error('unknown block "'+e+'"');return this.blocks[e][0]},getSuper:function(e,t,n,i,r,s){var o=a.indexOf(this.blocks[t]||[],n),l=this.blocks[t][o+1],c=this;if(-1===o||!l)throw new Error('no super block available for "'+t+'"');l(e,c,i,r,s)},addExport:function(e){this.exported.push(e)},getExported:function(){for(var e={},t=0;t<this.exported.length;t++){var n=this.exported[t];e[n]=this.ctx[n]}return e}});r=l.extend({init:function(e,t,n,i){if(this.env=t||new d,a.isObject(e))switch(e.type){case"code":this.tmplProps=e.obj;break;case"string":this.tmplStr=e.obj}else{if(!a.isString(e))throw new Error("src must be a string or an object describing the source");this.tmplStr=e}if(this.path=n,i){var r=this;try{r._compile()}catch(s){throw a.prettifyError(this.path,this.env.opts.dev,s)}}else this.compiled=!1},render:function(e,t,n){"function"==typeof e?(n=e,e={}):"function"==typeof t&&(n=t,t=null);var r=!0;t&&(r=!1);var s=this;try{s.compile()}catch(o){var l=a.prettifyError(this.path,this.env.opts.dev,o);if(n)return i(n,l);throw l}var c=new v(e||{},s.blocks,s.env),h=t?t.push(!0):new m;h.topLevel=!0;var u=null;
13932return s.rootRenderFunc(s.env,c,h||new m,p,function(e,t){if(e&&(e=a.prettifyError(s.path,s.env.opts.dev,e)),n)r?i(n,e,t):n(e,t);else{if(e)throw e;u=t}}),u},getExported:function(e,t,n){"function"==typeof e&&(n=e,e={}),"function"==typeof t&&(n=t,t=null);try{this.compile()}catch(i){if(n)return n(i);throw i}var r=t?t.push():new m;r.topLevel=!0;var s=new v(e||{},this.blocks,this.env);this.rootRenderFunc(this.env,s,r,p,function(e){e?n(e,null):n(null,s.getExported())})},compile:function(){this.compiled||this._compile()},_compile:function(){var e;if(this.tmplProps)e=this.tmplProps;else{var t=c.compile(this.tmplStr,this.env.asyncFilters,this.env.extensionsList,this.path,this.env.opts),n=new Function(t);e=n()}this.blocks=this._getBlocks(e),this.rootRenderFunc=e.root,this.compiled=!0},_getBlocks:function(e){var t={};for(var n in e)"b_"===n.slice(0,2)&&(t[n.slice(2)]=e[n]);return t}}),e.exports={Environment:d,Template:r}},function(e,t){},function(e,t,n){"use strict";function i(){if(l.length)throw l.shift()}function r(e){var t;t=a.length?a.pop():new s,t.task=e,o(t)}function s(){this.task=null}var o=n(5),a=[],l=[],c=o.makeRequestCallFromTimer(i);e.exports=r,s.prototype.call=function(){try{this.task.call()}catch(e){r.onerror?r.onerror(e):(l.push(e),c())}finally{this.task=null,a[a.length]=this}}},function(e,t){(function(t){"use strict";function n(e){a.length||(o(),l=!0),a[a.length]=e}function i(){for(;c<a.length;){var e=c;if(c+=1,a[e].call(),c>h){for(var t=0,n=a.length-c;n>t;t++)a[t]=a[t+c];a.length-=c,c=0}}a.length=0,c=0,l=!1}function r(e){var t=1,n=new u(e),i=document.createTextNode("");return n.observe(i,{characterData:!0}),function(){t=-t,i.data=t}}function s(e){return function(){function t(){clearTimeout(n),clearInterval(i),e()}var n=setTimeout(t,0),i=setInterval(t,50)}}e.exports=n;var o,a=[],l=!1,c=0,h=1024,u=t.MutationObserver||t.WebKitMutationObserver;o="function"==typeof u?r(i):s(i),n.requestFlush=o,n.makeRequestCallFromTimer=s}).call(t,function(){return this}())},function(e,t){"use strict";function n(e,t,i){var r=function(){};r.prototype=e.prototype;var s=new r,o=/xyz/.test(function(){xyz})?/\bparent\b/:/.*/;i=i||{};for(var a in i){var l=i[a],c=s[a];"function"==typeof c&&"function"==typeof l&&o.test(l)?s[a]=function(e,t){return function(){var n=this.parent;this.parent=t;var i=e.apply(this,arguments);return this.parent=n,i}}(l,c):s[a]=l}s.typename=t;var h=function(){s.init&&s.init.apply(this,arguments)};return h.prototype=s,h.prototype.constructor=h,h.extend=function(e,t){return"object"==typeof e&&(t=e,e="anonymous"),n(h,e,t)},h}e.exports=n(Object,"Object",{})},function(e,t,n){"use strict";function i(e){return function(t,n){this.compile(t.left,n),this.emit(e),this.compile(t.right,n)}}var r=n(1),s=n(8),o=n(11),a=n(10),l=n(6),c=n(12).Frame,h={"==":"==","!=":"!=","<":"<",">":">","<=":"<=",">=":">="},u=l.extend({init:function(e,t){this.templateName=e,this.codebuf=[],this.lastId=0,this.buffer=null,this.bufferStack=[],this.scopeClosers="",this.inBlock=!1,this.throwOnUndefined=t},fail:function(e,t,n){throw void 0!==t&&(t+=1),void 0!==n&&(n+=1),new r.TemplateError(e,t,n)},pushBufferId:function(e){this.bufferStack.push(this.buffer),this.buffer=e,this.emit("var "+this.buffer+' = "";')},popBufferId:function(){this.buffer=this.bufferStack.pop()},emit:function(e){this.codebuf.push(e)},emitLine:function(e){this.emit(e+"\n")},emitLines:function(){r.each(r.toArray(arguments),function(e){this.emitLine(e)},this)},emitFuncBegin:function(e){this.buffer="output",this.scopeClosers="",this.emitLine("function "+e+"(env, context, frame, runtime, cb) {"),this.emitLine("var lineno = null;"),this.emitLine("var colno = null;"),this.emitLine("var "+this.buffer+' = "";'),this.emitLine("try {")},emitFuncEnd:function(e){e||this.emitLine("cb(null, "+this.buffer+");"),this.closeScopeLevels(),this.emitLine("} catch (e) {"),this.emitLine(" cb(runtime.handleError(e, lineno, colno));"),this.emitLine("}"),this.emitLine("}"),this.buffer=null},addScopeLevel:function(){this.scopeClosers+="})"},closeScopeLevels:function(){this.emitLine(this.scopeClosers+";"),this.scopeClosers=""},withScopedSyntax:function(e){var t=this.scopeClosers;this.scopeClosers="",e.call(this),this.closeScopeLevels(),this.scopeClosers=t},makeCallback:function(e){var t=this.tmpid();return"function("+t+(e?","+e:"")+") {\nif("+t+") { cb("+t+"); return; }"},tmpid:function(){return this.lastId++,"t_"+this.lastId},_templateName:function(){return null==this.templateName?"undefined":JSON.stringify(this.templateName)},_compileChildren:function(e,t){for(var n=e.children,i=0,r=n.length;r>i;i++)this.compile(n[i],t)}
13932,_compileAggregate:function(e,t,n,i){n&&this.emit(n);for(var r=0;r<e.children.length;r++)r>0&&this.emit(","),this.compile(e.children[r],t);i&&this.emit(i)},_compileExpression:function(e,t){this.assertType(e,a.Literal,a.Symbol,a.Group,a.Array,a.Dict,a.FunCall,a.Caller,a.Filter,a.LookupVal,a.Compare,a.InlineIf,a.In,a.And,a.Or,a.Not,a.Add,a.Concat,a.Sub,a.Mul,a.Div,a.FloorDiv,a.Mod,a.Pow,a.Neg,a.Pos,a.Compare,a.NodeList),this.compile(e,t)},assertType:function(e){for(var t=r.toArray(arguments).slice(1),n=!1,i=0;i<t.length;i++)e instanceof t[i]&&(n=!0);n||this.fail("assertType: invalid type: "+e.typename,e.lineno,e.colno)},compileCallExtension:function(e,t,n){var i=e.args,s=e.contentArgs,o="boolean"==typeof e.autoescape?e.autoescape:!0;if(n||this.emit(this.buffer+" += runtime.suppressValue("),this.emit('env.getExtension("'+e.extName+'")["'+e.prop+'"]('),this.emit("context"),(i||s)&&this.emit(","),i&&(i instanceof a.NodeList||this.fail("compileCallExtension: arguments must be a NodeList, use `parser.parseSignature`"),r.each(i.children,function(e,n){this._compileExpression(e,t),(n!==i.children.length-1||s.length)&&this.emit(",")},this)),s.length&&r.each(s,function(e,n){if(n>0&&this.emit(","),e){var i=this.tmpid();this.emitLine("function(cb) {"),this.emitLine("if(!cb) { cb = function(err) { if(err) { throw err; }}}"),this.pushBufferId(i),this.withScopedSyntax(function(){this.compile(e,t),this.emitLine("cb(null, "+i+");")}),this.popBufferId(),this.emitLine("return "+i+";"),this.emitLine("}")}else this.emit("null")},this),n){var l=this.tmpid();this.emitLine(", "+this.makeCallback(l)),this.emitLine(this.buffer+" += runtime.suppressValue("+l+", "+o+" && env.opts.autoescape);"),this.addScopeLevel()}else this.emit(")"),this.emit(", "+o+" && env.opts.autoescape);\n")},compileCallExtensionAsync:function(e,t){this.compileCallExtension(e,t,!0)},compileNodeList:function(e,t){this._compileChildren(e,t)},compileLiteral:function(e){if("string"==typeof e.value){var t=e.value.replace(/\\/g,"\\\\");t=t.replace(/"/g,'\\"'),t=t.replace(/\n/g,"\\n"),t=t.replace(/\r/g,"\\r"),t=t.replace(/\t/g,"\\t"),this.emit('"'+t+'"')}else null===e.value?this.emit("null"):this.emit(e.value.toString())},compileSymbol:function(e,t){var n,i=e.value;(n=t.lookup(i))?this.emit(n):this.emit('runtime.contextOrFrameLookup(context, frame, "'+i+'")')},compileGroup:function(e,t){this._compileAggregate(e,t,"(",")")},compileArray:function(e,t){this._compileAggregate(e,t,"[","]")},compileDict:function(e,t){this._compileAggregate(e,t,"{","}")},compilePair:function(e,t){var n=e.key,i=e.value;n instanceof a.Symbol?n=new a.Literal(n.lineno,n.colno,n.value):n instanceof a.Literal&&"string"==typeof n.value||this.fail("compilePair: Dict keys must be strings or names",n.lineno,n.colno),this.compile(n,t),this.emit(": "),this._compileExpression(i,t)},compileInlineIf:function(e,t){this.emit("("),this.compile(e.cond,t),this.emit("?"),this.compile(e.body,t),this.emit(":"),null!==e.else_?this.compile(e.else_,t):this.emit('""'),this.emit(")")},compileIn:function(e,t){this.emit("runtime.inOperator("),this.compile(e.left,t),this.emit(","),this.compile(e.right,t),this.emit(")")},compileOr:i(" || "),compileAnd:i(" && "),compileAdd:i(" + "),compileConcat:i(' + "" + '),compileSub:i(" - "),compileMul:i(" * "),compileDiv:i(" / "),compileMod:i(" % "),compileNot:function(e,t){this.emit("!"),this.compile(e.target,t)},compileFloorDiv:function(e,t){this.emit("Math.floor("),this.compile(e.left,t),this.emit(" / "),this.compile(e.right,t),this.emit(")")},compilePow:function(e,t){this.emit("Math.pow("),this.compile(e.left,t),this.emit(", "),this.compile(e.right,t),this.emit(")")},compileNeg:function(e,t){this.emit("-"),this.compile(e.target,t)},compilePos:function(e,t){this.emit("+"),this.compile(e.target,t)},compileCompare:function(e,t){this.compile(e.expr,t);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];this.emit(" "+h[i.type]+" "),this.compile(i.expr,t)}},compileLookupVal:function(e,t){this.emit("runtime.memberLookup(("),this._compileExpression(e.target,t),this.emit("),"),this._compileExpression(e.val,t),this.emit
13932(")")},_getNodeName:function(e){switch(e.typename){case"Symbol":return e.value;case"FunCall":return"the return value of ("+this._getNodeName(e.name)+")";case"LookupVal":return this._getNodeName(e.target)+'["'+this._getNodeName(e.val)+'"]';case"Literal":return e.value.toString();default:return"--expression--"}},compileFunCall:function(e,t){this.emit("(lineno = "+e.lineno+", colno = "+e.colno+", "),this.emit("runtime.callWrap("),this._compileExpression(e.name,t),this.emit(', "'+this._getNodeName(e.name).replace(/"/g,'\\"')+'", context, '),this._compileAggregate(e.args,t,"[","])"),this.emit(")")},compileFilter:function(e,t){var n=e.name;this.assertType(n,a.Symbol),this.emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(e.args,t),this.emit(")")},compileFilterAsync:function(e,t){var n=e.name;this.assertType(n,a.Symbol);var i=e.symbol.value;t.set(i,i),this.emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(e.args,t),this.emitLine(", "+this.makeCallback(i)),this.addScopeLevel()},compileKeywordArgs:function(e,t){var n=[];r.each(e.children,function(e){n.push(e.key.value)}),this.emit("runtime.makeKeywordArgs("),this.compileDict(e,t),this.emit(")")},compileSet:function(e,t){var n=[];r.each(e.targets,function(e){var i=e.value,r=t.lookup(i);(null===r||void 0===r)&&(r=this.tmpid(),this.emitLine("var "+r+";")),n.push(r)}
13932,this),e.value?(this.emit(n.join(" = ")+" = "),this._compileExpression(e.value,t),this.emitLine(";")):(this.emit(n.join(" = ")+" = "),this.compile(e.body,t),this.emitLine(";")),r.each(e.targets,function(e,t){var i=n[t],r=e.value;this.emitLine('frame.set("'+r+'", '+i+", true);"),this.emitLine("if(frame.topLevel) {"),this.emitLine('context.setVariable("'+r+'", '+i+");"),this.emitLine("}"),"_"!==r.charAt(0)&&(this.emitLine("if(frame.topLevel) {"),this.emitLine('context.addExport("'+r+'", '+i+");"),this.emitLine("}"))},this)},compileIf:function(e,t,n){this.emit("if("),this._compileExpression(e.cond,t),this.emitLine(") {"),this.withScopedSyntax(function(){this.compile(e.body,t),n&&this.emit("cb()")}),e.else_?(this.emitLine("}\nelse {"),this.withScopedSyntax(function(){this.compile(e.else_,t),n&&this.emit("cb()")})):n&&(this.emitLine("}\nelse {"),this.emit("cb()")),this.emitLine("}")},compileIfAsync:function(e,t){this.emit("(function(cb) {"),this.compileIf(e,t,!0),this.emit("})("+this.makeCallback()),this.addScopeLevel()},emitLoopBindings:function(e,t,n,i){var r={index:n+" + 1",index0:n,revindex:i+" - "+n,revindex0:i+" - "+n+" - 1",first:n+" === 0",last:n+" === "+i+" - 1",length:i};for(var s in r)this.emitLine('frame.set("loop.'+s+'", '+r[s]+");")},compileFor:function(e,t){var n,i=this.tmpid(),r=this.tmpid(),s=this.tmpid();if(t=t.push(),this.emitLine("frame = frame.push();"),this.emit("var "+s+" = "),this._compileExpression(e.arr,t),this.emitLine(";"),this.emit("if("+s+") {"),e.name instanceof a.Array){this.emitLine("var "+i+";"),this.emitLine("if(runtime.isArray("+s+")) {"),this.emitLine("var "+r+" = "+s+".length;"),this.emitLine("for("+i+"=0; "+i+" < "+s+".length; "+i+"++) {");for(var o=0;o<e.name.children.length;o++){var l=this.tmpid();this.emitLine("var "+l+" = "+s+"["+i+"]["+o+"]"),this.emitLine('frame.set("'+e.name.children[o].value+'", '+s+"["+i+"]["+o+"]);"),t.set(e.name.children[o].value,l)}this.emitLoopBindings(e,s,i,r),this.withScopedSyntax(function(){this.compile(e.body,t)}),this.emitLine("}"),this.emitLine("} else {");var c=e.name.children[0],h=e.name.children[1],u=this.tmpid();n=this.tmpid(),t.set(c.value,u),t.set(h.value,n),this.emitLine(i+" = -1;"),this.emitLine("var "+r+" = runtime.keys("+s+").length;"),this.emitLine("for(var "+u+" in "+s+") {"),this.emitLine(i+"++;"),this.emitLine("var "+n+" = "+s+"["+u+"];"),this.emitLine('frame.set("'+c.value+'", '+u+");"),this.emitLine('frame.set("'+h.value+'", '+n+");"),this.emitLoopBindings(e,s,i,r),this.withScopedSyntax(function(){this.compile(e.body,t)}),this.emitLine("}"),this.emitLine("}")}else n=this.tmpid(),t.set(e.name.value,n),this.emitLine("var "+r+" = "+s+".length;"),this.emitLine("for(var "+i+"=0; "+i+" < "+s+".length; "+i+"++) {"),this.emitLine("var "+n+" = "+s+"["+i+"];"),this.emitLine('frame.set("'+e.name.value+'", '+n+");"),this.emitLoopBindings(e,s,i,r),this.withScopedSyntax(function(){this.compile(e.body,t)}),this.emitLine("}");this.emitLine("}"),e.else_&&(this.emitLine("if (!"+r+") {"),this.compile(e.else_,t),this.emitLine("}")),this.emitLine("frame = frame.pop();")},_compileAsyncLoop:function(e,t,n){var i=this.tmpid(),s=this.tmpid(),o=this.tmpid(),l=n?"asyncAll":"asyncEach";if(t=t.push(),this.emitLine("frame = frame.push();"),this.emit("var "+o+" = "),this._compileExpression(e.arr,t),this.emitLine(";"),e.name instanceof a.Array)this.emit("runtime."+l+"("+o+", "+e.name.children.length+", function("),r.each(e.name.children,function(e){this.emit(e.value+",")},this),this.emit(i+","+s+",next) {"),r.each(e.name.children,function(e){var n=e.value;t.set(n,n),this.emitLine('frame.set("'+n+'", '+n+");")},this);else{var c=e.name.value;this.emitLine("runtime."+l+"("+o+", 1, function("+c+", "+i+", "+s+",next) {"),this.emitLine('frame.set("'+c+'", '+c+");"),t.set(c,c)}this.emitLoopBindings(e,o,i,s),this.withScopedSyntax(function(){var r;n&&(r=this.tmpid(),this.pushBufferId(r)),this.compile(e.body,t),this.emitLine("next("+i+(r?","+r:"")+");"),n&&this.popBufferId()});var h=this.tmpid();this.emitLine("}, "+this.makeCallback(h)),this.addScopeLevel(),n&&this.emitLine(this.buffer+" += "+h+";"),e.else_&&(this.emitLine("if (!"+o+".length) {"),this.compile(e.else_,t),this.emitLine("}")),this.emitLine("frame = frame.pop();")},compileAsyncEach:function(e,t){this._compileAsyncLoop(e,t)},compileAsyncAll:function(e,t){this._compileAsyncLoop(e,t,!0)},_compileMacro:function(e,t){var n=[],i=null,s="macro_"+this.tmpid();r.each(e.args.children,function(t,r){r===e.args.children.length-1&&t instanceof a.Dict?i=t:(this.assertType(t,a.Symbol),n.push(t))},this);var o=r.map(n,function(e){return"l_"+e.value});o.push("kwargs");var l=r.map(n,function(e){return'"'+e.value+'"'}),c=r.map(i&&i.children||[],function(e){return'"'+e.key.value+'"'});t=t.push(),this.emitLines("var "+s+" = runtime.makeMacro(","["+l.join(", ")+"], ","["+c.join(", ")+"], ","function ("+o.join(", ")+") {","frame = frame.push(true);","kwargs = kwargs || {};",'if (kwargs.hasOwnProperty("caller")) {','frame.set("caller", kwargs.caller); }'),r.each(n,function(e){this.emitLine('frame.set("'+e.value+'", l_'+e.value+");"),t.set(e.value,"l_"+e.value)},this),i&&r.each(i.children,function(e){var n=e.key.value;
13932this.emit('frame.set("'+n+'", kwargs.hasOwnProperty("'+n+'") ? kwargs["'+n+'"] : '),this._compileExpression(e.value,t),this.emitLine(");")},this);var h=this.tmpid();return this.pushBufferId(h),this.withScopedSyntax(function(){this.compile(e.body,t)}),t=t.pop(),this.emitLine("frame = frame.pop();"),this.emitLine("return new runtime.SafeString("+h+");"),this.emitLine("});"),this.popBufferId(),s},compileMacro:function(e,t){var n=this._compileMacro(e,t),i=e.name.value;t.set(i,n),t.parent?this.emitLine('frame.set("'+i+'", '+n+");"):("_"!==e.name.value.charAt(0)&&this.emitLine('context.addExport("'+i+'");'),this.emitLine('context.setVariable("'+i+'", '+n+");"))},compileCaller:function(e,t){this.emit("(function (){");var n=this._compileMacro(e,t);this.emit("return "+n+";})()")},compileImport:function(e,t){var n=this.tmpid(),i=e.target.value;this.emit("env.getTemplate("),this._compileExpression(e.template,t),this.emitLine(", false, "+this._templateName()+", false, "+this.makeCallback(n)),this.addScopeLevel(),this.emitLine(n+".getExported("+(e.withContext?"context.getVariables(), frame, ":"")+this.makeCallback(n)),this.addScopeLevel(),t.set(i,n),t.parent?this.emitLine('frame.set("'+i+'", '+n+");"):this.emitLine('context.setVariable("'+i+'", '+n+");")},compileFromImport:function(e,t){var n=this.tmpid();this.emit("env.getTemplate("),this._compileExpression(e.template,t),this.emitLine(", false, "+this._templateName()+", false, "+this.makeCallback(n)),this.addScopeLevel(),this.emitLine(n+".getExported("+(e.withContext?"context.getVariables(), frame, ":"")+this.makeCallback(n)),this.addScopeLevel(),r.each(e.names.children,function(e){var i,r,s=this.tmpid();e instanceof a.Pair?(i=e.key.value,r=e.value.value):(i=e.value,r=i),this.emitLine("if("+n+'.hasOwnProperty("'+i+'")) {'),this.emitLine("var "+s+" = "+n+"."+i+";"),this.emitLine("} else {"),this.emitLine("cb(new Error(\"cannot import '"+i+"'\")); return;"),this.emitLine("}"),t.set(r,s),t.parent?this.emitLine('frame.set("'+r+'", '+s+");"):this.emitLine('context.setVariable("'+r+'", '+s+");")},this)},compileBlock:function(e){var t=this.tmpid();this.inBlock||this.emit('(parentTemplate ? function(e, c, f, r, cb) { cb(""); } : '),this.emit('context.getBlock("'+e.name.value+'")'),this.inBlock||this.emit(")"),this.emitLine("(env, context, frame, runtime, "+this.makeCallback(t)),this.emitLine(this.buffer+" += "+t+";"),this.addScopeLevel()},compileSuper:function(e,t){var n=e.blockName.value,i=e.symbol.value;this.emitLine('context.getSuper(env, "'+n+'", b_'+n+", frame, runtime, "+this.makeCallback(i)),this.emitLine(i+" = runtime.markSafe("+i+");"),this.addScopeLevel(),t.set(i,i)},compileExtends:function(e,t){var n=this.tmpid();this.emit("env.getTemplate("),this._compileExpression(e.template,t),this.emitLine(", true, "+this._templateName()+", false, "+this.makeCallback("_parentTemplate")),this.emitLine("parentTemplate = _parentTemplate"),this.emitLine("for(var "+n+" in parentTemplate.blocks) {"),this.emitLine("context.addBlock("+n+", parentTemplate.blocks["+n+"]);"),this.emitLine("}"),this.addScopeLevel()},compileInclude:function(e,t){var n=this.tmpid(),i=this.tmpid();this.emit("env.getTemplate("),this._compileExpression(e.template,t),this.emitLine(", false, "+this._templateName()+", "+e.ignoreMissing+", "+this.makeCallback(n)),this.addScopeLevel(),this.emitLine(n+".render(context.getVariables(), frame, "+this.makeCallback(i)),this.emitLine(this.buffer+" += "+i),this.addScopeLevel()},compileTemplateData:function(e,t){this.compileLiteral(e,t)},compileCapture:function(e,t){this.emitLine("(function() {"),this.emitLine('var output = "";'),this.withScopedSyntax(function(){this.compile(e.body,t)}),this.emitLine("return output;"),this.emitLine("})()")},compileOutput:function(e,t){for(var n=e.children,i=0,r=n.length;r>i;
13932i++)n[i]instanceof a.TemplateData?n[i].value&&(this.emit(this.buffer+" += "),this.compileLiteral(n[i],t),this.emitLine(";")):(this.emit(this.buffer+" += runtime.suppressValue("),this.throwOnUndefined&&this.emit("runtime.ensureDefined("),this.compile(n[i],t),this.throwOnUndefined&&this.emit(","+e.lineno+","+e.colno+")"),this.emit(", env.opts.autoescape);\n"))},compileRoot:function(e,t){t&&this.fail("compileRoot: root node can't have frame"),t=new c,this.emitFuncBegin("root"),this.emitLine("var parentTemplate = null;"),this._compileChildren(e,t),this.emitLine("if(parentTemplate) {"),this.emitLine("parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);"),this.emitLine("} else {"),this.emitLine("cb(null, "+this.buffer+");"),this.emitLine("}"),this.emitFuncEnd(!0),this.inBlock=!0;var n,i,r,s=[],o=e.findAll(a.Block);for(n=0;n<o.length;n++){if(r=o[n],i=r.name.value,-1!==s.indexOf(i))throw new Error('Block "'+i+'" defined more than once.');s.push(i),this.emitFuncBegin("b_"+i);var l=new c;this.compile(r.body,l),this.emitFuncEnd()}for(this.emitLine("return {"),n=0;n<o.length;n++)r=o[n],i="b_"+r.name.value,this.emitLine(i+": "+i+",");this.emitLine("root: root\n};")},compile:function(e,t){var n=this["compile"+e.typename];n?n.call(this,e,t):this.fail("compile: Cannot compile node: "+e.typename,e.lineno,e.colno)},getCode:function(){return this.codebuf.join("")}});e.exports={compile:function(e,t,n,i,r){var a=new u(i,r.throwOnUndefined);if(n&&n.length)for(var l=0;l<n.length;l++)"preprocess"in n[l]&&(e=n[l].preprocess(e,i));return a.compile(o.transform(s.parse(e,n,r),t,i)),a.getCode()},Compiler:u}},function(e,t,n){"use strict";var i=n(9),r=n(10),s=n(6),o=n(1),a=s.extend({init:function(e){this.tokens=e,this.peeked=null,this.breakOnBlocks=null,this.dropLeadingWhitespace=!1,this.extensions=[]},nextToken:function(e){var t;if(this.peeked){if(e||this.peeked.type!==i.TOKEN_WHITESPACE)return t=this.peeked,this.peeked=null,t;this.peeked=null}if(t=this.tokens.nextToken(),!e)for(;t&&t.type===i.TOKEN_WHITESPACE;)t=this.tokens.nextToken();return t},peekToken:function(){return this.peeked=this.peeked||this.nextToken(),this.peeked},pushToken:function(e){if(this.peeked)throw new Error("pushToken: can only push one token on between reads");this.peeked=e},fail:function(e,t,n){if((void 0===t||void 0===n)&&this.peekToken()){var i=this.peekToken();t=i.lineno,n=i.colno}throw void 0!==t&&(t+=1),void 0!==n&&(n+=1),new o.TemplateError(e,t,n)},skip:function(e){var t=this.nextToken();return t&&t.type===e?!0:(this.pushToken(t),!1)},expect:function(e){var t=this.nextToken();return t.type!==e&&this.fail("expected "+e+", got "+t.type,t.lineno,t.colno),t},skipValue:function(e,t){var n=this.nextToken();return n&&n.type===e&&n.value===t?!0:(this.pushToken(n),!1)},skipSymbol:function(e){return this.skipValue(i.TOKEN_SYMBOL,e)},advanceAfterBlockEnd:function(e){var t;return e||(t=this.peekToken(),t||this.fail("unexpected end of file"),t.type!==i.TOKEN_SYMBOL&&this.fail("advanceAfterBlockEnd: expected symbol token or explicit name to be passed"),e=this.nextToken().value),t=this.nextToken(),t&&t.type===i.TOKEN_BLOCK_END?"-"===t.value.charAt(0)&&(this.dropLeadingWhitespace=!0):this.fail("expected block end in "+e+" statement"),t},advanceAfterVariableEnd:function(){this.skip(i.TOKEN_VARIABLE_END)||this.fail("expected variable end")},parseFor:function(){var e,t,n=this.peekToken();this.skipSymbol("for")?(e=new r.For(n.lineno,n.colno),t="endfor"):this.skipSymbol("asyncEach")?(e=new r.AsyncEach(n.lineno,n.colno),t="endeach"):this.skipSymbol("asyncAll")?(e=new r.AsyncAll(n.lineno,n.colno), 13933t="endall"):this.fail("parseFor: expected for{Async}",n.lineno,n.colno),e.name=this.parsePrimary(),e.name instanceof r.Symbol||this.fail("parseFor: variable name expected for loop");var s=this.peekToken().type;if(s===i.TOKEN_COMMA){var o=e.name;for(e.name=new r.Array(o.lineno,o.colno),e.name.addChild(o);this.skip(i.TOKEN_COMMA);){var a=this.parsePrimary();e.name.addChild(a)}}return this.skipSymbol("in")||this.fail('parseFor: expected "in" keyword for loop',n.lineno,n.colno),e.arr=this.parseExpression(),this.advanceAfterBlockEnd(n.value),e.body=this.parseUntilBlocks(t,"else"),this.skipSymbol("else")&&(this.advanceAfterBlockEnd("else"),e.else_=this.parseUntilBlocks(t)),this.advanceAfterBlockEnd(),e},parseMacro:function(){var e=this.peekToken();this.skipSymbol("macro")||this.fail("expected macro");var t=this.parsePrimary(!0),n=this.parseSignature(),i=new r.Macro(e.lineno,e.colno,t,n);return this.advanceAfterBlockEnd(e.value),i.body=this.parseUntilBlocks("endmacro"),this.advanceAfterBlockEnd(),i},parseCall:function(){var e=this.peekToken();this.skipSymbol("call")||this.fail("expected call");var t=this.parseSignature(!0)||new r.NodeList,n=this.parsePrimary();this.advanceAfterBlockEnd(e.value);var i=this.parseUntilBlocks("endcall");this.advanceAfterBlockEnd();var s=new r.Symbol(e.lineno,e.colno,"caller"),o=new r.Caller(e.lineno,e.colno,s,t,i),a=n.args.children;a[a.length-1]instanceof r.KeywordArgs||a.push(new r.KeywordArgs);var l=a[a.length-1];return l.addChild(new r.Pair(e.lineno,e.colno,s,o)),new r.Output(e.lineno,e.colno,[n])},parseWithContext:function(){var e=this.peekToken(),t=null;return this.skipSymbol("with")?t=!0:this.skipSymbol("without")&&(t=!1),null!==t&&(this.skipSymbol("context")||this.fail("parseFrom: expected context after with/without",e.lineno,e.colno)),t},parseImport:function(){var e=this.peekToken();this.skipSymbol("import")||this.fail("parseImport: expected import",e.lineno,e.colno);var t=this.parseExpression();this.skipSymbol("as")||this.fail('parseImport: expected "as" keyword',e.lineno,e.colno);var n=this.parsePrimary(),i=this.parseWithContext(),s=new r.Import(e.lineno,e.colno,t,n,i);return this.advanceAfterBlockEnd(e.value),s},parseFrom:function(){var e=this.peekToken();this.skipSymbol("from")||this.fail("parseFrom: expected from");var t=this.parsePrimary();this.skipSymbol("import")||this.fail("parseFrom: expected import",e.lineno,e.colno);
13933for(var n,s=new r.NodeList;;){var o=this.peekToken();if(o.type===i.TOKEN_BLOCK_END){s.children.length||this.fail("parseFrom: Expected at least one import name",e.lineno,e.colno),"-"===o.value.charAt(0)&&(this.dropLeadingWhitespace=!0),this.nextToken();break}s.children.length>0&&!this.skip(i.TOKEN_COMMA)&&this.fail("parseFrom: expected comma",e.lineno,e.colno);var a=this.parsePrimary();if("_"===a.value.charAt(0)&&this.fail("parseFrom: names starting with an underscore cannot be imported",a.lineno,a.colno),this.skipSymbol("as")){var l=this.parsePrimary();s.addChild(new r.Pair(a.lineno,a.colno,a,l))}else s.addChild(a);n=this.parseWithContext()}return new r.FromImport(e.lineno,e.colno,t,s,n)},parseBlock:function(){var e=this.peekToken();this.skipSymbol("block")||this.fail("parseBlock: expected block",e.lineno,e.colno);var t=new r.Block(e.lineno,e.colno);t.name=this.parsePrimary(),t.name instanceof r.Symbol||this.fail("parseBlock: variable name expected",e.lineno,e.colno),this.advanceAfterBlockEnd(e.value),t.body=this.parseUntilBlocks("endblock"),this.skipSymbol("endblock"),this.skipSymbol(t.name.value);var n=this.peekToken();return n||this.fail("parseBlock: expected endblock, got end of file"),this.advanceAfterBlockEnd(n.value),t},parseExtends:function(){var e="extends",t=this.peekToken();this.skipSymbol(e)||this.fail("parseTemplateRef: expected "+e);var n=new r.Extends(t.lineno,t.colno);return n.template=this.parseExpression(),this.advanceAfterBlockEnd(t.value),n},parseInclude:function(){var e="include",t=this.peekToken();this.skipSymbol(e)||this.fail("parseInclude: expected "+e);var n=new r.Include(t.lineno,t.colno);return n.template=this.parseExpression(),this.skipSymbol("ignore")&&this.skipSymbol("missing")&&(n.ignoreMissing=!0),this.advanceAfterBlockEnd(t.value),n},parseIf:function(){var e,t=this.peekToken();this.skipSymbol("if")||this.skipSymbol("elif")?e=new r.If(t.lineno,t.colno):this.skipSymbol("ifAsync")?e=new r.IfAsync(t.lineno,t.colno):this.fail("parseIf: expected if or elif",t.lineno,t.colno),e.cond=this.parseExpression(),this.advanceAfterBlockEnd(t.value),e.body=this.parseUntilBlocks("elif","else","endif");var n=this.peekToken();switch(n&&n.value){case"elif":e.else_=this.parseIf();break;case"else":this.advanceAfterBlockEnd(),e.else_=this.parseUntilBlocks("endif"),this.advanceAfterBlockEnd();break;case"endif":e.else_=null,this.advanceAfterBlockEnd();break;default:this.fail("parseIf: expected elif, else, or endif, got end of file")}return e},parseSet:function(){var e=this.peekToken();this.skipSymbol("set")||this.fail("parseSet: expected set",e.lineno,e.colno);for(var t,n=new r.Set(e.lineno,e.colno,[]);(t=this.parsePrimary())&&(n.targets.push(t),this.skip(i.TOKEN_COMMA)););return this.skipValue(i.TOKEN_OPERATOR,"=")?(n.value=this.parseExpression(),this.advanceAfterBlockEnd(e.value)):this.skip(i.TOKEN_BLOCK_END)?(n.body=new r.Capture(e.lineno,e.colno,this.parseUntilBlocks("endset")),n.value=null,this.advanceAfterBlockEnd()):this.fail("parseSet: expected = or block end in set tag",e.lineno,e.colno),n},parseStatement:function(){var e,t=this.peekToken();if(t.type!==i.TOKEN_SYMBOL&&this.fail("tag name expected",t.lineno,t.colno),this.breakOnBlocks&&-1!==o.indexOf(this.breakOnBlocks,t.value))return null;switch(t.value){case"raw":return this.parseRaw();case"if":case"ifAsync":return this.parseIf();case"for":case"asyncEach":case"asyncAll":return this.parseFor();case"block":return this.parseBlock();case"extends":return this.parseExtends();case"include":return this.parseInclude();case"set":return this.parseSet();case"macro":return this.parseMacro();case"call":return this.parseCall();case"import":return this.parseImport();case"from":return this.parseFrom();case"filter":return this.parseFilterStatement();default:if(this.extensions.length)for(var n=0;n<this.extensions.length;n++){var s=this.extensions[n];if(-1!==o.indexOf(s.tags||[],t.value))return s.parse(this,r,i)}this.fail("unknown block tag: "+t.value,t.lineno,t.colno)}return e},parseRaw:function(){for(var e=/([\s\S]*?){%\s*(raw|endraw)\s*(?=%})%}/,t=1,n="",i=null,s=this.advanceAfterBlockEnd();(i=this.tokens._extractRegex(e))&&t>0;){var o=i[0],a=i[1],l=i[2];"raw"===l?t+=1:"endraw"===l&&(t-=1),0===t?(n+=a,this.tokens.backN(o.length-a.length)):n+=o}return new r.Output(s.lineno,s.colno,[new r.TemplateData(s.lineno,s.colno,n)])},parsePostfix:function(e){for(var t,n=this.peekToken();n;){if(n.type===i.TOKEN_LEFT_PAREN)e=new r.FunCall(n.lineno,n.colno,e,this.parseSignature());else if(n.type===i.TOKEN_LEFT_BRACKET)t=this.parseAggregate(),t.children.length>1&&this.fail("invalid index"),e=new r.LookupVal(n.lineno,n.colno,e,t.children[0]);else{if(n.type!==i.TOKEN_OPERATOR||"."!==n.value)break;this.nextToken();var s=this.nextToken();s.type!==i.TOKEN_SYMBOL&&this.fail("expected name as lookup value, got "+s.value,s.lineno,s.colno),t=new r.Literal(s.lineno,s.colno,s.value),e=new r.LookupVal(n.lineno,n.colno,e,t)}n=this.peekToken()}return e},parseExpression:function(){var e=this.parseInlineIf();return e},parseInlineIf:function(){var e=this.parseOr();if(this.skipSymbol("if")){var t=this.parseOr(),n=e;e=new r.InlineIf(e.lineno,e.colno),e.body=n,e.cond=t,this.skipSymbol("else")?e.else_=this.parseOr():e.else_=null}return e},parseOr:function(){for(var e=this.parseAnd();this.skipSymbol("or");){var t=this.parseAnd();e=new r.Or(e.lineno,e.colno,e,t)}return e},parseAnd:function(){for(var e=this.parseNot();this.skipSymbol("and");){var t=this.parseNot();e=new r.And(e.lineno,e.colno,e,t)}return e},parseNot:function(){var e=this.peekToken();return this.skipSymbol("not")?new r.Not(e.lineno,e.colno,this.parseNot()):this.parseIn()},parseIn:function(){for(var e=this.parseCompare();;){var t=this.nextToken();if(!t)break;var n=t.type===i.TOKEN_SYMBOL&&"not"===t.value;if(n||this.pushToken(t),!this.skipSymbol("in")){n&&this.pushToken(t);break}var s=this.parseCompare();e=new r.In(e.lineno,e.colno,e,s),n&&(e=new r.Not(e.lineno,e.colno,e))}return e},parseCompare:function(){for(var e=["==","!=","<",">","<=",">="],t=this.parseConcat(),n=[];;){var i=this.nextToken();if(!i)break;if(-1===o.indexOf(e,i.value)){this.pushToken(i);break}n.push(new r.CompareOperand(i.lineno,i.colno,this.parseConcat(),i.value))}return n.length?new r.Compare(n[0].lineno,n[0].colno,t,n):t},parseConcat:function(){for(var e=this.parseAdd();this.skipValue(i.TOKEN_TILDE,"~");){var t=this.parseAdd();e=new r.Concat(e.lineno,e.colno,e,t)}return e},parseAdd:function(){for(var e=this.parseSub();this.skipValue(i.TOKEN_OPERATOR,"+");){var t=this.parseSub();e=new r.Add(e.lineno,e.colno,e,t)}return e},parseSub:function(){for(var e=this.parseMul();this.skipValue(i.TOKEN_OPERATOR,"-");){var t=this.parseMul();e=new r.Sub(e.lineno,e.colno,e,t)}return e},parseMul:function(){for(var e=this.parseDiv();this.skipValue(i.TOKEN_OPERATOR,"*");){var t=this.parseDiv();e=new r.Mul(e.lineno,e.colno,e,t)}return e},parseDiv:function(){for(var e=this.parseFloorDiv();this.skipValue(i.TOKEN_OPERATOR,"/");){var t=this.parseFloorDiv();e=new r.Div(e.lineno,e.colno,e,t)}return e},parseFloorDiv:function(){for(var e=this.parseMod();this.skipValue(i.TOKEN_OPERATOR,"//");){var t=this.parseMod();e=new r.FloorDiv(e.lineno,e.colno,e,t)}return e},parseMod:function(){for(var e=this.parsePow();this.skipValue(i.TOKEN_OPERATOR,"%");){var t=this.parsePow();e=new r.Mod(e.lineno,e.colno,e,t)}return e},parsePow:function(){for(var e=this.parseUnary();this.skipValue(i.TOKEN_OPERATOR,"**");){var t=this.parseUnary();e=new r.Pow(e.lineno,e.colno,e,t)}return e},parseUnary:function(e){var t,n=this.peekToken();return t=this.skipValue(i.TOKEN_OPERATOR,"-")?new r.Neg(n.lineno,n.colno,this.parseUnary(!0)):this.skipValue(i.TOKEN_OPERATOR,"+")?new r.Pos(n.lineno,n.colno,this.parseUnary(!0)):this.parsePrimary(),e||(t=this.parseFilter(t)),t},parsePrimary:function(e){var t,n=this.nextToken(),s=null;return n?n.type===i.TOKEN_STRING?t=n.value:n.type===i.TOKEN_INT?t=parseInt(n.value,10):n.type===i.TOKEN_FLOAT?t=parseFloat(n.value):n.type===i.TOKEN_BOOLEAN?"true"===n.value?t=!0:"false"===n.value?t=!1:this.fail("invalid boolean: "+n.value,
13933n.lineno,n.colno):n.type===i.TOKEN_NONE?t=null:n.type===i.TOKEN_REGEX&&(t=new RegExp(n.value.body,n.value.flags)):this.fail("expected expression, got end of file"),void 0!==t?s=new r.Literal(n.lineno,n.colno,t):n.type===i.TOKEN_SYMBOL?(s=new r.Symbol(n.lineno,n.colno,n.value),e||(s=this.parsePostfix(s))):(this.pushToken(n),s=this.parseAggregate()),s?s:void this.fail("unexpected token: "+n.value,n.lineno,n.colno)},parseFilterName:function(){for(var e=this.expect(i.TOKEN_SYMBOL),t=e.value;this.skipValue(i.TOKEN_OPERATOR,".");)t+="."+this.expect(i.TOKEN_SYMBOL).value;return new r.Symbol(e.lineno,e.colno,t)},parseFilterArgs:function(e){if(this.peekToken().type===i.TOKEN_LEFT_PAREN){var t=this.parsePostfix(e);return t.args.children}return[]},parseFilter:function(e){for(;this.skip(i.TOKEN_PIPE);){var t=this.parseFilterName();e=new r.Filter(t.lineno,t.colno,t,new r.NodeList(t.lineno,t.colno,[e].concat(this.parseFilterArgs(e))))}return e},parseFilterStatement:function(){var e=this.peekToken();this.skipSymbol("filter")||this.fail("parseFilterStatement: expected filter");var t=this.parseFilterName(),n=this.parseFilterArgs(t);this.advanceAfterBlockEnd(e.value);var i=new r.Capture(t.lineno,t.colno,this.parseUntilBlocks("endfilter"));this.advanceAfterBlockEnd();var s=new r.Filter(t.lineno,t.colno,t,new r.NodeList(t.lineno,t.colno,[i].concat(n)));return new r.Output(t.lineno,t.colno,[s])},parseAggregate:function(){var e,t=this.nextToken();switch(t.type){case i.TOKEN_LEFT_PAREN:e=new r.Group(t.lineno,t.colno);break;case i.TOKEN_LEFT_BRACKET:e=new r.Array(t.lineno,t.colno);break;case i.TOKEN_LEFT_CURLY:e=new r.Dict(t.lineno,t.colno);break;default:return null}for(;;){var n=this.peekToken().type;if(n===i.TOKEN_RIGHT_PAREN||n===i.TOKEN_RIGHT_BRACKET||n===i.TOKEN_RIGHT_CURLY){this.nextToken();break}if(e.children.length>0&&(this.skip(i.TOKEN_COMMA)||this.fail("parseAggregate: expected comma after expression",t.lineno,t.colno)),e instanceof r.Dict){var s=this.parsePrimary();this.skip(i.TOKEN_COLON)||this.fail("parseAggregate: expected colon after dict key",t.lineno,t.colno);var o=this.parseExpression();e.addChild(new r.Pair(s.lineno,s.colno,s,o))}else{var a=this.parseExpression();e.addChild(a)}}return e},parseSignature:function(e,t){var n=this.peekToken();if(!t&&n.type!==i.TOKEN_LEFT_PAREN){if(e)return null;this.fail("expected arguments",n.lineno,n.colno)}n.type===i.TOKEN_LEFT_PAREN&&(n=this.nextToken());for(var s=new r.NodeList(n.lineno,n.colno),o=new r.KeywordArgs(n.lineno,n.colno),a=!1;;){if(n=this.peekToken(),!t&&n.type===i.TOKEN_RIGHT_PAREN){this.nextToken();break}if(t&&n.type===i.TOKEN_BLOCK_END)break;if(a&&!this.skip(i.TOKEN_COMMA))this.fail("parseSignature: expected comma after expression",n.lineno,n.colno);else{var l=this.parseExpression();this.skipValue(i.TOKEN_OPERATOR,"=")?o.addChild(new r.Pair(l.lineno,l.colno,l,this.parseExpression())):s.addChild(l)}a=!0}return o.children.length&&s.addChild(o),s},parseUntilBlocks:function(){var e=this.breakOnBlocks;this.breakOnBlocks=o.toArray(arguments);var t=this.parse();return this.breakOnBlocks=e,t},parseNodes:function(){for(var e,t=[];e=this.nextToken();)if(e.type===i.TOKEN_DATA){var n=e.value,s=this.peekToken(),o=s&&s.value;this.dropLeadingWhitespace&&(n=n.replace(/^\s*/,""),this.dropLeadingWhitespace=!1),s&&(s.type===i.TOKEN_BLOCK_START&&"-"===o.charAt(o.length-1)||s.type===i.TOKEN_COMMENT&&"-"===o.charAt(this.tokens.tags.COMMENT_START.length))&&(n=n.replace(/\s*$/,"")),t.push(new r.Output(e.lineno,e.colno,[new r.TemplateData(e.lineno,e.colno,n)]))}else if(e.type===i.TOKEN_BLOCK_START){this.dropLeadingWhitespace=!1;var a=this.parseStatement();if(!a)break;t.push(a)}else if(e.type===i.TOKEN_VARIABLE_START){var l=this.parseExpression();this.advanceAfterVariableEnd(),this.dropLeadingWhitespace=!1,t.push(new r.Output(e.lineno,e.colno,[l]))}else e.type===i.TOKEN_COMMENT?this.dropLeadingWhitespace="-"===e.value.charAt(e.value.length-this.tokens.tags.COMMENT_END.length-1):this.fail("Unexpected token at top-level: "+e.type,e.lineno,e.colno);return t},parse:function(){return new r.NodeList(0,0,this.parseNodes())},parseAsRoot:function(){return new r.Root(0,0,this.parseNodes())}});e.exports={parse:function(e,t,n){var r=new a(i.lex(e,n));return void 0!==t&&(r.extensions=t),r.parseAsRoot()}}},function(e,t,n){"use strict";function i(e,t,n,i){return{type:e,value:t,lineno:n,colno:i}}function r(e,t){this.str=e,this.index=0,this.len=e.length,this.lineno=0,this.colno=0,this.in_code=!1,t=t||{};var n=t.tags||{};this.tags={BLOCK_START:n.blockStart||c,BLOCK_END:n.blockEnd||h,VARIABLE_START:n.variableStart||u,VARIABLE_END:n.variableEnd||p,COMMENT_START:n.commentStart||f,COMMENT_END:n.commentEnd||m},this.trimBlocks=!!t.trimBlocks,this.lstripBlocks=!!t.lstripBlocks}var s=n(1),o=" \n \r ",a="()[]{}%*-+~/#,:|.<>=!",l="0123456789",c="{%",h="%}",u="{{",p="}}",f="{#",m="#}
13933",d="string",v="whitespace",g="data",y="block-start",k="block-end",x="variable-start",b="variable-end",E="comment",w="left-paren",T="right-paren",L="left-bracket",O="right-bracket",_="left-curly",A="right-curly",S="operator",N="comma",C="colon",B="tilde",F="pipe",K="int",R="float",I="boolean",M="none",P="symbol",D="special",V="regex";r.prototype.nextToken=function(){var e,t=this.lineno,n=this.colno;if(this.in_code){var r=this.current();if(this.is_finished())return null;if('"'===r||"'"===r)return i(d,this.parseString(r),t,n);if(e=this._extract(o))return i(v,e,t,n);if((e=this._extractString(this.tags.BLOCK_END))||(e=this._extractString("-"+this.tags.BLOCK_END)))return this.in_code=!1,this.trimBlocks&&(r=this.current(),"\n"===r?this.forward():"\r"===r&&(this.forward(),r=this.current(),"\n"===r?this.forward():this.back())),i(k,e,t,n);if(e=this._extractString(this.tags.VARIABLE_END))return this.in_code=!1,i(b,e,t,n);if("r"===r&&"/"===this.str.charAt(this.index+1)){this.forwardN(2);for(var c="";!this.is_finished();){if("/"===this.current()&&"\\"!==this.previous()){this.forward();break}c+=this.current(),this.forward()}for(var h=["g","i","m","y"],u="";!this.is_finished();){var p=-1!==h.indexOf(this.current());if(!p)break;u+=this.current(),this.forward()}return i(V,{body:c,flags:u},t,n)}if(-1!==a.indexOf(r)){this.forward();var f,m=["==","!=","<=",">=","//","**"],D=r+this.current();switch(-1!==s.indexOf(m,D)&&(this.forward(),r=D),r){case"(":f=w;break;case")":f=T;break;case"[":f=L;break;case"]":f=O;break;case"{":f=_;break;case"}":f=A;break;case",":f=N;break;case":":f=C;break;case"~":f=B;break;case"|":f=F;break;default:f=S}return i(f,r,t,n)}if(e=this._extractUntil(o+a),e.match(/^[-+]?[0-9]+$/)){if("."===this.current()){this.forward();var j=this._extract(l);return i(R,e+"."+j,t,n)}return i(K,e,t,n)}if(e.match(/^(true|false)$/))return i(I,e,t,n);if("none"===e)return i(M,e,t,n);if(e)return i(P,e,t,n);throw new Error("Unexpected value while parsing: "+e)}var U=this.tags.BLOCK_START.charAt(0)+this.tags.VARIABLE_START.charAt(0)+this.tags.COMMENT_START.charAt(0)+this.tags.COMMENT_END.charAt(0);if(this.is_finished())return null;if((e=this._extractString(this.tags.BLOCK_START+"-"))||(e=this._extractString(this.tags.BLOCK_START)))return this.in_code=!0,i(y,e,t,n);if(e=this._extractString(this.tags.VARIABLE_START))return this.in_code=!0,i(x,e,t,n);e="";var W,G=!1;for(this._matches(this.tags.COMMENT_START)&&(G=!0,e=this._extractString(this.tags.COMMENT_START));null!==(W=this._extractUntil(U));){if(e+=W,(this._matches(this.tags.BLOCK_START)||this._matches(this.tags.VARIABLE_START)||this._matches(this.tags.COMMENT_START))&&!G){if(this.lstripBlocks&&this._matches(this.tags.BLOCK_START)&&this.colno>0&&this.colno<=e.length){var Y=e.slice(-this.colno);if(/^\s+$/.test(Y)&&(e=e.slice(0,-this.colno),!e.length))return this.nextToken()}break}if(this._matches(this.tags.COMMENT_END)){if(!G)throw new Error("unexpected end of comment");e+=this._extractString(this.tags.COMMENT_END);break}e+=this.current(),this.forward()}if(null===W&&G)throw new Error("expected end of comment, got end of file");return i(G?E:g,e,t,n)},r.prototype.parseString=function(e){this.forward();for(var t="";!this.is_finished()&&this.current()!==e;){var n=this.current();if("\\"===n){switch(this.forward(),this.current()){case"n":t+="\n";break;case"t":t+=" ";break;case"r":t+="\r";break;default:t+=this.current()}this.forward()}else t+=n,this.forward()}return this.forward(),t},r.prototype._matches=function(e){if(this.index+e.length>this.len)return null;var t=this.str.slice(this.index,this.index+e.length);return t===e},r.prototype._extractString=function(e){return this._matches(e)?(this.index+=e.length,e):null},r.prototype._extractUntil=function(e){return this._extractMatching(!0,e||"")},r.prototype._extract=function(e){return this._extractMatching(!1,e)},r.prototype._extractMatching=function(e,t){if(this.is_finished())return null;var n=t.indexOf(this.current());if(e&&-1===n||!e&&-1!==n){var i=this.current();this.forward();for(var r=t.indexOf(this.current());(e&&-1===r||!e&&-1!==r)&&!this.is_finished();)i+=this.current(),this.forward(),r=t.indexOf(this.current());return i}return""},r.prototype._extractRegex=function(e){var t=this.currentStr().match(e);return t?(this.forwardN(t[0].length),t):null},r.prototype.is_finished=function(){return this.index>=this.len},r.prototype.forwardN=function(e){for(var t=0;e>t;t++)this.forward()},r.prototype.forward=function(){this.index++,"\n"===this.previous()?(this.lineno++,this.colno=0):this.colno++},r.prototype.backN=function(e){for(var t=0;e>t;t++)this.back()},r.prototype.back=function(){if(this.index--,"\n"===this.current()){this.lineno--;var e=this.src.lastIndexOf("\n",this.index-1);-1===e?this.colno=this.index:this.colno=this.index-e}else this.colno--},r.prototype.current=function(){return this.is_finished()?"":this.str.charAt(this.index)},r.prototype.currentStr=function(){return this.is_finished()?"":this.str.substr(this.index)},r.prototype.previous=function(){return this.str.charAt(this.index-1)},e.exports={lex:function(e,t){return new r(e,t)},TOKEN_STRING:d,TOKEN_WHITESPACE:v,TOKEN_DATA:g,TOKEN_BLOCK_START:y,TOKEN_BLOCK_END:k,TOKEN_VARIABLE_START:x,TOKEN_VARIABLE_END:b,TOKEN_COMMENT:E,TOKEN_LEFT_PAREN:w,TOKEN_RIGHT_PAREN:T,TOKEN_LEFT_BRACKET:L,TOKEN_RIGHT_BRACKET:O,TOKEN_
13933LEFT_CURLY:_,TOKEN_RIGHT_CURLY:A,TOKEN_OPERATOR:S,TOKEN_COMMA:N,TOKEN_COLON:C,TOKEN_TILDE:B,TOKEN_PIPE:F,TOKEN_INT:K,TOKEN_FLOAT:R,TOKEN_BOOLEAN:I,TOKEN_NONE:M,TOKEN_SYMBOL:P,TOKEN_SPECIAL:D,TOKEN_REGEX:V}},function(e,t,n){(function(t){"use strict";function i(e,t,n){e instanceof t&&n.push(e),e instanceof a&&e.findAll(t,n)}function r(e,n){function i(e,n,i){for(var r=e.split("\n"),s=0;s<r.length;s++){if(r[s]&&(i&&s>0||!i))for(var o=0;n>o;o++)t.stdout.write(" ");s===r.length-1?t.stdout.write(r[s]):t.stdout.write(r[s]+"\n")}}if(n=n||0,i(e.typename+": ",n),e instanceof c)i("\n"),s.each(e.children,function(e){r(e,n+2)});else if(e instanceof se)i(e.extName+"."+e.prop),i("\n"),e.args&&r(e.args,n+2),e.contentArgs&&s.each(e.contentArgs,function(e){r(e,n+2)});else{var o=null,l=null;if(e.iterFields(function(e,t){e instanceof a?(o=o||{},o[t]=e):(l=l||{},l[t]=e)}),l?i(JSON.stringify(l,null,2)+"\n",null,!0):i("\n"),o)for(var h in o)r(o[h],n+2)}}var s=n(1),o=n(6),a=o.extend("Node",{init:function(e,t){this.lineno=e,this.colno=t;for(var n=this.fields,i=0,r=n.length;r>i;i++){var s=n[i],o=arguments[i+2];void 0===o&&(o=null),this[s]=o}},findAll:function(e,t){t=t||[];var n,r;if(this instanceof c){var s=this.children;for(n=0,r=s.length;r>n;n++)i(s[n],e,t)}else{var o=this.fields;for(n=0,r=o.length;r>n;n++)i(this[o[n]],e,t)}return t},iterFields:function(e){s.each(this.fields,function(t){e(this[t],t)},this)}}),l=a.extend("Value",{fields:["value"]}),c=a.extend("NodeList",{fields:["children"],init:function(e,t,n){this.parent(e,t,n||[])},addChild:function(e){this.children.push(e)}}),h=c.extend("Root"),u=l.extend("Literal"),p=l.extend("Symbol"),f=c.extend("Group"),m=c.extend("Array"),d=a.extend("Pair",{fields:["key","value"]}),v=c.extend("Dict"),g=a.extend("LookupVal",{fields:["target","val"]}),y=a.extend("If",{fields:["cond","body","else_"]}),k=y.extend("IfAsync"),x=a.extend("InlineIf",{fields:["cond","body","else_"]}),b=a.extend("For",{fields:["arr","name","body","else_"]}),E=b.extend("AsyncEach"),w=b.extend("AsyncAll"),T=a.extend("Macro",{fields:["name","args","body"]}),L=T.extend("Caller"),O=a.extend("Import",{fields:["template","target","withContext"]}),_=a.extend("FromImport",{fields:["template","names","withContext"],init:function(e,t,n,i,r){this.parent(e,t,n,i||new c,r)}}),A=a.extend("FunCall",{fields:["name","args"]}),S=A.extend("Filter"),N=S.extend("FilterAsync",{fields:["name","args","symbol"]}),C=v.extend("KeywordArgs"),B=a.extend("Block",{fields:["name","body"]}),F=a.extend("Super",{fields:["blockName","symbol"]}),K=a.extend("TemplateRef",{fields:["template"]}),R=K.extend("Extends"),I=a.extend("Include",{fields:["template","ignoreMissing"]}),M=a.extend("Set",{fields:["targets","value"]}),P=c.extend("Output"),D=a.extend("Capture",{fields:["body"]}),V=u.extend("TemplateData"),j=a.extend("UnaryOp",{fields:["target"]}),U=a.extend("BinOp",{fields:["left","right"]}),W=U.extend("In"),G=U.extend("Or"),Y=U.extend("And"),H=j.extend("Not"),$=U.extend("Add"),z=U.extend("Concat"),X=U.extend("Sub"),q=U.extend("Mul"),J=U.extend("Div"),Q=U.extend("FloorDiv"),Z=U.extend("Mod"),ee=U.extend("Pow"),te=j.extend("Neg"),ne=j.extend("Pos"),ie=a.extend("Compare",{fields:["expr","ops"]}),re=a.extend("CompareOperand",{fields:["expr","type"]}),se=a.extend("CallExtension",{fields:["extName","prop","args","contentArgs"],init:function(e,t,n,i){this.extName=e._name||e,this.prop=t,this.args=n||new c,this.contentArgs=i||[],this.autoescape=e.autoescape}}),oe=se.extend("CallExtensionAsync");e.exports={Node:a,Root:h,NodeList:c,Value:l,Literal:u,Symbol:p,Group:f,Array:m,Pair:d,Dict:v,Output:P,Capture:D,TemplateData:V,If:y,IfAsync:k,InlineIf:x,For:b,AsyncEach:E,AsyncAll:w,Macro:T,Caller:L,Import:O,FromImport:_,FunCall:A,Filter:S,FilterAsync:N,KeywordArgs:C,Block:B,Super:F,Extends:R,Include:I,Set:M,LookupVal:g,BinOp:U,In:W,Or:G,And:Y,Not:H,Add:$,Concat:z,Sub:X,Mul:q,Div:J,FloorDiv:Q,Mod:Z,Pow:ee,Neg:te,Pos:ne,Compare:ie,CompareOperand:re,CallExtension:se,CallExtensionAsync:oe,printNodes:r}}).call(t,n(3))},function(e,t,n){"use strict";function i(){return"hole_"+d++}function r(e,t){for(var n=null,i=0;i<e.length;i++){var r=t(e[i]);r!==e[i]&&(n||(n=e.slice()),n[i]=r)}return n||e}function s(e,t,n){if(!(e instanceof f.Node))return e;if(!n){var i=t(e);if(i&&i!==e)return i}if(e instanceof f.NodeList){var o=r(e.children,function(e){return s(e,t,n)});o!==e.children&&(e=new f[e.typename](e.lineno,e.colno,o))}else if(e instanceof f.CallExtension){var a=s(e.args,t,n),l=r(e.contentArgs,function(e){return s(e,t,n)});
13933(a!==e.args||l!==e.contentArgs)&&(e=new f[e.typename](e.extName,e.prop,a,l))}else{var c=e.fields.map(function(t){return e[t]}),h=r(c,function(e){return s(e,t,n)});h!==c&&(e=new f[e.typename](e.lineno,e.colno),h.forEach(function(t,n){e[e.fields[n]]=t}))}return n?t(e)||e:e}function o(e,t){return s(e,t,!0)}function a(e,t,n){var r=[],s=o(n?e[n]:e,function(e){if(e instanceof f.Block)return e;if(e instanceof f.Filter&&-1!==m.indexOf(t,e.name.value)||e instanceof f.CallExtensionAsync){var n=new f.Symbol(e.lineno,e.colno,i());return r.push(new f.FilterAsync(e.lineno,e.colno,e.name,e.args,n)),n}});return n?e[n]=s:e=s,r.length?(r.push(e),new f.NodeList(e.lineno,e.colno,r)):e}function l(e,t){return o(e,function(e){return e instanceof f.Output?a(e,t):e instanceof f.Set?a(e,t,"value"):e instanceof f.For?a(e,t,"arr"):e instanceof f.If?a(e,t,"cond"):e instanceof f.CallExtension?a(e,t,"args"):void 0})}function c(e){return s(e,function(e){if(e instanceof f.Block){var t=!1,n=i();e.body=s(e.body,function(e){return e instanceof f.FunCall&&"super"===e.name.value?(t=!0,new f.Symbol(e.lineno,e.colno,n)):void 0}),t&&e.body.children.unshift(new f.Super(0,0,e.name,new f.Symbol(0,0,n)))}})}function h(e){return o(e,function(e){if(e instanceof f.If||e instanceof f.For){var t=!1;if(s(e,function(e){return e instanceof f.FilterAsync||e instanceof f.IfAsync||e instanceof f.AsyncEach||e instanceof f.AsyncAll||e instanceof f.CallExtensionAsync?(t=!0,e):void 0}),t){if(e instanceof f.If)return new f.IfAsync(e.lineno,e.colno,e.cond,e.body,e.else_);if(e instanceof f.For)return new f.AsyncEach(e.lineno,e.colno,e.arr,e.name,e.body,e.else_)}}})}function u(e,t){return h(c(l(e,t)))}function p(e,t){return u(e,t||[])}var f=n(10),m=n(1),d=0;e.exports={transform:p}},function(e,t,n){"use strict";function i(e,t,n){return function(){var i,r,a=o(arguments),l=s(arguments);if(a>e.length){i=Array.prototype.slice.call(arguments,0,e.length);var c=Array.prototype.slice.call(arguments,i.length,a);for(r=0;r<c.length;r++)r<t.length&&(l[t[r]]=c[r]);i.push(l)}else if(a<e.length){for(i=Array.prototype.slice.call(arguments,0,a),r=a;r<e.length;r++){var h=e[r];i.push(l[h]),delete l[h]}i.push(l)}else i=arguments;return n.apply(this,i)}}function r(e){return e.__keywords=!0,e}function s(e){var t=e.length;if(t){var n=e[t-1];if(n&&n.hasOwnProperty("__keywords"))return n}return{}}function o(e){var t=e.length;if(0===t)return 0;var n=e[t-1];return n&&n.hasOwnProperty("__keywords")?t-1:t}function a(e){return"string"!=typeof e?e:(this.val=e,void(this.length=e.length))}function l(e,t){return e instanceof a?new a(t):t.toString()}function c(e){var t=typeof e;return"string"===t?new a(e):"function"!==t?e:function(){var t=e.apply(this,arguments);return"string"==typeof t?new a(t):t}}function h(e,t){return e=void 0!==e&&null!==e?e:"",t&&"string"==typeof e&&(e=y.escape(e)),e}function u(e,t,n){if(null===e||void 0===e)throw new y.TemplateError("attempted to output null or undefined value",t+1,n+1);return e}function p(e,t){return e=e||{},"function"==typeof e[t]?function(){return e[t].apply(e,arguments)}:e[t]}function f(e,t,n,i){if(!e)throw new Error("Unable to call `"+t+"`, which is undefined or falsey");if("function"!=typeof e)throw new Error("Unable to call `"+t+"`, which is not a function");return e.apply(n,i)}function m(e,t,n){var i=t.lookup(n);return void 0!==i&&null!==i?i:e.lookup(n)}function d(e,t,n){return e.lineno?e:new y.TemplateError(e,t,n)}function v(e,t,n,i){if(y.isArray(e)){var r=e.length;y.asyncIter(e,function(e,i,s){switch(t){case 1:n(e,i,r,s);break;case 2:n(e[0],e[1],i,r,s);break;case 3:n(e[0],e[1],e[2],i,r,s);break;default:e.push(i,s),n.apply(this,e)}},i)}else y.asyncFor(e,function(e,t,i,r,s){n(e,t,i,r,s)},i)}function g(e,t,n,i){function r(e,t){l++,a[e]=t,l===s&&i(null,a.join(""))}var s,o,a,l=0;if(y.isArray(e))if(s=e.length,a=new Array(s),0===s)i(null,"");else for(o=0;o<e.length;o++){var c=e[o];switch(t){case 1:n(c,o,s,r);break;case 2:n(c[0],c[1],o,s,r);break;case 3:n(c[0],c[1],c[2],o,s,r);break;default:c.push(o,r),n.apply(this,c)}}else{var h=y.keys(e);if(s=h.length,a=new Array(s),0===s)i(null,"");else for(o=0;o<h.length;o++){var u=h[o];n(u,e[u],o,s,r)}}}var y=n(1),k=n(6),x=k.extend({init:function(e,t){this.variables={},this.parent=e,this.topLevel=!1,this.isolateWrites=t},set:function(e,t,n){var i=e.split("."),r=this.variables,s=this;if(n&&(s=this.resolve(i[0],!0)))return void s.set(e,t);for(var o=0;o<i.length-1;o++){var a=i[o];r[a]||(r[a]={}),r=r[a]}r[i[i.length-1]]=t},get:function(e){var t=this.variables[e];return void 0!==t&&null!==t?t:null},lookup:function(e){var t=this.parent,n=this.variables[e];return void 0!==n&&null!==n?n:t&&t.lookup(e)},resolve:function(e,t){var n=t&&this.isolateWrites?void 0:this.parent,i=this.variables[e];return void 0!==i&&null!==i?this:n&&n.resolve(e)},push:function(e){return new x(this,e)},pop:function(){return this.parent}});a.prototype=Object.create(String.prototype,{length:{writable:!0,configurable:!0,value:0}}),a.prototype.valueOf=function(){return this.val},a.prototype.toString=function(){return this.val},e.exports={Frame:x,makeMacro:i,makeKeywordArgs:r,numArgs:o,suppressValue:h,ensureDefined:u,memberLookup:p,contextOrFrameLookup:m,callWrap:f,handleError:d,isArray:y.isArray,keys:y.keys,SafeString:a,copySafeness:l,markSafe:c,asyncEach:v,asyncAll:g,inOperator:y.inOperator}},function(e,t,n){"use strict";function i(e,t){return null===e||void 0===e||e===!1?t:e}var r=n(1),s=n(12),o={abs:function(e){return Math.abs(e)},batch:function(e,t,n){var i,r=[],s=[];for(i=0;i<e.length;i++)i%t===0&&s.length&&(r.push(s),s=[]),s.push(e[i]);if(s.length){if(n)for(i=s.length;t>i;i++)s.push(n);r.push(s)}return r},capitalize:function(e){e=i(e,"");var t=e.toLowerCase();return s.copySafeness(e,t.charAt(0).toUpperCase()+t.slice(1))},center:function(e,t){if(e=i(e,""),t=t||80,e.length>=t)return e;var n=t-e.length,o=r.repeat(" ",n/2-n%2),a=r.repeat(" ",n/2);return s.copySafeness(e,o+e+a)},"default":function(e,t,n){return n?e?e:t:void 0!==e?e:t},dictsort:function(e,t,n){if(!r.isObject(e))throw new r.TemplateError("dictsort filter: val must be an object");var i=[];for(var s in e)i.push([s,e[s]]);var o;if(void 0===n||"key"===n)o=0;else{if("value"!==n)throw new r.TemplateError("dictsort filter: You can only sort by either key or value");o=1}return i.sort(function(e,n){var i=e[o],s=n[o];return t||(r.isString(i)&&(i=i.toUpperCase()),r.isString(s)&&(s=s.toUpperCase())),i>s?1:i===s?0:-1}),i},dump:function(e){return JSON.stringify(e)},escape:function(e){return"string"==typeof e?s.markSafe(r.escape(e)):e},safe:function(e){return s.markSafe(e)},first:function(e){return e[0]},groupby:function(e,t){return r.groupBy(e,t)},indent:function(e,t,n){if(e=i(e,""),""===e)return"";t=t||4;for(var o="",a=e.split("\n"),l=r.repeat(" ",t),c=0;c<a.length;c++)o+=0!==c||n?l+a[c]+"\n":a[c]+"\n"; 13934return s.copySafeness(e,o)},join:function(e,t,n){return t=t||"",n&&(e=r.map(e,function(e){return e[n]})),e.join(t)},last:function(e){return e[e.length-1]},length:function(e){var t=i(e,"");return void 0!==t?"function"==typeof Map&&t instanceof Map||"function"==typeof Set&&t instanceof Set?t.size:t.length:0},list:function(e){if(r.isString(e))return e.split("");
13934if(r.isObject(e)){var t=[];if(Object.keys)t=Object.keys(e);else for(var n in e)t.push(n);return r.map(t,function(t){return{key:t,value:e[t]}})}if(r.isArray(e))return e;throw new r.TemplateError("list filter: type not iterable")},lower:function(e){return e=i(e,""),e.toLowerCase()},random:function(e){return e[Math.floor(Math.random()*e.length)]},rejectattr:function(e,t){return e.filter(function(e){return!e[t]})},selectattr:function(e,t){return e.filter(function(e){return!!e[t]})},replace:function(e,t,n,i){var r=e;if(t instanceof RegExp)return e.replace(t,n);"undefined"==typeof i&&(i=-1);var o="";if("number"==typeof t)t+="";else if("string"!=typeof t)return e;if("number"==typeof e&&(e+=""),"string"!=typeof e&&!(e instanceof s.SafeString))return e;if(""===t)return o=n+e.split("").join(n)+n,s.copySafeness(e,o);var a=e.indexOf(t);if(0===i||-1===a)return e;for(var l=0,c=0;a>-1&&(-1===i||i>c);)o+=e.substring(l,a)+n,l=a+t.length,c++,a=e.indexOf(t,l);return l<e.length&&(o+=e.substring(l)),s.copySafeness(r,o)},reverse:function(e){var t;return t=r.isString(e)?o.list(e):r.map(e,function(e){return e}),t.reverse(),r.isString(e)?s.copySafeness(e,t.join("")):t},round:function(e,t,n){t=t||0;var i,r=Math.pow(10,t);return i="ceil"===n?Math.ceil:"floor"===n?Math.floor:Math.round,i(e*r)/r},slice:function(e,t,n){for(var i=Math.floor(e.length/t),r=e.length%t,s=0,o=[],a=0;t>a;a++){var l=s+a*i;r>a&&s++;var c=s+(a+1)*i,h=e.slice(l,c);n&&a>=r&&h.push(n),o.push(h)}return o},sum:function(e,t,n){var i=0;"number"==typeof n&&(i+=n),t&&(e=r.map(e,function(e){return e[t]}));for(var s=0;s<e.length;s++)i+=e[s];return i},sort:s.makeMacro(["value","reverse","case_sensitive","attribute"],[],function(e,t,n,i){return e=r.map(e,function(e){return e}),e.sort(function(e,s){var o,a;return i?(o=e[i],a=s[i]):(o=e,a=s),!n&&r.isString(o)&&r.isString(a)&&(o=o.toLowerCase(),a=a.toLowerCase()),a>o?t?1:-1:o>a?t?-1:1:0}),e}),string:function(e){return s.copySafeness(e,e)},striptags:function(e,t){e=i(e,""),t=t||!1;var n=/<\/?([a-z][a-z0-9]*)\b[^>]*>|<!--[\s\S]*?-->/gi,r=o.trim(e.replace(n,"")),a="";return a=t?r.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):r.replace(/\s+/gi," "),s.copySafeness(e,a)},title:function(e){e=i(e,"");for(var t=e.split(" "),n=0;n<t.length;n++)t[n]=o.capitalize(t[n]);return s.copySafeness(e,t.join(" "))},trim:function(e){return s.copySafeness(e,e.replace(/^\s*|\s*$/g,""))},truncate:function(e,t,n,r){var o=e;if(e=i(e,""),t=t||255,e.length<=t)return e;if(n)e=e.substring(0,t);else{var a=e.lastIndexOf(" ",t);-1===a&&(a=t),e=e.substring(0,a)}return e+=void 0!==r&&null!==r?r:"...",s.copySafeness(o,e)},upper:function(e){return e=i(e,""),e.toUpperCase()},urlencode:function(e){var t=encodeURIComponent;if(r.isString(e))return t(e);var n;if(r.isArray(e))n=e.map(function(e){return t(e[0])+"="+t(e[1])});else{n=[];for(var i in e)e.hasOwnProperty(i)&&n.push(t(i)+"="+t(e[i]))}return n.join("&")},urlize:function(e,t,n){isNaN(t)&&(t=1/0);var i=n===!0?' rel="nofollow"':"",r=/^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,s=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,o=/^https?:\/\/.*$/,a=/^www\./,l=/\.(?:org|net|com)(?:\:|\/|$)/,c=e.split(/(\s+)/).filter(function(e){return e&&e.length}).map(function(e){var n=e.match(r),c=n&&n[1]||e;return o.test(c)?'<a href="'+c+'"'+i+">"+c.substr(0,t)+"</a>":a.test(c)?'<a href="http://'+c+'"'+i+">"+c.substr(0,t)+"</a>":s.test(c)?'<a href="mailto:'+c+'">'+c+"</a>":l.test(c)?'<a href="http://'+c+'"'+i+">"+c.substr(0,t)+"</a>":e});return c.join("")},wordcount:function(e){e=i(e,"");var t=e?e.match(/\w+/g):null;return t?t.length:null},"float":function(e,t){var n=parseFloat(e);return isNaN(n)?t:n},"int":function(e,t){var n=parseInt(e,10);return isNaN(n)?t:n}};o.d=o["default"],o.e=o.escape,e.exports=o},function(e,t,n){"use strict";var i=n(15),r=n(16),s=i.extend({init:function(e,t){this.baseURL=e||".",t=t||{},this.useCache=!!t.useCache,this.async=!!t.async},resolve:function(e,t){throw new Error("relative templates not support in the browser yet")},getSource:function(e,t){var n,i=this.useCache;return this.fetch(this.baseURL+"/"+e,function(r,s){if(r)if(t)t(r.content);else{if(404!==r.status)throw r.content;n=null}else n={src:s,path:e,noCache:!i},t&&t(null,n)}),n},fetch:function(e,t){var n,i=!0;window.XMLHttpRequest?n=new XMLHttpRequest:window.ActiveXObject&&(n=new ActiveXObject("Microsoft.XMLHTTP")),n.onreadystatechange=function(){4===n.readyState&&i&&(i=!1,0===n.status||200===n.status?t(null,n.responseText):t({status:n.status,content:n.responseText}))},e+=(-1===e.indexOf("?")?"?":"&")+"s="+(new Date).getTime(),n.open("GET",e,this.async),n.send()}});e.exports={WebLoader:s,PrecompiledLoader:r}},function(e,t,n){"use strict";var i=n(3),r=n(6),s=n(1),o=r.extend({on:function(e,t){this.listeners=this.listeners||{},this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t)}
13934,emit:function(e){var t=Array.prototype.slice.call(arguments,1);this.listeners&&this.listeners[e]&&s.each(this.listeners[e],function(e){e.apply(null,t)})},resolve:function(e,t){return i.resolve(i.dirname(e),t)},isRelative:function(e){return 0===e.indexOf("./")||0===e.indexOf("../")}});e.exports=o},function(e,t,n){"use strict";var i=n(15),r=i.extend({init:function(e){this.precompiled=e||{}},getSource:function(e){return this.precompiled[e]?{src:{type:"code",obj:this.precompiled[e]},path:e}:null}});e.exports=r},function(e,t){"use strict";function n(e){var t=-1;return{current:null,reset:function(){t=-1,this.current=null},next:function(){return t++,t>=e.length&&(t=0),this.current=e[t],this.current}}}function i(e){e=e||",";var t=!0;return function(){var n=t?"":e;return t=!1,n}}function r(){return{range:function(e,t,n){"undefined"==typeof t?(t=e,e=0,n=1):n||(n=1);var i,r=[];if(n>0)for(i=e;t>i;i+=n)r.push(i);else for(i=e;i>t;i+=n)r.push(i);return r},cycler:function(){return n(Array.prototype.slice.call(arguments))},joiner:function(e){return i(e)}}}e.exports=r},function(e,t){function n(){"use strict";var e=this.runtime,t=this.lib,n=e.contextOrFrameLookup;e.contextOrFrameLookup=function(e,t,i){var r=n.apply(this,arguments);if(void 0===r)switch(i){case"True":return!0;case"False":return!1;case"None":return null}return r};var i=e.memberLookup,r={pop:function(e){if(void 0===e)return this.pop();if(e>=this.length||0>e)throw new Error("KeyError");return this.splice(e,1)},remove:function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return this.splice(t,1);throw new Error("ValueError")},count:function(e){for(var t=0,n=0;n<this.length;n++)this[n]===e&&t++;return t},index:function(e){var t;if(-1===(t=this.indexOf(e)))throw new Error("ValueError");return t},find:function(e){return this.indexOf(e)},insert:function(e,t){return this.splice(e,0,t)}},s={items:function(){var e=[];for(var t in this)e.push([t,this[t]]);return e},values:function(){var e=[];for(var t in this)e.push(this[t]);return e},keys:function(){var e=[];for(var t in this)e.push(t);return e},get:function(e,t){var n=this[e];return void 0===n&&(n=t),n},has_key:function(e){return this.hasOwnProperty(e)},pop:function(e,t){var n=this[e];if(void 0===n&&void 0!==t)n=t;else{if(void 0===n)throw new Error("KeyError");delete this[e]}return n},popitem:function(){for(var e in this){var t=this[e];return delete this[e],[e,t]}throw new Error("KeyError")},setdefault:function(e,t){return e in this?this[e]:(void 0===t&&(t=null),this[e]=t)},update:function(e){for(var t in e)this[t]=e[t];return null}};s.iteritems=s.items,s.itervalues=s.values,s.iterkeys=s.keys,e.memberLookup=function(e,n,o){return e=e||{},t.isArray(e)&&r.hasOwnProperty(n)?function(){return r[n].apply(e,arguments)}:t.isObject(e)&&s.hasOwnProperty(n)?function(){return s[n].apply(e,arguments)}:i.apply(this,arguments)}}e.exports=n}]);; 13935$.fn.isOnScreen = function() { 13936 var win = $(window); 13937 var viewport = { 13938 top: win.scrollTop(), 13939 left: win.scrollLeft() 13940 }; 13941 13942 viewport.right = viewport.left + win.width(); 13943 viewport.bottom = viewport.top + win.height(); 13944 13945 var bounds = this.offset(); 13946 bounds.right = bounds.left + this.outerWidth(); 13947 bounds.bottom = bounds.top + this.outerHeight(); 13948 13949 return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom)); 13950} 13951; 13952/*! npm.im/object-fit-images 3.1.3 */ 13953var objectFitImages = (function () { 13954'use strict'; 13955 13956var OFI = 'bfred-it:object-fit-images'; 13957var propRegex = /(object-fit|object-position)\s*:\s*([-\w\s%]+)/g; 13958var testImg = typeof Image === 'undefined' ? {style: {'object-position': 1}} : new Image(); 13959var supportsObjectFit = 'object-fit' in testImg.style; 13960var supportsObjectPosition = 'object-position' in testImg.style; 13961var supportsOFI = 'background-size' in testImg.style; 13962var supportsCurrentSrc = typeof testImg.currentSrc === 'string'; 13963var nativeGetAttribute = testImg.getAttribute; 13964var nativeSetAttribute = testImg.setAttribute; 13965var autoModeEnabled = false; 13966 13967function createPlaceholder(w, h) { 13968 return ("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='" + w + "' height='" + h + "'%3E%3C/svg%3E"); 13969} 13970 13971function polyfillCurrentSrc(el) { 13972 if (el.srcset && !supportsCurrentSrc && window.picturefill) { 13973 var pf = window.picturefill._; 13974 // parse srcset with picturefill where currentSrc isn't available 13975 if (!el[pf.ns] || !el[pf.ns].evaled) { 13976 // force synchronous srcset parsing 13977 pf.fillImg(el, {reselect: true}); 13978 } 13979 13980 if (!el[pf.ns].curSrc) { 13981 // force picturefill to parse srcset 13982 el[pf.ns].supported = false; 13983 pf.fillImg(el, {reselect: true}); 13984 } 13985 13986 // retrieve parsed currentSrc, if any 13987 el.currentSrc = el[pf.ns].curSrc || el.src; 13988 } 13989} 13990 13991function getStyle(el) { 13992 var style = getComputedStyle(el).fontFamily; 13993 var parsed; 13994 var props = {}; 13995 while ((parsed = propRegex.exec(style)) !== null) { 13996 props[parsed[1]] = parsed[2]; 13997 } 13998 return props; 13999} 14000 14001function setPlaceholder(img, width, height) { 14002 // Default: fill width, no height
vendor: 4,230 bytes, lines 14003-14139
14003 var placeholder = createPlaceholder(width || 1, height || 0); 14004 14005 // Only set placeholder if it's different 14006 if (nativeGetAttribute.call(img, 'src') !== placeholder) { 14007 nativeSetAttribute.call(img, 'src', placeholder); 14008 } 14009} 14010 14011function onImageReady(img, callback) { 14012 // naturalWidth is only available when the image headers are loaded, 14013 // this loop will poll it every 100ms. 14014 if (img.naturalWidth) { 14015 callback(img); 14016 } else { 14017 setTimeout(onImageReady, 100, img, callback); 14018 } 14019} 14020 14021function fixOne(el) { 14022 var style = getStyle(el); 14023 var ofi = el[OFI]; 14024 style['object-fit'] = style['object-fit'] || 'fill'; // default value 14025 14026 // Avoid running where unnecessary, unless OFI had already done its deed 14027 if (!ofi.img) { 14028 // fill is the default behavior so no action is necessary 14029 if (style['object-fit'] === 'fill') { 14030 return; 14031 } 14032 14033 // Where object-fit is supported and object-position isn't (Safari < 10) 14034 if ( 14035 !ofi.skipTest && // unless user wants to apply regardless of browser support 14036 supportsObjectFit && // if browser already supports object-fit 14037 !style['object-position'] // unless object-position is used 14038 ) { 14039 return; 14040 } 14041 } 14042 14043 // keep a clone in memory while resetting the original to a blank 14044 if (!ofi.img) { 14045 ofi.img = new Image(el.width, el.height); 14046 ofi.img.srcset = nativeGetAttribute.call(el, "data-ofi-srcset") || el.srcset; 14047 ofi.img.src = nativeGetAttribute.call(el, "data-ofi-src") || el.src; 14048 14049 // preserve for any future cloneNode calls 14050 // https://github.com/bfred-it/object-fit-images/issues/53 14051 nativeSetAttribute.call(el, "data-ofi-src", el.src); 14052 if (el.srcset) { 14053 nativeSetAttribute.call(el, "data-ofi-srcset", el.srcset); 14054 } 14055 14056 setPlaceholder(el, el.naturalWidth || el.width, el.naturalHeight || el.height); 14057 14058 // remove srcset because it overrides src 14059 if (el.srcset) { 14060 el.srcset = ''; 14061 } 14062 try { 14063 keepSrcUsable(el); 14064 } catch (err) { 14065 if (window.console) { 14066 console.log('http://bit.ly/ofi-old-browser'); 14067 } 14068 } 14069 } 14070 14071 polyfillCurrentSrc(ofi.img); 14072 14073 el.style.backgroundImage = "url(\"" + ((ofi.img.currentSrc || ofi.img.src).replace(/"/g, '\\"')) + "\")"; 14074 el.style.backgroundPosition = style['object-position'] || 'center'; 14075 el.style.backgroundRepeat = 'no-repeat'; 14076 14077 if (/scale-down/.test(style['object-fit'])) { 14078 onImageReady(ofi.img, function () { 14079 if (ofi.img.naturalWidth > el.width || ofi.img.naturalHeight > el.height) { 14080 el.style.backgroundSize = 'contain'; 14081 } else { 14082 el.style.backgroundSize = 'auto'; 14083 } 14084 }); 14085 } else { 14086 el.style.backgroundSize = style['object-fit'].replace('none', 'auto').replace('fill', '100% 100%'); 14087 } 14088 14089 onImageReady(ofi.img, function (img) { 14090 setPlaceholder(el, img.naturalWidth, img.naturalHeight); 14091 }); 14092} 14093 14094function keepSrcUsable(el) { 14095 var descriptors = { 14096 get: function get(prop) { 14097 return el[OFI].img[prop ? prop : 'src']; 14098 }, 14099 set: function set(value, prop) { 14100 el[OFI].img[prop ? prop : 'src'] = value; 14101 nativeSetAttribute.call(el, ("data-ofi-" + prop), value); // preserve for any future cloneNode 14102 fixOne(el); 14103 return value; 14104 } 14105 }; 14106 Object.defineProperty(el, 'src', descriptors); 14107 Object.defineProperty(el, 'currentSrc', { 14108 get: function () { return descriptors.get('currentSrc'); } 14109 }); 14110 Object.defineProperty(el, 'srcset', { 14111 get: function () { return descriptors.get('srcset'); }, 14112 set: function (ss) { return descriptors.set(ss, 'srcset'); } 14113 }); 14114} 14115 14116function hijackAttributes() { 14117 function getOfiImageMaybe(el, name) { 14118 return el[OFI] && el[OFI].img && (name === 'src' || name === 'srcset') ? el[OFI].img : el; 14119 } 14120 if (!supportsObjectPosition) { 14121 HTMLImageElement.prototype.getAttribute = function (name) { 14122 return nativeGetAttribute.call(getOfiImageMaybe(this, name), name); 14123 }; 14124 14125 HTMLImageElement.prototype.setAttribute = function (name, value) { 14126 return nativeSetAttribute.call(getOfiImageMaybe(this, name), name, String(value)); 14127 }; 14128 } 14129} 14130 14131function fix(imgs, opts) { 14132 var startAutoMode = !autoModeEnabled && !imgs; 14133 opts = opts || {}; 14134 imgs = imgs || 'img'; 14135 14136 if ((supportsObjectPosition && !opts.skipTest) || !supportsOFI) { 14137 return false; 14138 } 14139
14140 // use imgs as a selector or just select all images 14141 if (typeof imgs === 'string') { 14142 imgs = document.querySelectorAll(imgs); 14143 } else if (!('length' in imgs)) { 14144 imgs = [imgs]; 14145 } 14146 14147 // apply fix to all 14148 for (var i = 0; i < imgs.length; i++) { 14149 imgs[i][OFI] = imgs[i][OFI] || { 14150 skipTest: opts.skipTest 14151 }; 14152 fixOne(imgs[i]); 14153 } 14154 14155 if (startAutoMode) { 14156 document.body.addEventListener('load', function (e) { 14157 if (e.target.tagName === 'IMG') { 14158 fix(e.target, { 14159 skipTest: opts.skipTest 14160 }); 14161 } 14162 }, true); 14163 autoModeEnabled = true; 14164 imgs = 'img'; // reset to a generic selector for watchMQ 14165 } 14166 14167 // if requested, watch media queries for object-fit change 14168 if (opts.watchMQ) { 14169 window.addEventListener('resize', fix.bind(null, imgs, { 14170 skipTest: opts.skipTest 14171 })); 14172 } 14173} 14174 14175fix.supportsObjectFit = supportsObjectFit; 14176fix.supportsObjectPosition = supportsObjectPosition; 14177 14178hijackAttributes(); 14179 14180return fix; 14181 14182}()); 14183; 14184+function ($) { "use strict"; 14185 14186 /** 14187 * The zoom service 14188 */ 14189 function ZoomService () { 14190 this._activeZoom = 14191 this._initialScrollPosition = 14192 this._initialTouchPosition = 14193 this._touchMoveListener = null 14194 14195 this._$document = $(document) 14196 this._$window = $(window) 14197 this._$body = $(document.body) 14198 14199 this._boundClick = $.proxy(this._clickHandler, this) 14200 } 14201 14202 ZoomService.prototype.listen = function () { 14203 this._$body.on('click', '[data-action="zoom"]', $.proxy(this._zoom, this)) 14204 } 14205 14206 ZoomService.prototype._zoom = function (e) { 14207 var target = e.target 14208 14209 if (!target || target.tagName != 'IMG') return 14210 14211 if (this._$body.hasClass('zoom-overlay-open')) return 14212 14213 if (e.metaKey || e.ctrlKey) { 14214 return window.open((e.target.getAttribute('data-original') || e.target.src), '_blank') 14215 } 14216 14217 if (target.width >= ($(window).width() - Zoom.OFFSET)) return 14218 14219 this._activeZoomClose(true) 14220 14221 this._activeZoom = new Zoom(target) 14222 this._activeZoom.zoomImage() 14223 14224 // todo(fat): probably worth throttling this 14225 this._$window.on('scroll.zoom', $.proxy(this._scrollHandler, this)) 14226 14227 this._$document.on('keyup.zoom', $.proxy(this._keyHandler, this)) 14228 this._$document.on('touchstart.zoom', $.proxy(this._touchStart, this)) 14229 14230 // we use a capturing phase here to prevent unintended js events 14231 // sadly no useCapture in jquery api (http://bugs.jquery.com/ticket/14953) 14232 if (document.addEventListener) { 14233 document.addEventListener('click', this._boundClick, true) 14234 } else { 14235 document.attachEvent('onclick', this._boundClick, true) 14236 } 14237 14238 if ('bubbles' in e) { 14239 if (e.bubbles) e.stopPropagation() 14240 } else { 14241 // Internet Explorer before version 9 14242 e.cancelBubble = true 14243 } 14244 } 14245 14246 ZoomService.prototype._activeZoomClose = function (forceDispose) { 14247 if (!this._activeZoom) return 14248 14249 if (forceDispose) { 14250 this._activeZoom.dispose() 14251 } else { 14252 this._activeZoom.close() 14253 } 14254 14255 this._$window.off('.zoom') 14256 this._$document.off('.zoom') 14257 14258 document.removeEventListener('click', this._boundClick, true) 14259 14260 this._activeZoom = null 14261 } 14262 14263 ZoomService.prototype._scrollHandler = function (e) { 14264 if (this._initialScrollPosition === null) this._initialScrollPosition = $(window).scrollTop() 14265 var deltaY = this._initialScrollPosition - $(window).scrollTop() 14266 if (Math.abs(deltaY) >= 40) this._activeZoomClose() 14267 } 14268 14269 ZoomService.prototype._keyHandler = function (e) { 14270 if (e.keyCode == 27) this._activeZoomClose() 14271 } 14272 14273 ZoomService.prototype._clickHandler = function (e) { 14274 if (e.preventDefault) e.preventDefault() 14275 else event.returnValue = false 14276 14277 if ('bubbles' in e) { 14278 if (e.bubbles) e.stopPropagation() 14279 } else { 14280 // Internet Explorer before version 9 14281 e.cancelBubble = true 14282 } 14283 14284 this._activeZoomClose() 14285 } 14286 14287 ZoomService.prototype._touchStart = function (e) { 14288 this._initialTouchPosition = e.touches[0].pageY 14289 $(e.target).on('touchmove.zoom', $.proxy(this._touchMove, this)) 14290 } 14291 14292 ZoomService.prototype._touchMove = function (e) { 14293 if (Math.abs(e.touches[0].pageY - this._initialTouchPosition) > 10) { 14294 this._activeZoomClose() 14295 $(e.target).off('touchmove.zoom') 14296 } 14297 } 14298 14299 14300 /** 14301 * The zoom object 14302 */ 14303 function Zoom (img) { 14304 this._fullHeight = 14305 this._fullWidth = 14306 this._overlay = 14307 this._targetImageWrap = null 14308 14309 this._targetImage = img 14310 14311 this._$body = $(document.body) 14312 } 14313 14314 Zoom.OFFSET = 80 14315 Zoom._MAX_WIDTH = 2560 14316 Zoom._MAX_HEIGHT = 4096 14317 14318 Zoom.prototype.zoomImage = function () { 14319 var img = document.createElement('img') 14320 img.onload = $.proxy(function () { 14321 this._fullHeight = Number(img.height) 14322 this._fullWidth = Number(img.width) 14323 this._zoomOriginal() 14324 }, this) 14325 img.src = this._targetImage.src 14326 } 14327 14328 Zoom.prototype._zoomOriginal = function () { 14329 this._targetImageWrap = document.createElement('div') 14330 this._targetImageWrap.className = 'zoom-img-wrap' 14331 14332 this._targetImage.parentNode.insertBefore(this._targetImageWrap, this._targetImage) 14333 this._targetImageWrap.appendChild(this._targetImage) 14334 14335 $(this._targetImage) 14336 .addClass('zoom-img') 14337 .attr('data-action', 'zoom-out') 14338 14339 this._overlay = document.createElement('div') 14340 this._overlay.className = 'zoom-overlay' 14341 14342 //document.body.appendChild(this._overlay) 14343 this._targetImageWrap.parentNode.insertBefore(this._overlay, this._targetImageWrap) 14344 14345 this._calculateZoom() 14346 this._triggerAnimation() 14347 } 14348 14349 Zoom.prototype._calculateZoom = function () { 14350 this._targetImage.offsetWidth // repaint before animating 14351 14352 var originalFullImageWidth = this._fullWidth 14353 var originalFullImageHeight = this._fullHeight 14354 14355 var scrollTop = $(window).scrollTop() 14356 14357 var maxScaleFactor = originalFullImageWidth / this._targetImage.width 14358
14359 var viewportHeight = ($(window).height() - Zoom.OFFSET) 14360 var viewportWidth = ($(window).width() - Zoom.OFFSET) 14361 14362 var imageAspectRatio = originalFullImageWidth / originalFullImageHeight 14363 var viewportAspectRatio = viewportWidth / viewportHeight 14364 14365 if (originalFullImageWidth < viewportWidth && originalFullImageHeight < viewportHeight) { 14366 this._imgScaleFactor = maxScaleFactor 14367 14368 } else if (imageAspectRatio < viewportAspectRatio) { 14369 this._imgScaleFactor = (viewportHeight / originalFullImageHeight) * maxScaleFactor 14370 14371 } else { 14372 this._imgScaleFactor = (viewportWidth / originalFullImageWidth) * maxScaleFactor 14373 } 14374 } 14375 14376 Zoom.prototype._triggerAnimation = function () { 14377 this._targetImage.offsetWidth // repaint before animating 14378 14379 var imageOffset = $(this._targetImage).offset() 14380 var scrollTop = $(window).scrollTop() 14381 14382 var viewportY = scrollTop + ($(window).height() / 2) 14383 var viewportX = ($(window).width() / 2) 14384 14385 var imageCenterY = imageOffset.top + (this._targetImage.height / 2) 14386 var imageCenterX = imageOffset.left + (this._targetImage.width / 2) 14387 14388 this._translateY = viewportY - imageCenterY 14389 this._translateX = viewportX - imageCenterX 14390 14391 var targetTransform = 'scale(' + this._imgScaleFactor + ')' 14392 var imageWrapTransform = 'translate(' + this._translateX + 'px, ' + this._translateY + 'px)' 14393 14394 if ($.support.transition) { 14395 imageWrapTransform += ' translateZ(0)' 14396 } 14397 14398 $(this._targetImage) 14399 .css({ 14400 '-webkit-transform': targetTransform, 14401 '-ms-transform': targetTransform, 14402 'transform': targetTransform 14403 }) 14404 14405 $(this._targetImageWrap) 14406 .css({ 14407 '-webkit-transform': imageWrapTransform, 14408 '-ms-transform': imageWrapTransform, 14409 'transform': imageWrapTransform 14410 }) 14411 14412 this._$body.addClass('zoom-overlay-open') 14413 } 14414 14415 Zoom.prototype.close = function () { 14416 this._$body 14417 .removeClass('zoom-overlay-open') 14418 .addClass('zoom-overlay-transitioning') 14419 14420 // we use setStyle here so that the correct vender prefix for transform is used 14421 $(this._targetImage) 14422 .css({ 14423 '-webkit-transform': '', 14424 '-ms-transform': '', 14425 'transform': '' 14426 }) 14427 14428 $(this._targetImageWrap) 14429 .css({ 14430 '-webkit-transform': '', 14431 '-ms-transform': '', 14432 'transform': '' 14433 }) 14434 14435 if (!$.support.transition) { 14436 return this.dispose() 14437 } 14438 14439 $(this._targetImage) 14440 .one($.support.transition.end, $.proxy(this.dispose, this)) 14441 .emulateTransitionEnd(300) 14442 } 14443 14444 Zoom.prototype.dispose = function () { 14445 if (this._targetImageWrap && this._targetImageWrap.parentNode) { 14446 $(this._targetImage) 14447 .removeClass('zoom-img') 14448 .attr('data-action', 'zoom') 14449 14450 this._targetImageWrap.parentNode.replaceChild(this._targetImage, this._targetImageWrap) 14451 this._overlay.parentNode.removeChild(this._overlay) 14452 14453 this._$body.removeClass('zoom-overlay-transitioning') 14454 } 14455 } 14456 14457 // wait for dom ready (incase script included before body) 14458 $(function () { 14459 new ZoomService().listen() 14460 }) 14461 14462}(jQuery); 14463// Document ready 14464$(function () { 14465 14466 $(window).on('scroll', _.throttle(loadAnimations, 100)); 14467 14468 // Debounce to handle window resizing 14469 $(window).on('resize', _.debounce(loadAnimations, 100)); 14470 14471 loadAnimations(); 14472 14473 if ($(".wow").length) { 14474 loadWow(); 14475 } 14476}); 14477 14478// load Wow.js 14479function loadWow() { 14480 wow = new WOW({ 14481 boxClass: "wow", // Class name that reveals the hidden box when user scrolls. 14482 animateClass: "animated", // Class name that triggers the CSS animations (�animated� by default for the animate.css library) 14483 offset: 500, // Define the distance between the bottom of browser viewport and the top of hidden box. When the user scrolls and reach this distance the hidden box is revealed. 14484 mobile: true, //Turn on/off WOW.js on mobile devices. 14485 live: true // constantly check for new WOW elements on the page. 14486 });
14487 wow.init(); 14488} 14489 14490 14491var mapLoaded = false; 14492 14493// Set required animations 14494function loadAnimations() { 14495 var fadeIn = $(".fade-in"), 14496 timer = 0; 14497 // Staggered fadeIn animation 14498 if (fadeIn.length) { 14499 fadeIn.each(function() { 14500 var $this = $(this), 14501 onScreen = $this.isOnScreen(), 14502 animated = $this.hasClass("animated"); 14503 if (onScreen && !animated) { 14504 timer += 450; 14505 setTimeout(function() { 14506 $this.addClass("animated fadeIn"); 14507 }, timer); 14508 } else { 14509 checkLoadMap(); 14510 } 14511 }); 14512 } else { 14513 checkLoadMap(); 14514 } 14515} 14516 14517function checkLoadMap() { 14518 if (!mapLoaded) { 14519 mapLoaded = true; 14520 loadMap(); 14521 } 14522}; 14523 14524function GetParameterByName(queryString, name) { 14525 14526 if (!name) { 14527 return ""; 14528 } 14529 14530 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); 14531 var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), 14532 results = regex.exec('?' + queryString); 14533 return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); 14534} 14535 14536 14537function UpdateURLParameter(url, param, paramVal) 14538{ 14539 var anchor = null; 14540 var newAdditionalURL = ""; 14541 var tempArray = url.split("?"); 14542 var baseURL = tempArray[0]; 14543 var additionalURL = tempArray[1]; 14544 var temp = ""; 14545 var url_txt = ""; 14546 14547 if (additionalURL) 14548 { 14549 var tmpAnchor = additionalURL.split("#"); 14550 var params = tmpAnchor[0]; 14551 anchor = tmpAnchor[1]; 14552 if(anchor) 14553 additionalURL = params; 14554 14555 tempArray = additionalURL.split("&"); 14556 14557 for (var i=0; i<tempArray.length; i++) 14558 { 14559 if(tempArray[i].split('=')[0] != param) 14560 { 14561 newAdditionalURL += temp + tempArray[i]; 14562 temp = "&"; 14563 } 14564 } 14565 } 14566 else 14567 { 14568 var tmpAnchor = baseURL.split("#"); 14569 var params = tmpAnchor[0]; 14570 anchor = tmpAnchor[1]; 14571 14572 if(params) 14573 baseURL = params; 14574 } 14575 14576 if(anchor) 14577 paramVal += "#" + anchor; 14578 14579 if(paramVal != "") 14580 url_txt = temp + "" + param + "=" + paramVal; 14581 14582 if(newAdditionalURL != "" || url_txt != "") 14583 baseURL = baseURL + "?"; 14584 14585 return (baseURL + newAdditionalURL + url_txt); 14586} 14587; 14588 14589function initAccordion() { 14590 14591 $(".accord-container").each(function () { 14592 var accordion = new Accordion( 14593 "." + $(this).find(".AccordionName").val(), 14594 parseInt($(this).find(".Speed").val()), 14595 $(this).find(".ScrollScreen").val(), 14596 $(this).find(".AutoExpand").val(), 14597 $(this).find(".AllowMultiple").val() === "true", 14598 $(this).find(".CloseAll").val() === "true", 14599 ); 14600 accordion.init(); 14601 }); 14602} 14603 14604 14605// Accordion constructor 14606function Accordion(el, speed, scrollScreen, autoExpand, allowMultiple, closeAll) { 14607 this.el = $(el) || {}; 14608 this.speed = speed || 400; 14609 this.scrollScreen = scrollScreen || "mobileOnly"; 14610 this.autoExpand = autoExpand || ""; 14611 this.allowMultiple = allowMultiple; 14612 this.closeAll = closeAll; 14613 const ALLPANELS = "Auto expand all panels on load"; 14614 const FIRSTPANELS = "Auto expand first panel on load"; 14615 14616 this.init = function () { 14617 var $links = this.el.find(".accord-link, .accord-inner-link"); 14618 $links.on( 14619 "click", 14620 { 14621 el: this.el, 14622 speed: this.speed, 14623 scrollScreen: this.scrollScreen, 14624 autoExpand: this.autoExpand, 14625 allowMultiple: this.allowMultiple, 14626 closeAll: this.closeAll, 14627 }, 14628 this.dropdown 14629 ); 14630 const $expandElements = this.autoExpand === ALLPANELS ? this.el.find(".accord-link-content") : 14631 this.autoExpand === FIRSTPANELS ? this.el.find(".accord-link-content").first() : false; 14632 if ($expandElements) { 14633 $expandElements.slideDown(speed, function () { 14634 if (scroll === "mobileOnly" && $(window).width() < 500) { 14635 offsetAccord(); 14636 } else if (scroll === "tabletDown" && $(window).width() < 768) { 14637 offsetAccord(); 14638 } else if (scroll === "all") { 14639 offsetAccord(); 14640 } else { 14641 return; 14642 } 14643 }); 14644 14645 $expandElements.parent().addClass("open"); 14646 $expandElements.attr('aria-expanded', (i, attr) => { return true;});
14647 } 14648 }; 14649} 14650 14651// dropdown method 14652Accordion.prototype.dropdown = function (e) { 14653 var $el = e.data.el; 14654 var speed = e.data.speed; 14655 var scroll = e.data.scrollScreen; 14656 var $this = $(this); 14657 var $next = $this.next(); 14658 var accordOffset; 14659 const isClosing = $(this).attr("aria-expanded") === "true"; 14660 if ((isClosing && e.data.closeAll) || (!isClosing && !e.data.allowMultiple) ){ 14661 collapse(); 14662 } 14663 14664 function collapse() { 14665 var classBase = $this.hasClass("accord-inner-link") ? 'accord-inner-link' : 'accord-link'; 14666 $el 14667 .find(`.${classBase}`) 14668 .not($this) 14669 .attr('aria-expanded', 'false'); 14670 $el 14671 .find(`.${classBase}-content`) 14672 .not($next) 14673 .slideUp(speed) 14674 .parent() 14675 .removeClass("open"); 14676 } 14677 function offsetAccord() { 14678 $("html, body").animate( 14679 { 14680 scrollTop: accordOffset 14681 }, 14682 500 14683 ); 14684 } 14685 14686 $this.parent().toggleClass("open"); 14687 $this.attr('aria-expanded', (i, attr) => attr === 'true' ? 'false' : 'true'); 14688 if ($this.data('hash')) { 14689 window.location.hash = $this.data('hash') 14690 } 14691 14692 14693 // run offset function as callback to slideToggle to allow animation to complete 14694 $next.slideToggle(speed, function () { 14695 accordOffset = $this.offset().top; 14696 if (scroll === "mobileOnly" && $(window).width() < 500) { 14697 offsetAccord(); 14698 } else if (scroll === "tabletDown" && $(window).width() < 768) { 14699 offsetAccord(); 14700 } else if (scroll === "all") { 14701 offsetAccord(); 14702 } else { 14703 return; 14704 } 14705 }); 14706}; 14707 14708$(function () { 14709 // scroll to and open hash specified accordion item 14710 var accordHash = location.hash; 14711 if (accordHash) { 14712 var $hashLink = $('button[data-hash="' + accordHash + '"]'); 14713 $hashLink.attr('aria-expanded', 'true'); 14714 14715 // is this an innerlink? 14716 if ($hashLink.next(".accord-inner-link-content").length) { 14717 $hashLink.next().slideDown(function () { 14718 $(this) 14719 .parents("li") 14720 .addClass("open"); 14721 $(this) 14722 .parent() 14723 .addClass("open"); 14724 var top = $hashLink[0].offsetTop; 14725 $("html, body").animate({ scrollTop: top }, 500); 14726 }); 14727 } else { 14728 // toggle slide and run callback to animate on body scrolltop 14729 $hashLink.next(".accord-link-content").slideDown(function () { 14730 var top = $hashLink[0].offsetTop; 14731 $("html, body").animate({ scrollTop: top }, 500); 14732 $(this) 14733 .parent() 14734 .addClass("open"); 14735 }); 14736 } 14737 } 14738 14739 if ($(".accord-container").length > 0) { 14740 initAccordion(); 14741 } 14742}); 14743 14744// new Accordion(el, speed, scrollscreen) 14745// scrollscreen choices: 'mobileOnly', 'tabletDown', and 'all' 14746 14747; 14748; 14749(function () { 14750 class BillboardSlider { 14751 constructor(name, animationType, autoplay, speed, infinite, pauseOnHover, adaptiveHeight, arrowsOnMobile, dots) { 14752 this.$element = $(name); 14753 this.name = name; 14754 this.animationType = animationType; 14755 this.autoplay = autoplay; 14756 this.speed = speed; 14757 this.infinite = infinite; 14758 this.pauseOnHover = pauseOnHover; 14759 this.adaptiveHeight = adaptiveHeight; 14760 this.arrowsOnMobile = arrowsOnMobile; 14761 this.dots = dots; 14762 } 14763 14764 init() { 14765 this.$element.slick({ 14766 arrows: true, 14767 dots: this.dots, 14768 slidesToShow: 1, 14769 autoplay: this.autoplay, 14770 speed: this.speed || 300, 14771 infinite: this.infinite || true, 14772 pauseOnHover: this.pauseOnHover, 14773 waitForAnimate: true, 14774 useTransform: true, 14775 cssEase: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)', 14776 responsive: [ 14777 { 14778 breakpoint: 768, 14779 settings: { 14780 arrows: this.arrowsOnMobile || false, 14781 slidesToShow: 1, 14782 adaptiveHeight: this.adaptiveHeight || false, 14783 }, 14784 }, 14785 ], 14786 }); 14787 $(this.name) 14788 .find('.slick-active') 14789 .not('li.slick-active, .slick-cloned') 14790 .addClass(this.animationType || 'fade-in'); 14791 $(this.name) 14792 .find('.slick-dots') 14793 .addClass(this.animationType || 'fade-in'); 14794 } 14795 } 14796 14797 class Billboard { 14798 constructor(billboardElem) { 14799 this.$billboard = $(billboardElem); 14800 this.$billboardSliderWrapper = this.$billboard.find('.billboard-slider-wrapper'); 14801 this.$billboardSlider = this.$billboardSliderWrapper.find('.billboard-slider'); 14802 this.$videoBillboards = this.$billboard.find('.billboard-video'); 14803 14804 this.billBoardSlideReset = null; 14805 this.cachedWidth = $(window).width(); 14806 14807 this.autoPlay = this.$billboard.find('.billboardAutoPlay').val() === 'true'; 14808 this.adaptiveHeight = this.$billboard.find('.billboardAdaptiveHeight').val() === 'true'; 14809 this.infinite = this.$billboard.find('.billboardInfinite').val() === 'true'; 14810 this.arrowsOnMobile = this.$billboard.find('.billboardArrowsOnMobile').val() === 'true'; 14811 this.pauseOnHover = this.$billboard.find('.billboardPauseOnHover').val() === 'true'; 14812 this.isVariant2 = this.$billboard.hasClass('billboard-variant-2'); 14813 this.isComplexDesign = this.$billboard.hasClass('complex-design'); 14814 this.showDots = !(this.isVariant2 && this.isComplexDesign); 14815 14816 this.id = this.$billboardSlider.attr('id'); 14817 this.idSelector = `#${this.id}`; 14818 14819 this.animationType = this.$billboard.find('.billboardAnimationType').val();
14820 this.speed = this.$billboard.find('.billboardSpeed').val(); 14821 14822 this.billboardSlider = null; 14823 } 14824 14825 init() { 14826 this.billboardSlider = new BillboardSlider( 14827 this.idSelector, 14828 this.animationType, 14829 this.autoPlay, 14830 parseInt(this.speed), 14831 this.infinite, 14832 this.pauseOnHover, 14833 this.adaptiveHeight, 14834 this.arrowsOnMobile, 14835 this.showDots, 14836 ); 14837 14838 this.billboardSlider.init(); 14839 window.loadAnimations(); 14840 14841 this.videoPlayPauseHandler(); 14842 this.$videoBillboards.each((_i, videoBillboardElem) => { 14843 const $videoBillboard = $(videoBillboardElem); 14844 this.initBillboardVideo($videoBillboard); 14845 }); 14846 this.bindEventListeners(); 14847 } 14848 14849 initBillboardVideo($videoBillboard) { 14850 $videoBillboard.on('loadedmetadata', function () { 14851 $(this).attr('data-original-height', this.videoHeight); 14852 $(this).attr('data-original-width', this.videoWidth); 14853 }); 14854 } 14855 14856 videoPlayPauseHandler() { 14857 const $billboardVideo = this.$billboard.find('.billboard-video'); 14858 const $billboardPlayPause = this.$billboard.find('.billboard-video-play-pause'); 14859 const pauseVideoText = 'pause video'; 14860 const playVideoText = 'play video'; 14861 const playIconClass = 'fa-play-circle'; 14862 const pauseIconClass = 'fa-pause-circle'; 14863 14864 if (!$billboardPlayPause.length || !$billboardVideo.length) { 14865 return; 14866 } 14867 14868 const $billboardPlayPauseIcon = $billboardPlayPause.find('i.fa'); 14869 const $billboardPlayPauseText = $billboardPlayPause.find('span'); 14870 14871 const videoElement = $billboardVideo[0]; 14872 const hasAutoplay = $billboardVideo.attr('autoplay') !== undefined; 14873 14874 if (hasAutoplay) { 14875 $billboardPlayPauseIcon.removeClass(playIconClass).addClass(pauseIconClass); 14876 $billboardPlayPauseText.text(pauseVideoText); 14877 } else { 14878 $billboardPlayPauseIcon.removeClass(pauseIconClass).addClass(playIconClass); 14879 $billboardPlayPauseText.text(playVideoText); 14880 } 14881 14882 $billboardPlayPause.on('click', function () { 14883 if (videoElement.paused) { 14884 $billboardPlayPauseIcon.removeClass(playIconClass).addClass(pauseIconClass); 14885 $billboardPlayPauseText.text(pauseVideoText); 14886 videoElement.play(); 14887 } else { 14888 $billboardPlayPauseIcon.removeClass(pauseIconClass).addClass(playIconClass); 14889 $billboardPlayPauseText.text(playVideoText); 14890 videoElement.pause(); 14891 } 14892 }); 14893 } 14894 14895 videoEndedHandler(e) { 14896 $(e.currentTarget) 14897 .parents('.billboard-container') 14898 .each(function (_i, container) { 14899 $(container).addClass('show-image-after-video'); 14900 $(container).find('.billboard-background-video').addClass('billboard-video-done'); 14901 }); 14902 } 14903 14904 playPauseClickHandler(e) { 14905 const $target = $(e.target); 14906 const $slider = $target.parent().find('.billboard-slider'); 14907 const isPlaying = $target.attr('data-button-state') === 'play'; 14908 $slider.slick(isPlaying ? 'slickPause' : 'slickPlay'); 14909 $target.attr('data-button-state', isPlaying ? 'pause' : 'play'); 14910 } 14911 14912 bindEventListeners() { 14913 const self = this; 14914 14915 $(window).on('load', () => { 14916 if (self.billboardSlider.$element.length) { 14917 self.sliderClickArea('.billboard-container'); 14918 self.equalHeightVidAndOverlay(); 14919 self.equalizeSlideHeight('.billboard-slider'); 14920 self.billboardSlider.$element.css({ 14921 visibility: 'visible', 14922 opacity: 1, 14923 }); 14924 } else { 14925 self.clickArea('.billboard-container'); 14926 self.equalHeightVidAndOverlay(); 14927 } 14928 14929 if ($('.slick-active video').length) { 14930 $('.slick-current video')[0].play(); 14931 } 14932 self.setMobileSliderHeights(); 14933 }); 14934 14935 $(window).on('resize', () => { 14936 self.setMobileSliderHeights(); 14937 window._.debounce(function () { 14938 self.equalHeightVidAndOverlay(); 14939 }, 200); 14940 14941 const newWidth = $(window).width(); 14942 if (newWidth !== self.cachedWidth) { 14943 clearTimeout(window.resizedFinished); 14944 self.cachedWidth = newWidth; 14945 14946 if ($('.billboard-variant-2').length) { 14947 return; 14948 } 14949 14950 window.resizedFinished = setTimeout(function () { 14951 if ($('.billboard-slider').length) { 14952 self.clearSlideHeight('.billboard-slider'); 14953 self.equalizeSlideHeight('.billboard-slider'); 14954 } 14955 self.clearVidAndOverlay(); 14956 }, 120); 14957 14958 if (self.billBoardSlideReset !== null) { 14959 window.clearTimeout(self.billBoardSlideReset); 14960 } 14961 14962 self.billBoardSlideReset = setTimeout(function () { 14963 if ($('.billboard-slider').length) { 14964 self.clearSlideHeight('.billboard-slider'); 14965 self.equalizeSlideHeight('.billboard-slider'); 14966 } 14967 }, 120); 14968 } 14969 }); 14970 14971 $('.billboard-video').on('ended', (e) => self.videoEndedHandler(e)); 14972 this.$billboard.find('.billboard-slider-play-pause-btn').on('click', (e) => self.playPauseClickHandler(e)); 14973 } 14974 14975 equalizeSlideHeight(selector) { 14976 const dotsHeight = $(selector).find('.slick-dots').height(); 14977 const slideHeight = 14978 $(selector) 14979 .find('.billboard-slide') 14980 .toArray() 14981 .map((slide) => $(slide).height()) 14982 .reduce((maxHeight, currentHeight) => Math.max(maxHeight, currentHeight), 0) + dotsHeight; 14983 $(selector).find('.billboard-slide').height(slideHeight); 14984 } 14985 14986 clearSlideHeight(selector) { 14987 $(selector).find('.billboard-content-wrapper').css('height', ''); 14988 } 14989 14990 clearVidAndOverlay() { 14991 $('.billboard-background-video').css('height', ''); 14992 } 14993 14994 equalHeightVidAndOverlay() { 14995 const self = this; 14996 this.$billboard.each(function () { 14997 const $this = $(this); 14998 const $bgVid = $this.find('.billboard-background-video'); 14999 const $bgVidWrapper = $this.find('.billboard-background-video-wrapper'); 15000 const $bgVidImage = $bgVidWrapper.css('background-image'); 15001 const duration = 200; 15002 15003 $({ to: 0 }).animate({ to: 1 }, duration, function () { 15004 $bgVid.css('opacity', '1'); 15005 15006 if (self.$billboard.hasClass('billboard-full-width')) { 15007 $bgVid.find('video').height($bgVidWrapper.height()); 15008 } 15009 15010 $bgVidWrapper.css({ 15011 background: $bgVidImage, 15012 'background-size': 'cover', 15013 }); 15014 }); 15015 }); 15016 } 15017 15018 clickArea(billboardName) { 15019 const $billboardContainer = $(billboardName); 15020 const link = $billboardContainer.attr('data-link'); 15021 const target = $billboardContainer.attr('data-target'); 15022 15023 if (link !== undefined && link !== '' && link !== '#') { 15024 if ($billboardContainer.hasClass('billboard-click-area-content')) { 15025 const $item = $billboardContainer.find('.billboard-content-wrapper'); 15026 $item.wrapInner(`<a href="${link}" target = "${target}"></a>`); 15027 $item.find('.billboard-cta').attr('href', link); 15028 $billboardContainer.addClass('billboard-click-area-content-modified'); 15029 } else if ($billboardContainer.hasClass('billboard-click-area-heading')) { 15030 const $item = $billboardContainer.find('.billboard-heading'); 15031 $item.wrap(`<a href="${link}" target = "${target}"></a>`); 15032 } else if ($billboardContainer.hasClass('billboard-click-area-cta')) { 15033 $billboardContainer.find('.billboard-cta').attr('href', link); 15034 } else { 15035 const $item = $billboardContainer.find('.billboard-slide.slick-active'); 15036 $item.wrapInner(`<a href="${link}" target = "${target}"></a>`); 15037 $item.find('.billboard-cta').attr('href', link); 15038 } 15039 } 15040 } 15041 15042 sliderClickArea(billboardName) { 15043 const $billboardContainer = $(billboardName); 15044 15045 $billboardContainer.find('.billboard-slide').each(function () { 15046 const $this = $(this); 15047 const link = $this.attr('data-link'); 15048 const target = $this.attr('data-target'); 15049 15050 if (link !== undefined && link !== '' && link !== '#') { 15051 if ($billboardContainer.hasClass('billboard-click-area-content')) { 15052 $this.wrapInner(`<a href="${link}" target = "${target}"></a>`); 15053 $this.find('.billboard-cta').attr('href', link); 15054 } else if ($billboardContainer.hasClass('billboard-click-area-heading')) { 15055 const $slide = $this.find('.billboard-heading'); 15056 $slide.wrap(`<a href="${link}" target = "${target}"></a>`); 15057 } else if ($billboardContainer.hasClass('billboard-click-area-cta')) { 15058 $this.find('.billboard-cta').attr('href', link); 15059 } else { 15060 const $slide = $this.find('.billboard-slide.slick-active'); 15061 $slide.wrapInner(`<a href="${link}" target = "${target}"></a>`); 15062 $slide.find('.billboard-cta').attr('href', link); 15063 } 15064 } 15065 }); 15066 } 15067 15068 setMobileSliderHeights() { 15069 const windowWidth = $(window).width(); 15070 const isVariant2 = this.$billboard.hasClass('billboard-variant-2'); 15071 const slideOnlyImage = this.$billboard.find('.billboardSlideOnlyImages').val() === 'true'; 15072 15073 if (!isVariant2 || !slideOnlyImage) { 15074 return; 15075 } 15076 15077 if (windowWidth >= 768) { 15078 this.clearBillboardHeights(this.$billboard); 15079 return; 15080 } 15081 15082 const $billboards = $('.billboard-container'); 15083 const self = this; 15084 15085 $billboards.each((_i, billboardElem) => { 15086 const $billboard = $(billboardElem); 15087 15088 self.clearBillboardHeights($billboard); 15089 15090 const $text = $billboard.find('.billboard-fixed-texts .billboard-content-wrapper .billboard-content'); 15091 const minSliderHeight = 200; 15092 const fullHeight = $billboard.height(); 15093 const textHeight = $text.height() + 100; 15094 const newSliderHeight = fullHeight - textHeight; 15095 15096 if (newSliderHeight >= minSliderHeight) { 15097 return; 15098 } 15099 15100 self.growBillboardHeights($billboard, textHeight, minSli
15100derHeight); 15101 }); 15102 } 15103 15104 clearBillboardHeights($billboard) { 15105 $billboard.css('height', ''); 15106 $billboard.find('.billboard-slider-wrapper').css('height', ''); 15107 $billboard.find('.billboard-fixed-texts').css({ 15108 height: '', 15109 top: '', 15110 bottom: '', 15111 }); 15112 $billboard.find('.billboard-content-wrapper').css('height', ''); 15113 $billboard.find('.billboard-content').css({ 15114 height: '', 15115 top: '', 15116 bottom: '', 15117 }); 15118 $billboard.find('.billboard-slider').css('height', ''); 15119 $billboard.find('.slick-list').css('height', ''); 15120 $billboard.find('.slick-track').css('height', ''); 15121 } 15122 15123 growBillboardHeights($billboard, textHeight, sliderHeight) { 15124 const fullHeight = textHeight + sliderHeight; 15125 $billboard.height(fullHeight); 15126 $billboard.find('.billboard-slider-wrapper').height(fullHeight); 15127 $billboard.find('.billboard-fixed-texts').height(textHeight); 15128 $billboard.find('.billboard-fixed-texts').css('top', 'unset'); 15129 $billboard.find('.billboard-fixed-texts').css('bottom', 0); 15130 $billboard.find('.billboard-content-wrapper').height(textHeight); 15131 $billboard.find('.billboard-slider').height(fullHeight); 15132 $billboard.find('.slick-list').height(fullHeight); 15133 $billboard.find('.slick-track').height(fullHeight); 15134 } 15135 } 15136 15137 // Initialize all billboards on document ready 15138 $(function () { 15139 const $billboards = $('.billboard-container'); 15140 if (!$billboards.length) { 15141 return; 15142 } 15143 15144 $billboards.each((_i, billboardElem) => { 15145 const billboard = new Billboard(billboardElem); 15146 billboard.init(); 15147 }); 15148 }); 15149})(); 15150; 15151var $bioDetailContainer = $(".bio-detail-container"); 15152var $bioDetailNextLinkWrapper = $(".bio-detail-next-link-wrapper"); 15153var $bioDetailNextLink = $(".bio-detail-next-link"); 15154var $bioDetailPreviousLinkWrapper = $(".bio-detail-previous-link-wrapper"); 15155var $bioDetailPreviousLink = $(".bio-detail-previous-link"); 15156var $bioDetailLinks = $( 15157 ".bio-detail-previous-link-wrapper, .bio-detail-next-link-wrapper" 15158); 15159var $bioDetailContent = $(".bio-detail-content-wrapper"); 15160function toggleBioArrowScroll() { 15161 var navHeight = $(".nav").outerHeight(); 15162 var detailTop = $bioDetailContent.offset() 15163 ? $bioDetailContent.offset().top 15164 : 0; 15165 var detailHeight = $bioDetailContent.height(); 15166 var linkTop = $bioDetailNextLinkWrapper.offset() 15167 ? $bioDetailNextLinkWrapper.offset().top 15168 : 0; 15169 var linkHeight = $bioDetailNextLinkWrapper.height(); 15170 if ( 15171 linkTop >= detailTop && 15172 linkTop <= detailTop + detailHeight - linkHeight 15173 ) { 15174 $bioDetailLinks.css({ 15175 top: navHeight + linkHeight, 15176 opacity: 1, 15177 "z-index": 3 15178 }); 15179 } else { 15180 $bioDetailLinks.css({ 15181 opacity: 0, 15182 "z-index": -1 15183 }); 15184 } 15185} 15186$bioDetailPreviousLink.hover( 15187 function () { 15188 $(this) 15189 .parent() 15190 .addClass("hover-link"); 15191 }, 15192 function () { 15193 $(this) 15194 .parent() 15195 .removeClass("hover-link"); 15196 } 15197); 15198$bioDetailNextLink.hover( 15199 function () { 15200 $(this) 15201 .parent() 15202 .addClass("hover-link"); 15203 }, 15204 function () { 15205 $(this) 15206 .parent() 15207 .removeClass("hover-link"); 15208 } 15209); 15210 15211$(window).on("load", function () { 15212 if ($(window).width() > 1200 && $bioDetailContainer.length) { 15213 toggleBioArrowScroll(); 15214 } 15215}); 15216if ($(window).width() > 1200 && $bioDetailContainer.length) { 15217 $(window).on("scroll", _.throttle(toggleBioArrowScroll, 200)); 15218}; 15219// CALLOUTS COMPONENT JS 15220$(window).on('load', function () { 15221 15222 calloutsEqualHeight(); 15223 15224 $('.callouts-mobile-slider').addClass('show'); 15225 15226 $('.callouts-version-2 .callout-item').hover( 15227 function () { 15228 $(this).find('.callout-heading-wrapper-bottom').stop(true, true).animate({ 'opacity': '0' }, 500); 15229 $(this).find('.callout-heading-wrapper-2').delay(500).stop(true, true).animate({ 'opacity': '1' }, 500); 15230 $(this).find('.callout-date-wrapper, .callout-copy-wrapper, .callout-cta-wrapper, .callout-categories-wrapper').delay(750).stop(true, true).animate({ 'opacity': '1' }, 500); 15231 }, function () { 15232 $(this).find('.callout-heading-wrapper-2, .callout-date-wrapper, .callout-copy-wrapper, .callout-cta-wrapper, .callout-categories-wrapper').animate({ 'opacity': '0' }, 500); 15233 $(this).find('.callout-heading-wrapper-bottom').delay(600).animate({ 'opacity': '1' }, 500); 15234 } 15235 ); 15236}); 15237 15238$('.callouts-version-2.callouts-mobile-slider').on('setPosition', function () { 15239 $(this).find('.slick-slide').height('auto'); 15240 var slickTrack = $(this).find('.slick-track'); 15241 var slickTrackHeight = $(slickTrack).height(); 15242 $(this).find('.slick-slide').css('height', slickTrackHeight + 'px'); 15243}); 15244//adding this logic to switch the class name on the main container and individual items between desktop and mobile 15245//only perform the switch if the .callouts-no-slider class is not being used because we want to keep the classes as they are in that instance 15246$(document).ready(function () { 15247 if (!$('.callouts-no-slider').length) { 15248 //change the class on the container and add the class to each item if the page is loaded in mobile 15249 if ($(window).width() <= 767) { 15250 $('.callouts-container').addClass('callouts-mobile-slider').removeClass('callouts-container'); 15251 $('.callout-item').addClass('callout-slide'); 15252 } 15253 //not likely that a device will range from 767 to above that, but it could happen 15254 //if window resizing takes place to meet the above, change the classes as necessary 15255 //re-initialize the callout slider if it is destroyed and needs to be initialized again 15256 //running calloutsEqualHeight again on resize because heights are set based on the row, so when the layout changes from 3-column to 2-column the last item keeps the height of its previous row 15257 var windowWidth = $(window).width(); 15258 var calloutItem = $('.callout-item'); 15259 $(window).on( 15260 "resize", 15261 _.debounce(function () { 15262 const newWindowWidth = $(window).width(); 15263 if (newWindowWidth !== windowWidth) { 15264 windowWidth = newWindowWidth; 15265 if (windowWidth <= 767) { 15266 $('.callouts-container').addClass('callouts-mobile-slider').addClass('show').removeClass('callouts-container'); 15267 calloutItem.addClass('callout-slide'); 15268 $(function () { 15269 initializeCallout(); 15270 }); 15271 15272 } else { 15273 $('.callouts-mobile-slider').addClass('callouts-container').removeClass('callouts-mobile-slider').removeClass('show'); 15274 calloutItem.removeClass('callout-slide'); 15275 calloutItem.removeAttr('aria-describedby'); 15276 calloutItem.removeAttr('tabindex'); 15277 calloutItem.removeAttr('role'); 15278 15279 } 15280 calloutsEqualHeight(); 15281 } 15282 }, 400) 15283 ); 15284 } 15285 15286 $('.callouts-container').each(function () { 15287 $(this).magnificPopup({ 15288 delegate: 'a:not(.callout-categories, .callout-link)[href*="#"]', // child items selector, by clicking on it popup will open 15289 gallery: { 15290 enabled: true 15291 } 15292 }); 15293 });
15294 $('.callouts-mobile-slider').each(function () { 15295 $(this).magnificPopup({ 15296 delegate: 'a:not(.callout-categories, .callout-link)[href*="#"]', // child items selector, by clicking on it popup will open 15297 gallery: { 15298 enabled: true 15299 } 15300 }); 15301 }); 15302 // autoplay video if .kaltura-auto-callout class is added 15303 $('.kaltura-auto-callout').on('click', function () { 15304 this.href += '[autoPlay]=true[streamerType]=auto'; 15305 }); 15306}); 15307 15308//mobile slider version 15309function calloutSlider(name, mobileFirst, slidesToShow, autoplay, speed, pauseOnHover, waitForAnimate, useTransform, cssEase, breakpoint) { 15310 this.name = $(name); 15311 this.initializeCallout = function () { 15312 this.name.not('.slick-initialized').slick({ 15313 mobileFirst: mobileFirst || true, 15314 slidesToShow: slidesToShow || 1, 15315 autoplay: autoplay || false, 15316 speed: speed || 300, 15317 pauseOnHover: pauseOnHover || false, 15318 waitForAnimate: waitForAnimate || false, 15319 useTransform: useTransform || true, 15320 cssEase: cssEase || 'ease-out', 15321 responsive: [ 15322 { 15323 breakpoint: breakpoint || 768, 15324 settings: 'unslick' 15325 } 15326 ] 15327 }); 15328 }; 15329} 15330 15331function initializeCallout() { 15332 $('.callouts-mobile-slider').each(function () { 15333 // MOBILE FIRST 15334 var mobileFirst = $(this).find('.callouts-mobile-first').val() === 'true'; 15335 // SLIDES TO SHOW 15336 var slidesToShow = $(this).find('.callouts-slides-to-show').val(); 15337 // AUTOPLAY 15338 var autoplay = $(this).find('.callouts-autoplay').val() === 'true'; 15339 // SPEED 15340 var speed = parseInt($(this).find('.callouts-speed').val()); 15341 // PAUSE ON HOVER 15342 var pauseOnHover = $(this).find('.callouts-pause-on-hover').val() === 'true'; 15343 // WAIT FOR ANIMATE 15344 var waitForAnimate = $(this).find('.callouts-wait-for-animate').val() === 'true'; 15345 // USE TRANSFORM 15346 var useTransform = $(this).find('.callouts-use-transform').val() === 'true'; 15347 // CSS EASE 15348 var cssEase = $(this).find('.callouts-css-ease').val(); 15349 // BREAKPOINT 15350 var breakpoint = parseInt($(this).find('.callouts-breakpoint').val()); 15351 15352 var id = $(this).attr('id'); 15353 15354 var calloutSliderOne = new calloutSlider('#' + id, mobileFirst, slidesToShow, autoplay, speed, pauseOnHover, waitForAnimate, useTransform, cssEase, breakpoint); 15355 calloutSliderOne.initializeCallout(); 15356 15357 }); 15358} 15359 15360$(function () { 15361 initializeCallout(); 15362}); 15363 15364// placing this in a function outside of the window load so it can be called easily in multiple places 15365function calloutsEqualHeight() { 15366 if ($(".callouts-left-right-image.callouts-version-1").length && $(window).outerWidth() > 768) { 15367 return; 15368 }; 15369 if ($(".callouts-left-right-image.callouts-version-1.callouts-no-slider").length) { 15370 return; 15371 }; 15372 15373 var copyheight = 0; 15374 $('.callout-copy-wrapper').each(function () { 15375 $(this).css('height', '') 15376 copyheight = ($(this).height() > copyheight ? $(this).height() : copyheight); 15377 }); 15378 15379 $('.callouts-container .callout-copy-wrapper').height(copyheight); 15380 15381 //set equal heights for the heading area 15382 var headingheight = 0; 15383 $('.callout-heading-wrapper').each(function () { 15384 $(this).css('height', '') 15385 headingheight = ($(this).height() > headingheight ? $(this).height() : headingheight); 15386 }); 15387 15388 $('.callouts-container .callout-heading-wrapper').height(headingheight); 15389}; 15390if ($('.contact-form').length > 0) { 15391 15392jQuery.validator.setDefaults({ 15393 highlight: function (element, errorClass, validClass) { 15394 if (element.type === 'radio') { 15395 this.findByName(element.name).addClass(errorClass).removeClass(validClass); 15396 } else { 15397 $(element).addClass(errorClass).removeClass(validClass); 15398 $(element).closest('.control-group').removeClass('success').addClass('error'); 15399 $(element).parent().removeClass('has-success').addClass('has-error'); 15400 } 15401 }, 15402 unhighlight: function (element, errorClass, validClass) { 15403 if (element.type === 'radio') { 15404 this.findByName(element.name).removeClass(errorClass).addClass(validClass); 15405 } else { 15406 $(element).removeClass(errorClass).addClass(validClass); 15407 $(element).closest('.control-group').removeClass('error').addClass('success'); 15408 $(element).parent().removeClass('has-error').addClass('has-success'); 15409 } 15410 }, 15411 submitHandler: function (form) { 15412 var v = grecaptcha.getResponse(); 15413 var $captcha = $(form).find('.captcha'); 15414 var requiredMessage = $captcha.data('val-required'); 15415 var $validationMessage = $captcha.find('.field-validation-error'); 15416 15417 if (v.length == 0) { 15418 // add the validation error message 15419 if ($validationMessage.length == 0) { 15420 $captcha.find('.g-recaptcha').after('<span class="field-validation-error">' + requiredMessage + '</span>'); 15421 } 15422 return false; 15423 } 15424 if (v.length != 0) { 15425 // remove the validation error message 15426 $validationMessage.remove(); 15427 //return true; 15428 form.submit(); 15429 } 15430 } 15431}); 15432} 15433; 15434// instantiate directions 15435$(function() { 15436 if (window.google && document.getElementById("map")) { 15437 var directions = new Directions(); 15438 } 15439}); 15440 15441/* 15442 15443 Directions (directions.js) 15444 ======================== 15445 This file contains scripts to control the mapping and directions 15446 to a site level, content managed destination 15447 15448*/ 15449 15450function Directions() { 15451 this.el = { 15452 map: document.getElementById("map"), 15453 addr: map.dataset.address, 15454 form: document.getElementById("directions-form"), 15455 input: document.getElementById("directions-input"), 15456 panel: document.querySelector(".directions-list"), 15457 staticMap: document.querySelector(".static-map-replacement"), 15458 staticMapImg: document.querySelector(".static-map-replacement").children[0] 15459 }; 15460 15461 this.settings = { 15462 map: { 15463 zoom: 12 15464 }, 15465 directions: { 15466 draggable: true, 15467 map: "", 15468 panel: "" 15469 }, 15470 staticMap: { 15471 mapsDir: "https://maps.google.com?daddr=", 15472 staticSrc:
15473 "https://maps.googleapis.com/maps/api/staticmap?size=767x500&zoom=12¢er=" 15474 } 15475 }; 15476 15477 this.init(); 15478} 15479 15480Directions.prototype.init = function() { 15481 // update settings directions panel 15482 this.settings.directions.panel = this.el.panel; 15483 15484 // instantiate map, searchbox, and directions 15485 this.settings.directions.map = this.map = new google.maps.Map( 15486 this.el.map, 15487 this.settings.map 15488 ); 15489 this.searchBox = new google.maps.places.SearchBox(this.el.input); 15490 this.directionsService = new google.maps.DirectionsService(); 15491 this.directionsDisplay = new google.maps.DirectionsRenderer( 15492 this.settings.directions 15493 ); 15494 this.geocoder = new google.maps.Geocoder(); 15495 15496 // event listeners 15497 this.el.form.addEventListener("submit", this.update.bind(this)); 15498 this.searchBox.addListener("places_changed", this.update.bind(this)); 15499 this.geocoder.geocode({ address: this.el.addr }, this.centerMap.bind(this)); 15500}; 15501 15502Directions.prototype.centerMap = function(results, status) { 15503 var loc = results[0].geometry.location; 15504 this.latlng = loc.lat() + "," + loc.lng(); 15505 var latlng = this.latlng; 15506 15507 if (status === google.maps.GeocoderStatus.OK) { 15508 this.map.setCenter(loc); 15509 15510 var pin = 15511 $("#pinLat").val() !== "" 15512 ? { 15513 lat: parseFloat($("#pinLat").val()), 15514 lng: parseFloat($("#pinLng").val()) 15515 } 15516 : loc; 15517 var marker = new google.maps.Marker({ 15518 map: this.map, 15519 position: pin 15520 }); 15521 } else { 15522 console.log("Geocode was unsuccessful: " + status); 15523 } 15524 15525 // update static image src 15526 this.settings.staticMap.staticSrc += latlng + "&markers=" + latlng; 15527 15528 // set static map link 15529 this.el.staticMap.href = this.settings.staticMap.mapsDir + latlng; 15530 15531 // set static image src 15532 this.el.staticMapImg.src = this.settings.staticMap.staticSrc; 15533}; 15534 15535Directions.prototype.update = function(e) { 15536 e && e.preventDefault(); 15537 this.calculateRoute(); 15538}; 15539 15540Directions.prototype.calculateRoute = function() { 15541 var options = { 15542 origin: this.el.input.value, 15543 destination: this.el.addr, 15544 travelMode: google.maps.TravelMode.DRIVING 15545 }; 15546 15547 var callback = function(response, status) { 15548 if (status === google.maps.DirectionsStatus.OK) { 15549 this.directionsDisplay.setDirections(response); 15550 } else { 15551 console.log("Directions request failed: " + status); 15552 } 15553 }; 15554 15555 var onUpdate = function() { 15556 $(this.el.panel).show(); 15557 }; 15558 15559 this.directionsService.route(options, callback.bind(this)); 15560 google.maps.event.addListener( 15561 this.directionsDisplay, 15562 "directions_changed", 15563 onUpdate.bind(this) 15564 ); 15565}; 15566; 15567$(function() { 15568 var napLink = $(".ftr-nap-link"); //store nap links 15569 napLink.hover(function() { 15570 if ($(window).width() >= 768) { 15571 $(this).parent().toggleClass("ftr-nap-link-hover"); //add nap-link-hover class to parent so icon changes color onhover 15572 } 15573 }); 15574}); 15575; 15576 15577function loadMap() { 15578 // if map exists, load it after 1s to allow animations to complete 15579 if ($(".ftr-google-map").length) { 15580 setTimeout(function () { 15581 initMap(null); 15582 }, 1000); 15583 } 15584} 15585// // GOOGLE MAP 15586function initMap(styledMapType) { 15587 // Create a new StyledMapType object, passing it an array of styles, 15588 // and the name to be displayed on the map type control. 15589 15590 var destAddress = $("#location").val(); 15591 15592 var geocoder = new window.google.maps.Geocoder(); 15593 15594 geocoder.geocode({ 'address': destAddress }, function(results, status) { 15595 if (status === window.google.maps.GeocoderStatus.OK) { 15596 var myOptions = { 15597 zoom: parseInt($("#zoom").val()), 15598 center: results[0].geometry.location, 15599 position: results[0].geometry.location, 15600 zoomControl: true, 15601 zoomControlOptions: { style: window.google.maps.ZoomControlStyle.LARGE } 15602 }; 15603 15604 var map = new window.google.maps.Map(document.querySelector(".ftr-google-map", myOptions), { 15605 center: results[0].geometry.location, 15606 zoom: parseInt($("#zoom").val()), 15607 scrollwheel: true, // disable scrollwheel 15608 disableDefaultUI: true, // hide zoom controls 15609 mapTypeControl: false // hide map type 15610 }); 15611 15612 //Set window width + content 15613 if ($("#contentString").val() !== "") { 15614 var infowindow = new window.google.maps.InfoWindow({ 15615 content: $("#contentString").val() 15616 // maxWidth: 500 15617 }); 15618 } 15619 //Add Marker 15620 var pin = $("#pinLat").val() !== "" ? { lat: parseFloat($("#pinLat").val()), lng: parseFloat($("#pinLng").val()) } : results[0].geometry.location; 15621 var marker = new window.google.maps.Marker({ 15622 position: pin, 15623 map: map, 15624 icon: $("#pinIcon").val(), 15625 title: $("#markerTitle").val() 15626 }); 15627 // Open marker 15628 window.google.maps.event.addListener(marker, "click", function() { 15629 infowindow.open(map, marker); 15630 }); 15631 //Resize Function 15632 window.google.maps.event.addDomListener(window, "resize", function() { 15633 var center = map.getCenter(); 15634 window.google.maps.event.trigger(map, "resize"); 15635 map.setCenter(center); 15636 }); 15637 15638 if (styledMapType != null) { 15639 //Associate the styled map with the MapTypeId and set it to display. 15640 map.mapTypes.set("styled_map", styledMapType); 15641 map.setMapTypeId("styled_map"); 15642 } 15643 } 15644 });
15645} 15646; 15647// Initialize 15648function initCarousels() { 15649 $(".mc-container").each(function () { 15650 var id = $(this).find(".media-carousel").attr("id"); 15651 var autoPlay = $(this).find("#Autoplay").val() === "true"; 15652 var infinite = $(this).find("#Infinite").val() === "true"; 15653 var pauseOnHover = $(this).find("#PauseOnHover").val() === "true"; 15654 15655 var slidesToShow = $(this).find("#SlidesToShow").val(); 15656 15657 var breakPointSlides = (slidesToShow || "").toString().split("|"); 15658 if (breakPointSlides.length !== 4) { 15659 breakPointSlides = "1|1|2|3".split("|"); 15660 } 15661 15662 var slidesToScroll = $(this).find("#SlidesToScroll").val(); 15663 var breakPointSlideScroll = (slidesToScroll || "").toString().split("|"); 15664 15665 var breakpoints = [ 15666 { 15667 breakpoint: '(max-width: 766px) and (orientation: portrait)', 15668 settings: { 15669 slidesToShow: toIntOrUndefined(breakPointSlides[0]), 15670 slidesToScroll: toIntOrUndefined(breakPointSlideScroll[0]) 15671 } 15672 }, 15673 { 15674 breakpoint: '(max-width: 766px) and (orientation: landscape)', 15675 settings: { 15676 slidesToShow: toIntOrUndefined(breakPointSlides[1]), 15677 slidesToScroll: toIntOrUndefined(breakPointSlideScroll[1]) 15678 } 15679 }, 15680 { 15681 breakpoint: '(min-width: 767px) and (orientation: portrait)', 15682 settings: { 15683 slidesToShow: toIntOrUndefined(breakPointSlides[2]), 15684 slidesToScroll: toIntOrUndefined(breakPointSlideScroll[2]) 15685 } 15686 }, 15687 { 15688 breakpoint: '(min-width: 767px) and (orientation: landscape)', 15689 settings: { 15690 slidesToShow: toIntOrUndefined(breakPointSlides[3]), 15691 slidesToScroll: toIntOrUndefined(breakPointSlideScroll[3]) 15692 } 15693 } 15694 ]; 15695 15696 var newCarousel = new Carousel( 15697 "#" + id, 15698 $(this).find("#AnimationType").val(), 15699 autoPlay, 15700 parseInt($(this).find("#Speed").val()), 15701 infinite, 15702 pauseOnHover, 15703 breakpoints 15704 ); 15705 15706 newCarousel.init(); 15707 15708 loadAnimations(); 15709 }); 15710} 15711 15712function Carousel(name, animationType, autoplay, speed, infinite, pauseOnHover, breakpoints) { 15713 15714 this.name = $(name); 15715 this.init = function () { 15716 this.name.slick({ 15717 arrows: true, // arrows turned on by default and shut off with class 15718 dots: true, // dots turned on by default and shut off with class 15719 autoplay: autoplay || false, 15720 speed: speed || 300, 15721 infinite: infinite || true, 15722 pauseOnHover: pauseOnHover || false, 15723 waitForAnimate: false, 15724 useTransform: true, 15725 cssEase: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)', 15726 responsive: breakpoints, 15727 accessibility: true, 15728 }); 15729 // Run animations before user input accepted 15730 this.name.on('beforeChange', 15731 function () { 15732 loadAnimations(); 15733 }); 15734 this.setupADA(); 15735 this.name.on('afterADA', () => { 15736 this.setupADA(); 15737 }); 15738 15739 // Set fadeIn animation on slides, then dots 15740 if ($('.simple-media-carousel').length === 0) { 15741 $(name).find('.slick-active').not('li.slick-active, .slick-cloned').addClass(animationType); 15742 $(name).find('.slick-dots').addClass(animationType); 15743 } 15744 } 15745 this.setupADA = function () { 15746 const totalSlides = this.name[0].slick.slideCount; 15747 const controlName = this.name[0].id; 15748 const $mainHeading = $(this.name).parent().find('.mc-main-heading'); 15749 const mainHeadingText = $mainHeading.text().trim(); 15750 15751 this.name.removeAttr('role'); 15752 15753 //Nav Buttons 15754 const $prev = this.name.find('.slick-prev'); 15755 const $next = this.name.find('.slick-next'); 15756 $prev.removeAttr("role"); 15757 $prev.removeAttr("data-role"); 15758 $prev.removeAttr("style"); 15759 $prev.removeAttr("type"); 15760 $prev.attr('aria-controls', controlName); 15761 $prev.attr('tabindex', "0"); 15762 $prev.attr('data-controls', "prev"); 15763 $prev.attr('aria-label', `${mainHeadingText} carousel previous`); 15764 15765 $next.removeAttr("role"); 15766 $next.removeAttr("data-role"); 15767 $next.removeAttr("style"); 15768 $next.removeAttr("type"); 15769 $next.attr('aria-controls', controlName); 15770 $next.attr('tabindex', "0"); 15771 $next.attr('data-controls', "next"); 15772 $next.attr('aria-label', `${mainHeadingText} carousel next`); 15773 15774 //Slides 15775 const $slideContainer = this.name.find('.slick-list'); 15776 const $slideTrack = $slideContainer.find('.slick-track'); 15777 const $slides = $slideTrack.find('.mc-slide'); 15778 const numberOfClonedSlides = $slideTrack.find('.slick-cloned').length; 15779 $slideContainer.removeAttr('aria-live'); 15780 $slideTrack.attr('role', 'region'); 15781 $slideTrack.attr('aria-live', 'off'); 15782 $slideTrack.attr('aria-roledescription', 'carousel'); 15783 $slideTrack.attr('aria-atomic', 'false'); 15784 if ($mainHeading.length) { 15785 $slideTrack.attr('aria-labelledby', $mainHeading[0].id); 15786 } 15787 15788 $slides.each((i, elem) => { 15789 const $el = $(elem); 15790 const $ctas = $el.find('.aria-label-elem'); 15791 const currentItem = i + 1; 15792 const firstSlideIndex = numberOfClonedSlides / 2; 15793 $el.removeAttr('role'); 15794 $el.removeAttr('aria-describedby'); 15795 $el.removeAttr('data-slick-index'); 15796 $el.removeAttr('id'); 15797 $el.attr('id', `slide-${currentItem}`); 15798 $el.attr('aria-hidden', 'false'); 15799 $el.attr('tabindex', '-1'); 15800 15801 if (i === firstSlideIndex) { 15802 const slidePositionText = `Slide ${currentItem - (numberOfClonedSlides / 2)} of ${$slides.length - numberOfClonedSlides},` 15803 if ($ctas.attr('aria-label')) { 15804 $ctas.attr('aria-label', `${slidePositionText} ${$ctas.attr('aria-label')}`); 15805 } 15806 } 15807 }); 15808 15809 //dots 15810 const $dotsContainer = this.name.find('.slick-dots'); 15811 const $dotsContainerInner = this.name.find('.slick-dots li'); 15812 const $dotsButtons = this.name.find('.slick-dots li button'); 15813 $dotsContainer.removeAttr("role"); 15814 $dotsContainer.removeAttr("style"); 15815 $dotsContainer.attr('tabindex', "-1"); 15816 $dotsContainerInner.attr('tabindex', "0"); 15817 15818 $dotsButtons.each((i, elem) => { 15819 const $el = $(elem); 15820 const $par = $el.parent(); 15821 const currentItem = i + 1; 15822 $el.removeAttr("data-role"); 15823 $el.removeAttr("aria-required"); 15824 $el.attr('aria-label', `Item ${currentItem} of ${totalSlides} in ${mainHeadingText} carousel`); 15825 $el.attr('aria-controls', controlName); 15826 $el.attr('data-nav', currentItem); 15827 $el.attr('tabindex', "0"); 15828 15829 $par.attr("aria-hidden", 'false'); 15830 $par.attr("tabindex", "-1"); 15831 $par.removeAttr("role"); 15832 $par.removeAttr("aria-selected"); 15833 $par.removeAttr("aria-controls"); 15834 }); 15835 } 15836} 15837 15838// Equalize slide heights function 15839function equalizeHeadingHeights(selector) { 15840 const $containers = $(selector); 15841 $containers.each(function (index, container) { 15842 const $container = $(container); 15843 const equalHeights = []; 15844 // Loop to get all element heights 15845 $container.find('.mc-heading-wrapper').each(function () { 15846 // Need to let sizes be whatever they want so no overflow on resize 15847 $(this).css('min-height', '0'); 15848 $(this).css('max-height', 'none'); 15849 $(this).css('height', 'auto'); 15850 // Then add size (no units) to array 15851 equalHeights.push($(this).height()); 15852 }); 15853 // Find max height of all elements 15854 var maxHeight = Math.max.apply(Math, equalHeights); 15855 // Set all heights to max height 15856 $container.find('.mc-heading-wrapper').each(function () { 15857 if ($(this).text().trim().length) { 15858 $(this).css('height', maxHeight + 'px'); 15859 $(this).css('min-height', ''); 15860 $(this).css('max-height', ''); 15861 } 15862 // If .mc-heading doesn't have any textContent, set height to 0 15863 else { 15864 $(this).css('height', 0); 15865 } 15866 }); 15867 });
15868} 15869 15870function equalizeImageHeights(selector) { 15871 const $containers = $(selector); 15872 $containers.each(function (index, container) { 15873 const $container = $(container); 15874 // Find shortest image used in versionOne carousel 15875 let shortestImage = 10000; 15876 $container.find('.mc-image').each(function () { 15877 const curImageHeight = Math.round($(this).height()); 15878 if (curImageHeight < shortestImage) { 15879 shortestImage = curImageHeight; 15880 } 15881 }); 15882 // Set max-height to .mc-image-wrapper to 'crop' images to equal height 15883 $container.find('.mc-image-wrapper:not(.mc-no-image-placeholder)').css('height', shortestImage); 15884 }); 15885} 15886 15887function equalizeImageMaxHeights(selector) { 15888 const $containers = $(selector); 15889 $containers.each(function (index, container) { 15890 const $container = $(container); 15891 // Find shortest image used in versionOne carousel 15892 let shortestImage = 10000; 15893 $container.find('.mc-image').each(function () { 15894 if ($(this).height() < shortestImage) { 15895 shortestImage = $(this).height(); 15896 } 15897 }); 15898 // Set max-height to .mc-image-wrapper to 'crop' images to equal height 15899 $container.find('.mc-image-wrapper:not(.mc-no-image-placeholder)').css('max-height', shortestImage); 15900 }); 15901} 15902// Check device orientation 15903function isPortrait() { 15904 return window.innerHeight > window.innerWidth; 15905} 15906function isLandscape() { 15907 return window.innerHeight < window.innerWidth; 15908} 15909 15910// Get the height of the tallest copy area and apply it to all of them 15911// Select and loop the container element of the elements you want to equalise 15912function equalizeCopyHeight(selector) { 15913 const $containers = $(selector); 15914 $containers.each(function (index, container) { 15915 const $container = $(container); 15916 // Cache the highest 15917 var copyHeight = 0; 15918 // Select and loop the elements you want to equalise 15919 if ($(window).width() > 500 && isPortrait() || $(window).height() > 500 && isLandscape() || $('.corp-nav-icon-wrapper')) { //Only equalise if tablet and above or it's a corp/ab site 15920 $container.find('.mc-content-wrapper').each(function () { 15921 // If this box is higher than the cached highest then store it 15922 if ($(this).height() > copyHeight) { 15923 copyHeight = $(this).height(); 15924 } 15925 }); 15926 // Set the height of all those children to whichever was highest 15927 $container.find('.mc-content-wrapper').height(copyHeight); 15928 } 15929 }); 15930} 15931function equalizeCopyTextHeight(selector) { 15932 const $containers = $(selector); 15933 $containers.each(function (index, container) { 15934 const $container = $(container); 15935 let copyHeight = 0; 15936 $container.find('.mc-copy-wrapper').each(function () { 15937 $(this).css('height', ''); 15938 if ($(this).height() > copyHeight) { 15939 copyHeight = $(this).height(); 15940 } 15941 }); 15942 $container.find('.mc-copy-wrapper').height(copyHeight); 15943 }); 15944} 15945 15946// Clear copy height 15947function clearCopyHeight(selector) { 15948 $(selector).find('.mc-content-wrapper').css('height', ''); 15949} 15950// Clear category height 15951function clearCategoryHeight(selector) { 15952 $(selector).find('.mc-category-hr-wrapper').css('height', ''); 15953} 15954 15955function equalizeCategoryHeight(selector) { 15956 const $containers = $(selector); 15957 $containers.each(function (index, container) { 15958 const $container = $(container); 15959 // Cache the highest 15960 var categoryHeight = 0; 15961 // Select and loop the elements you want to equalise 15962 if ($(window).width() > 500 && isPortrait() || $(window).height() > 500 && isLandscape()) { //Only equalise if tablet and above 15963 $container.find('.mc-category-hr-wrapper').each(function () { 15964 // If this categor area is higher than the cached highest then store it 15965 if ($(this).height() > categoryHeight) { 15966 categoryHeight = $(this).height(); 15967 } 15968 // Set the height of all those children to whichever was highest 15969 }); 15970 $container.find('.mc-category-hr-wrapper').height(categoryHeight); 15971 } 15972 });
15973} 15974 15975function equalizeCTAHeight(selector) { 15976 const $containers = $(selector); 15977 $containers.each(function (index, container) { 15978 const $container = $(container); 15979 $container.find('.mc-cta').css('height', ''); 15980 let tallest = 0; 15981 $container.find('.mc-cta').each(function () { 15982 if ($(this).height() > tallest) { 15983 tallest = $(this).height(); 15984 } 15985 }); 15986 $container.find('.mc-cta').css('height', tallest); 15987 }); 15988} 15989 15990 15991function generateSlideNumbers(carousel) { 15992 $(carousel).each(function () { 15993 $(this).find(".mc-slide").each(function (i, elem) { 15994 const $el = $(elem); 15995 if (i > 8) { 15996 $el 15997 .find(".mc-slide-number") 15998 .text(i + 1); 15999 } else { 16000 $el 16001 .find(".mc-slide-number") 16002 .text("0" + (i + 1)); 16003 } 16004 }); 16005 }); 16006} 16007 16008// Align slick arrows with CTAs in media-carousel-three 16009function alignArrowsWithCta() { 16010 var arrows = $('.media-carousel-three .slick-next,.media-carousel-three .slick-prev'); 16011 var ctaDistance = $('.media-carousel-three .mc-cta').position(); 16012 var ctaFontSize = parseInt($('.media-carousel-three .mc-cta').css('font-size')); 16013 if (ctaDistance) { 16014 var arrowOffset = ctaDistance.top + ctaFontSize; 16015 arrows.css('top', arrowOffset); 16016 } 16017} 16018 16019function toIntOrUndefined(num) { 16020 var result = parseInt(num); 16021 if (isNaN(result)) { 16022 return undefined; 16023 } 16024 return result; 16025} 16026 16027// ****** OnLoad ************ // 16028$(window).on('load', function () { 16029 // Equal height .mc-headings for versionTwo 16030 equalizeHeadingHeights('.media-carousel-two'); 16031 // Find shortest image used in versionOne carousel 16032 equalizeImageMaxHeights('.media-carousel-one'); 16033 // Align slick arrows with CTAs in media-carousel-three 16034 16035 handleResizeVariantFive('.media-carousel-five'); 16036 16037 alignArrowsWithCta(); 16038 16039 // autoplay video if .kaltura-auto class is added 16040 $('.kaltura-auto').on('click', function () { 16041 this.href += '[autoPlay]=true[streamerType]=auto'; 16042 }); 16043 // stop currently playing video and remove autoplay when moving to new slide 16044 $(document.body).on('click', '.slick-lightbox .slick-next, .slick-lightbox .slick-prev', function () { 16045 $('.slick-slide iframe').not('.slick-active iframe').each(function () { 16046 var src = $(this).attr('src').replace('[autoPlay]=true[streamerType]=auto', ''); 16047 $(this).attr('src', src); 16048 }); 16049 }); 16050 // stop currently playing video and remove autoplay when sliding to new slide 16051 $(document.body).on('touchstart', '.slick-lightbox', function () { 16052 $('iframe').each(function () { 16053 var src = $(this).attr('src').replace('[autoPlay]=true[streamerType]=auto', ''); 16054 $(this).attr('src', src); 16055 }); 16056 }); 16057 16058}); 16059// ******* END onLoad ********* // 16060// **** RESIZE ********* // 16061function setSlideSize(selector) { 16062 clearCopyHeight(selector); 16063 equalizeCopyHeight(selector); 16064 equalizeCategoryHeight(selector); 16065} 16066function handleResize() { 16067 setSlideSize('.media-carousel-one'); 16068 setSlideSize('.media-carousel-two'); 16069 setSlideSize('.media-carousel-three'); 16070 equalizeHeadingHeights('.media-carousel-two'); 16071 equalizeImageMaxHeights('.media-carousel-one'); 16072 16073 handleResizeVariantFive('.media-carousel-five'); 16074 alignArrowsWithCta(); 16075} 16076 16077function handleResizeVariantFive(mcClass) { 16078 equalizeHeadingHeights(mcClass); 16079 equalizeCopyTextHeight(mcClass); 16080 equalizeCTAHeight(mcClass); 16081 equalizeCategoryHeight(mcClass); 16082 equalizeImageHeights(mcClass); 16083} 16084$(window).resize(_.debounce(handleResize, 120)); 16085// ******* END RESIZE ******* // 16086 16087// ******** Doc ready ******** // 16088$(function () { 16089 // Hide sliders until doc is ready 16090 $('.media-carousel-one').show(); 16091 $('.media-carousel-two').show(); 16092 $('.media-carousel-three').show(); 16093 $('.media-carousel-five').show(); 16094 16095 // Capture slide indices to display slide numbers 16096 generateSlideNumbers(".media-carousel-one"); 16097 generateSlideNumbers(".media-carousel-two"); 16098 generateSlideNumbers(".media-carousel-three"); 16099 16100 var mediaCarouselContainer = $('.mc-container'); 16101 // if icons are hidden then vertically center .mc-headings 16102 if (!mediaCarouselContainer.hasClass('show-icons')) {
16103 $('.mc-heading-wrapper').css('-webkit-justify-content', 'center'); 16104 $('.mc-heading-wrapper').css('justify-content', 'center'); 16105 } 16106 16107 // if heading exists in carouselOne add some padding-bottom 16108 $('.media-carousel-one .mc-heading').each(function () { 16109 if ($(this).text().trim().length) { 16110 $(this).css('padding-bottom', 10 + 'px'); 16111 } 16112 }); 16113 // if heading exists in carouselThree add some padding-bottom 16114 $('.media-carousel-three .mc-heading').each(function () { 16115 if ($(this).text().trim().length) { 16116 $(this).css('padding-bottom', 10 + 'px'); 16117 } 16118 }); 16119 // polyfill to allow for object-fit on images 16120 objectFitImages(); 16121 16122 // initialize lightbox, select items via class 16123 $('.media-carousel').slickLightbox({ 16124 caption: 'my-caption', 16125 itemSelector: '.light-up', 16126 slick: { 16127 speed: 0 16128 } 16129 }); 16130 16131 // Check for custom init script 16132 if (typeof window.initCarouselsCustom != 'undefined') { 16133 window.initCarouselsCustom(); 16134 } else { 16135 initCarousels(); 16136 } 16137 handleResize(); 16138}); 16139// ********* END Doc Ready ********** // 16140; 16141$(window).on("load", function() { 16142 $(".yearbook-container").show(); 16143 initYearbook(); 16144 // if yearbook links exist make room for them 16145 positionYearbookContent(); 16146 positionYearbookThreeLinks(); 16147 if ($(".yearbook-three").length) { 16148 $(window).on("resize", _.debounce(positionYearbookThreeLinks, 100)); 16149 } 16150 16151 branchYearbookTruncation('.branch-yearbook-list__name, .branch-yearbook__name'); 16152 // load animations 16153 toggleArrows(".yearbook-carousel-one"); 16154 toggleArrows(".yearbook-carousel-two"); 16155 toggleArrows(".yearbook-carousel-three"); 16156 16157 initializeYearbook5(); 16158}); 16159function initYearbook() { 16160 var yearbookCarousel; 16161 var yearbookBreakpoints; 16162 $(".yearbook-container").each(function () { 16163 16164 var isCorporate = $('.corp-site-nav-logo-desktop').length > 0 || $('.ab-nav-logo-desktop').length > 0; 16165 if (isCorporate) { 16166 var $firstLast = $('.yearbook-first-last-title'); 16167 16168 //TRUNCATE CORP FIRST LAST DESIGNATION 16169 $firstLast.each(function() { 16170 var $fn = $(this).find('.yearbook-first-name'); 16171 var $ln = $(this).find('.yearbook-last-name'); 16172 var $desig = $(this).find('.yearbook-designation-wrapper'); 16173 16174 var fnText = $fn.text().trim(); 16175 var lnText = $ln.text().trim(); 16176 var desigText = $desig.text().trim(); 16177 var str = fnText + " " + lnText + " " + desigText; 16178 16179 var truncStr = _.truncate(str, 16180 { 16181 length: 37, 16182 separator: /,?\.* +/ // separate by spaces, including preceding commas and periods 16183 }); 16184 16185 $fn.text(truncStr); 16186 $ln.hide(); 16187 $desig.hide(); 16188 16189 }); 16190 16191 //TRUNCATE CORP YEARBOOK TITLES AT 63 CHARS 16192 var $titles = $(this).find('.yearbook-title'); 16193 $titles.each(function () { 16194 var str = $(this).text(); 16195 var truncStr = _.truncate(str, 16196 { 16197 length: 63, 16198 separator: /,?\.* +/ // separate by spaces, including preceding commas and periods 16199 }); 16200 $(this).text(truncStr); 16201 }); 16202 16203 } //END ISCORPORATE 16204 16205 // NAME 16206 var yearbookName = $(".yearbookName").val(); 16207 // SLIDE ON MOBILE? 16208 var noSlideMobile = $(".yearbookNoSlideMobile").val() === "true"; 16209 // SLIDE TAB DESK 16210 var slideTabDesk = $(".yearbookSlideTabDesk").val() === "true"; 16211 // ANIMATION 16212 var animationType = $(".yearbookAnimationType").val(); 16213 // SLIDES TO SHOW 16214 var slidesToShow = $(".yearbookSlidesToShow").val(); 16215 // SLIDES TO SCROLL 16216 var slidesToScroll = parseInt($(".yearbookSlidesToScroll").val()); 16217 // SPEED 16218 var speed = parseInt($(".yearbookSpeed").val()); 16219 // AUTOPLAY 16220 var autoPlay = $(".yearbookAutoPlay").val() === "true"; 16221 // PAUSE ON HOVER 16222 var pauseOnHover = $(".yearbookPauseOnHover").val() === "true"; 16223 // BREAKPOINT SLIDES 16224 var yearbookBreakPointSlides = slidesToShow.toString().split("|"); 16225 if (yearbookBreakPointSlides.length !== 4) { 16226 yearbookBreakPointSlides = "1|1|2|3".split("|"); 16227 } 16228 // BREAKPOINTS 16229 if (slideTabDesk === true) { 16230 yearbookBreakpoints = [ 16231 { 16232 breakpoint: "(max-width: 767px) and (orientation: portrait)", 16233 settings: { 16234 slidesToShow: yearbookBreakPointSlides[0], 16235 centerMode: false 16236 } 16237 }, 16238 { 16239 breakpoint: "(max-width: 767px) and (orientation: landscape)", 16240 settings: { 16241 slidesToShow: yearbookBreakPointSlides[1], 16242 centerMode: false 16243 } 16244 }, 16245 { 16246 breakpoint: "(min-width: 768px) and (orientation: portrait)", 16247 settings: {
16248 arrows: false, 16249 slidesToShow: yearbookBreakPointSlides[2], 16250 slidesToScroll: slidesToScroll, 16251 centerMode: false 16252 } 16253 }, 16254 { 16255 breakpoint: "(min-width: 768px) and (orientation: landscape)", 16256 settings: { 16257 slidesToShow: yearbookBreakPointSlides[3], 16258 slidesToScroll: slidesToScroll, 16259 centerMode: false 16260 } 16261 } 16262 ]; 16263 } else if (noSlideMobile === true) { 16264 yearbookBreakpoints = { 16265 settings: "unslick" 16266 }; 16267 } else { 16268 if ($(window).width() >= 768) { 16269 $(this) 16270 .find(".yearbook-slide") 16271 .addClass(animationType); 16272 } 16273 yearbookBreakpoints = [ 16274 { 16275 breakpoint: "(max-width: 767px) and (orientation: portrait)", 16276 settings: { 16277 slidesToShow: yearbookBreakPointSlides[0], 16278 centerMode: false 16279 } 16280 }, 16281 { 16282 breakpoint: "(max-width: 767px) and (orientation: landscape)", 16283 settings: { 16284 slidesToShow: yearbookBreakPointSlides[1], 16285 centerMode: false 16286 } 16287 }, 16288 { 16289 breakpoint: "(min-width: 768px) and (orientation: portrait)", 16290 settings: "unslick" 16291 }, 16292 { 16293 breakpoint: "(min-width: 768px) and (orientation: landscape)", 16294 settings: "unslick" 16295 } 16296 ]; 16297 } 16298 // MAKE THE CAROUSEL 16299 yearbookCarousel = new YearbookCarousel( 16300 "." + yearbookName, 16301 slideTabDesk, 16302 animationType, 16303 slidesToShow, 16304 slidesToScroll, 16305 speed, 16306 autoPlay, 16307 pauseOnHover, 16308 yearbookBreakpoints 16309 ); 16310 if (noSlideMobile === false) { 16311 yearbookCarousel.init(); 16312 } 16313 loadAnimations(); 16314 positionYearbookContent(); 16315 positionYearbookThreeLinks(); 16316 }); 16317} 16318/** YEARBOOK CONSTRUCTOR 16319 * name, // element classname 16320 * slideTabDesk // run carousel on all devices? 16321 * animationType, // configures how slides fade in or out 16322 * slidesToShow = 1|1|2|4, // # of slides to show 16323 * slidesToScroll = # of slides to scroll 16324 * autoplay = false, // enables autoplay 16325 * speed = 300, // slide animation speed 16326 * infinite = true, // infinite loop sliding 16327 * pauseOnHover = false // pause autoplay on hover 16328 * yearbookBreakpoints = array of breakpoints at different screen sizes/orientations 16329*/ 16330function YearbookCarousel( 16331 name, 16332 slideTabDesk, 16333 animationType, 16334 slidesToShow, 16335 slidesToScroll, 16336 speed, 16337 autoPlay, 16338 pauseOnHover, 16339 yearbookBreakpoints 16340) { 16341 this.name = $(name); 16342 this.init = function() { 16343 // Slider on tablet + ?? 16344 if (slideTabDesk === true) { 16345 this.name.slick({ 16346 arrows: true, // arrows turned on by default and shut off with class 16347 dots: true, // dots turned on by default and shut off with class 16348 slidesToShow: slidesToShow || 1, 16349 autoplay: autoPlay || false, 16350 speed: speed || 300, 16351 infinite: true, 16352 pauseOnHover: pauseOnHover || false, 16353 waitForAnimate: true, 16354 useTransform: false, 16355 cssEase: "cubic-bezier(0.250, 0.460, 0.450, 0.940)", 16356 mobileFirst: true, 16357 centerMode: true, 16358 centerPadding: "0px", 16359 responsive: yearbookBreakpoints 16360 }); 16361 } else { 16362 this.name.slick({ 16363 arrows: true, // arrows turned on by default and shut off with class 16364 dots: true, // dots turned on by default and shut off with class 16365 slidesToShow: slidesToShow || 1, 16366 autoplay: autoPlay || false, 16367 speed: speed || 300, 16368 infinite: true, 16369 pauseOnHover: pauseOnHover || false, 16370 waitForAnimate: true, 16371 useTransform: false, 16372 cssEase: "cubic-bezier(0.250, 0.460, 0.450, 0.940)", 16373 mobileFirst: true, 16374 centerMode: true, 16375 centerPadding: "0px", 16376 responsive: yearbookBreakpoints 16377 }); 16378 // reslick on resize to mobile 16379 var handleResize = function () { 16380 if ($(window).width() > 767) { 16381 if ($(name).hasClass("slick-initialized")) { 16382 $(name).slick("unslick"); 16383 } 16384 } else { 16385 initYearbook(); 16386 } 16387 positionYearbookContent(); 16388 }; 16389 $(window).on("resize", _.debounce(handleResize, 200)); 16390 } 16391 // Set animation on slides, then dots 16392 $(name) 16393 .find(".slick-active") 16394 .not("li.slick-active, .slick-cloned") 16395 .addClass(animationType); 16396 $(name) 16397 .find(".slick-dots") 16398 .addClass(animationType); 16399 }; 16400} 16401function toggleArrows(selector) { 16402 $(selector) 16403 .hover( 16404 function() { 16405 // show arrows on mouseenter 16406 $(this).addClass("show-arrow"); 16407 }, 16408 function() { 16409 // hide arrows on mouseleave 16410 $(this).removeClass("show-arrow"); 16411 } 16412 ) 16413 .mousemove(function() { 16414 // show arrows on mousemove 16415 $(this).addClass("show-arrow"); 16416 // then unbind 16417 $(this).unbind("mousemove"); 16418 });
16419} 16420function positionYearbookContent() { 16421 var $yearbookFirstLastTitle = $(".yearbook-first-last-title"); 16422 $yearbookFirstLastTitle.each(function () { 16423 var $yearbookSlide = $(this).closest(".yearbook-slide"); 16424 var $yearbookLinks = $yearbookSlide.find(".yearbook-links"); 16425 var $yearbookCtaWrapper = $yearbookSlide.find(".yearbook-cta-wrapper"); 16426 16427 var yearbookCtaWrapperHeight = $yearbookCtaWrapper.outerHeight(); 16428 var yearbookLinksHeight = $yearbookLinks.length ? $yearbookLinks.outerHeight() : 0; 16429 var yearbookCombinedHeight = yearbookCtaWrapperHeight + yearbookLinksHeight; 16430 16431 $yearbookLinks.css("bottom", yearbookCtaWrapperHeight); //position the yearbook-links to rest above the CTA wrapper 16432 $(this).css("bottom", yearbookCombinedHeight); //position the yearbook-first-last-title to rest above the yearbook-links 16433 }); 16434} 16435function positionYearbookThreeLinks() { 16436 var yearbookNameHeight = 0; 16437 $(".yearbook-carousel-three .yearbook-name-wrapper").each(function() { 16438 if ($(this).height() > yearbookNameHeight) { 16439 yearbookNameHeight = $(this).height(); 16440 } 16441 }); 16442 $(".yearbook-carousel-three .yearbook-name-wrapper").height( 16443 yearbookNameHeight 16444 ); 16445} 16446function branchYearbookTruncation(elements) { 16447 var ellipsisConf = { 16448 break_word: false, 16449 debounce: 500, 16450 lines: 2 16451 }; 16452 var ellipsis = new Ellipsis(ellipsisConf); 16453 var els = $(elements); 16454 ellipsis.add(els); 16455} 16456 16457function initializeYearbook5() { 16458 const $yearbook5s = $(".yearbook-five"); 16459 if (!$yearbook5s.length) { 16460 return; 16461 } 16462 $(window).resize(() => { 16463 setBioEqualHeights(); 16464 }); 16465 //one off for bio listing 16466 function setBioEqualHeights() { 16467 const winWidth = window.innerWidth || 0; 16468 16469 if (winWidth >= 992) { 16470 $('.bio-cont').each(function () { 16471 var maxHeight = 0; 16472 16473 $(this).find('.bio-single').each(function () { 16474 $(this).removeAttr('style'); 16475 maxHeight = Math.max(maxHeight, $(this).outerHeight()); 16476 }); 16477 $(this).find('.bio-single').css('height', maxHeight + 'px'); 16478 16479 }); 16480 } else { 16481 $('.bio-single').removeAttr('style'); 16482 } 16483 } 16484}; 16485$(function () { 16486 // open filter via button on mobile 16487 $(".mobile-resource-filter-button").on("click", function (e) { 16488 e.preventDefault(); 16489 $(".resource-filter-dropdown").slideToggle(); 16490 }); 16491 // open filter type dropdown 16492 $(".resource-filter-container").on("click", ".resource-filter-link", function ( 16493 e 16494 ) { 16495 e.preventDefault(); 16496 var $this = $(this); 16497 var $next = $this.next(); 16498 $(".resource-filter-body-container") 16499 .not($next) 16500 .slideUp(); 16501 var resourceFilterType = $this.attr("data-filter-type"); 16502 if ($this.hasClass("applied")) { 16503 $this.text(resourceFilterType).removeClass("applied"); 16504 } else { 16505 $next.slideToggle(); 16506 } 16507 }); 16508 // open inner filter type items 16509 $(".resource-filter-body-link-with-children").on( 16510 "click", 16511 ".resource-filter-inner-link", 16512 function (e) { 16513 e.preventDefault(); 16514 var $this = $(this); 16515 var $next = $this.next(); 16516 $next.slideToggle(); 16517 $this.toggleClass("open"); 16518 16519 $(".resource-filter-inner-link") 16520 .not($this) 16521 .removeClass("open"); 16522 16523 $(".resource-filter-dropdown") 16524 .find(".resource-filter-inner-body") 16525 .not($next) 16526 .slideUp() 16527 .removeClass("open"); 16528 } 16529 ); 16530 // apply year to filter on click 16531 $(".resource-filter-year").on("click", function (e) { 16532 e.preventDefault(); 16533 var $this = $(this); 16534 var resourceYear = $this.attr("data-year"); 16535 var $resourceParent = $this 16536 .parents(".resource-filter") 16537 .find(".resource-filter-link"); 16538 $resourceParent.text(resourceYear).addClass("applied"); 16539 $(".resource-filter-body-container").slideUp(); 16540 });
16541 // apply inner filters to each type 16542 $(".resource-filter-inner-body").on( 16543 "click", 16544 ".resource-filter-inner-body-link", 16545 function (e) { 16546 e.preventDefault(); 16547 var $this = $(this); 16548 var resourceYear = $this 16549 .parents(".resource-filter-inner-body") 16550 .siblings(".resource-filter-year") 16551 .attr("data-year"); 16552 var resourceMonth = $this.attr("data-month"); 16553 var $resourceParent = $this 16554 .parents(".resource-filter") 16555 .find(".resource-filter-link"); 16556 $resourceParent 16557 .text(resourceMonth + " " + resourceYear) 16558 .addClass("applied"); 16559 $(".resource-filter-body-container").slideUp(); 16560 } 16561 ); 16562 // apply top level filters to each type 16563 $(".resource-filter-body").on("click", ".resource-filter-body-link", function ( 16564 e 16565 ) { 16566 e.preventDefault(); 16567 var $this = $(this); 16568 var resourceFilterName = $this.attr("data-filterName"); 16569 var $resourceParent = $this 16570 .parents(".resource-filter") 16571 .find(".resource-filter-link"); 16572 $resourceParent.text(resourceFilterName).addClass("applied"); 16573 $(".resource-filter-body-container").slideUp(); 16574 }); 16575 // reset filter button 16576 $(".resource-filter-reset").on("click", function (e) { 16577 e.preventDefault(); 16578 $(".resource-filter-link").each(function () { 16579 var resourceFilterType = $(this).attr("data-filter-type"); 16580 $(this) 16581 .text(resourceFilterType) 16582 .removeClass("applied"); 16583 }); 16584 // close filter dropdowns 16585 $(".resource-filter-body-container").slideUp(); 16586 }); 16587 // click out of filter container to close filters 16588 $("body").on("click", function (e) { 16589 if ($(e.target).parents(".resource-filter-container").length) { 16590 return; 16591 } else { 16592 $(".resource-filter-body-container").slideUp(); 16593 } 16594 }); 16595 // hide dropdown on mobile 16596 $(window).on("resize", function () { 16597 if ($(window).width() > 767) { 16598 $(".resource-filter-dropdown").show(); 16599 } else { 16600 $(".resource-filter-dropdown").hide(); 16601 } 16602 }); 16603}); 16604 16605/* Resource Detail Info Share Wrapper */ 16606if ( 16607 $(".resource-detail-info-wrapper") 16608 .children(".resource-detail-info-divider") 16609 .is(":last-child") 16610) { 16611 $(".resource-detail-info-wrapper") 16612 .children(".resource-detail-info-divider") 16613 .last() 16614 .css("display", "none"); 16615 $(".resource-detail-copy-wrapper").css("margin-top", "0"); 16616} 16617 16618/* resource Prev/Next JS */ 16619var $resourceDetailContainer = $(".resource-detail-overall-wrapper"); 16620var $resourceDetailNextLinkWrapper = $(".resource-detail-next-link-wrapper"); 16621var $resourceDetailPreviousLinkWrapper = $( 16622 ".resource-detail-previous-link-wrapper" 16623); 16624var $resourceDetailLinks = $( 16625 ".resource-detail-previous-link-wrapper, .resource-detail-next-link-wrapper" 16626); 16627 16628function resourceArrowOff() { 16629 $resourceDetailLinks.css({ 16630 opacity: 0, 16631 "z-index": -1 16632 }); 16633} 16634 16635function resourceArrowOn() { 16636 var resourceLinkHeight = $resourceDetailNextLinkWrapper.height(); 16637 var resourceNavHeight = $(".nav").outerHeight(); 16638 $resourceDetailLinks.css({ 16639 top: resourceNavHeight + resourceLinkHeight, 16640 opacity: 1, 16641 "z-index": 3 16642 }); 16643} 16644 16645function toggleresourceArrowScroll() { 16646 var resourceDetailTop = $resourceDetailContainer.offset() 16647 ? $resourceDetailContainer.offset().top 16648 : 0; 16649 var resourceDetailHeight = $resourceDetailContainer.height(); 16650 var resourceLinkTop = $resourceDetailNextLinkWrapper.offset() 16651 ? $resourceDetailNextLinkWrapper.offset().top 16652 : 0; 16653 var resourceLinkHeight = $resourceDetailNextLinkWrapper.height(); 16654 if ( 16655 resourceLinkTop >= resourceDetailTop && 16656 resourceLinkTop <= 16657 resourceDetailTop + resourceDetailHeight - resourceLinkHeight 16658 ) { 16659 resourceArrowOn(); 16660 } else { 16661 resourceArrowOff(); 16662 } 16663} 16664 16665var $resourceDetailPreviousLink = $(".resource-detail-previous-l
16665ink"); 16666var $resourceDetailNextLink = $(".resource-detail-next-link"); 16667$resourceDetailPreviousLink.hover( 16668 function () { 16669 $(this) 16670 .parent() 16671 .addClass("hover-link"); 16672 }, 16673 function () { 16674 $(this) 16675 .parent() 16676 .removeClass("hover-link"); 16677 } 16678); 16679$resourceDetailNextLink.hover( 16680 function () { 16681 $(this) 16682 .parent() 16683 .addClass("hover-link"); 16684 }, 16685 function () { 16686 $(this) 16687 .parent() 16688 .removeClass("hover-link"); 16689 } 16690); 16691 16692$(window).on("scroll", function () { 16693 if ($(window).width() > 1200) { 16694 toggleresourceArrowScroll(); 16695 } 16696}); 16697/* End resource Prev/Next JS */; 16698/* Blog Filter JS */ 16699$(function () { 16700 // open filter via button on mobile 16701 $(".mobile-blog-filter-button").on("click", function (e) { 16702 e.preventDefault(); 16703 $(".blog-filter-dropdown").slideToggle(); 16704 }); 16705 // open filter type dropdown 16706 $(".blog-filter-container").on("click", ".blog-filter-link", function (e) { 16707 e.preventDefault(); 16708 var $this = $(this); 16709 var $next = $this.next(); 16710 $(".blog-filter-body-container") 16711 .not($next) 16712 .slideUp(); 16713 var blogFilterType = $this.attr("data-filter-type"); 16714 if ($this.hasClass("applied")) { 16715 $this.text(blogFilterType).removeClass("applied"); 16716 } else { 16717 $next.slideToggle(); 16718 } 16719 }); 16720 // open inner filter type items 16721 $(".blog-filter-body-link-with-children").on( 16722 "click", 16723 ".blog-filter-inner-link", 16724 function (e) { 16725 e.preventDefault(); 16726 var $this = $(this); 16727 var $next = $this.next(); 16728 $next.slideToggle(); 16729 $this.toggleClass("open"); 16730 16731 $(".blog-filter-inner-link") 16732 .not($this) 16733 .removeClass("open"); 16734 16735 $(".blog-filter-dropdown") 16736 .find(".blog-filter-inner-body") 16737 .not($next) 16738 .slideUp() 16739 .removeClass("open"); 16740 } 16741 ); 16742 // apply year to filter on click 16743 $(".blog-filter-year").on("click", function (e) { 16744 e.preventDefault(); 16745 var $this = $(this); 16746 var blogYear = $this.attr("data-year"); 16747 var $blogParent = $this.parents(".blog-filter").find(".blog-filter-link"); 16748 $blogParent.text(blogYear).addClass("applied"); 16749 $(".blog-filter-body-container").slideUp(); 16750 }); 16751 // apply inner filters to each type 16752 $(".blog-filter-inner-body").on( 16753 "click", 16754 ".blog-filter-inner-body-link", 16755 function (e) { 16756 e.preventDefault(); 16757 var $this = $(this); 16758 var blogYear = $this 16759 .parents(".blog-filter-inner-body") 16760 .siblings(".blog-filter-year") 16761 .attr("data-year"); 16762 var blogMonth = $this.attr("data-month"); 16763 var $blogParent = $this.parents(".blog-filter").find(".blog-filter-link"); 16764 $blogParent.text(blogMonth + " " + blogYear).addClass("applied"); 16765 $(".blog-filter-body-container").slideUp(); 16766 } 16767 ); 16768 // apply top level filters to each type 16769 $(".blog-filter-body").on("click", ".blog-filter-body-link", function (e) { 16770 e.preventDefault(); 16771 var $this = $(this); 16772 var blogFilterName = $this.attr("data-filterName"); 16773 var $blogParent = $this.parents(".blog-filter").find(".blog-filter-link"); 16774 $blogParent.text(blogFilterName).addClass("applied"); 16775 $(".blog-filter-body-container").slideUp(); 16776 }); 16777 // reset filter button 16778 $(".blog-filter-reset").on("click", function (e) { 16779 e.preventDefault(); 16780 $(".blog-filter-link").each(function () { 16781 var blogFilterType = $(this).attr("data-filter-type"); 16782 $(this) 16783 .text(blogFilterType) 16784 .removeClass("applied"); 16785 }); 16786 // close filter dropdowns 16787 $(".blog-filter-body-container").slideUp(); 16788 });
16789 // click out of filter container to close filters 16790 $("body").on("click", function (e) { 16791 if ($(e.target).parents(".blog-filter-container").length) { 16792 return; 16793 } else { 16794 $(".blog-filter-body-container").slideUp(); 16795 } 16796 }); 16797 // hide dropdown on mobile 16798 $(window).on("resize", function () { 16799 if ($(window).width() > 767) { 16800 $(".blog-filter-dropdown").show(); 16801 } else { 16802 $(".blog-filter-dropdown").hide(); 16803 } 16804 }); 16805}); 16806/* End Blog Filter JS */ 16807 16808/* Blog Detail Info Share Wrapper */ 16809if ( 16810 $(".blog-detail-info-wrapper") 16811 .children(".blog-detail-info-divider") 16812 .is(":last-child") 16813) { 16814 $(".blog-detail-info-wrapper") 16815 .children(".blog-detail-info-divider") 16816 .last() 16817 .css("display", "none"); 16818 $(".blog-detail-copy-wrapper").css("margin-top", "0"); 16819} 16820 16821/* Blog Prev/Next JS */ 16822var $blogDetailContainer = $(".blog-detail-overall-wrapper"); 16823var $blogDetailNextLinkWrapper = $(".blog-detail-next-link-wrapper"); 16824var $blogDetailPreviousLinkWrapper = $(".blog-detail-previous-link-wrapper"); 16825var $blogDetailLinks = $( 16826 ".blog-detail-previous-link-wrapper, .blog-detail-next-link-wrapper" 16827); 16828function toggleblogArrowScroll() { 16829 var blogNavHeight = $(".nav").outerHeight(); 16830 var blogDetailTop = $blogDetailContainer.offset() 16831 ? $blogDetailContainer.offset().top 16832 : 0; 16833 var blogDetailHeight = $blogDetailContainer.height(); 16834 var blogLinkTop = $blogDetailNextLinkWrapper.offset() 16835 ? $blogDetailNextLinkWrapper.offset().top 16836 : 0; 16837 var blogLinkHeight = $blogDetailNextLinkWrapper.height(); 16838 if ( 16839 blogLinkTop >= blogDetailTop && 16840 blogLinkTop <= blogDetailTop + blogDetailHeight - blogLinkHeight 16841 ) { 16842 $blogDetailLinks.css({ 16843 top: blogNavHeight + blogLinkHeight, 16844 opacity: 1, 16845 "z-index": 3 16846 }); 16847 } else { 16848 $blogDetailLinks.css({ 16849 opacity: 0, 16850 "z-index": -1 16851 }); 16852 } 16853} 16854 16855var $blogDetailNextLink = $(".blog-detail-next-link"); 16856var $blogDetailPreviousLink = $(".blog-detail-previous-link"); 16857$blogDetailPreviousLink.hover( 16858 function () { 16859 $(this) 16860 .parent() 16861 .addClass("hover-link"); 16862 }, 16863 function () { 16864 $(this) 16865 .parent() 16866 .removeClass("hover-link"); 16867 } 16868); 16869$blogDetailNextLink.hover( 16870 function () { 16871 $(this) 16872 .parent() 16873 .addClass("hover-link"); 16874 }, 16875 function () { 16876 $(this) 16877 .parent() 16878 .removeClass("hover-link"); 16879 } 16880); 16881 16882$(window).on("scroll", function () { 16883 if ($(window).width() > 1200) { 16884 toggleblogArrowScroll(); 16885 } 16886}); 16887/* End Blog Prev/Next JS */; 16888function SocaliaMediaShare(container) { 16889 this.$container = $(container); 16890 this.$shareLink = this.$container.find(".social-media-share-link"); 16891 this.$dropdown = this.$container.find(".social-media-share-dropdown"); 16892 this.$socialLinks = this.$container.find(".social-media-share-dropdown a"); 16893} 16894SocaliaMediaShare.prototype.eventListeners = function () { 16895 this.$shareLink.keydown(this.preventKeyboardScrolling.bind(this)); 16896 this.$socialLinks.keydown(this.preventKeyboardScrolling.bind(this)); 16897 this.$dropdown.focusout(this.dropdownFocusOut.bind(this)); 16898 this.$shareLink.focusout(this.shareLinkFocusOut.bind(this)); 16899 this.$shareLink.keyup(this.shareLinkKeyUp.bind(this)); 16900 this.$socialLinks.keyup(this.socialLinksKeyUp.bind(this)); 16901} 16902SocaliaMediaShare.prototype.openDropdown = function () { 16903 this.$shareLink.attr("aria-expanded", true); 16904 this.$dropdown.attr("aria-hidden", false).find("[aria-hidden]").attr("aria-hidden", false).attr("tabindex", "0"); 16905} 16906SocaliaMediaShare.prototype.closeDropdown = function () { 16907 this.$shareLink.attr("aria-expanded", false); 16908 this.$dropdown.attr("aria-hidden", true).find("[aria-hidden]").attr("aria-hidden", true).attr("tabindex", "-1"); 16909} 16910SocaliaMediaShare.prototype.toggleDropdown = function () { 16911 var expanded = this.$shareLink.attr("aria-expanded") === "true"; 16912 !expanded ? this.openDropdown() : this.closeDropdown(); 16913} 16914SocaliaMediaShare.prototype.preventKeyboardScrolling = function (e) { 16915 var preventCodes = [32, 37, 38, 39, 40]; 16916 if (preventCodes.indexOf(e.which) > -1) e.preventDefault(); 16917} 16918SocaliaMediaShare.prototype.socialLinksKeyUp = function (e) { 16919 var nextCodes = [39, 40]; 16920 var prevCodes = [37, 38]; 16921 var closingCodes = [27]; 16922 16923 if (nextCodes.indexOf(e.which) > -1) this.next(); 16924 if (prevCodes.indexOf(e.which) > -1) this.prev(); 16925 if (closingCodes.indexOf(e.which) > -1) { 16926 this.closeDropdown(); 16927 this.$shareLink.focus(); 16928 } 16929} 16930SocaliaMediaShare.prototype.prev = function () { 16931 var $prev = $(document.activeElement).prev(); 16932 $prev.length >
16932 0 ? $prev.focus() : $(document.activeElement).siblings().last().focus(); 16933} 16934SocaliaMediaShare.prototype.next = function () { 16935 var $next = $(document.activeElement).next(); 16936 $next.length > 0 ? $next.focus() : $(document.activeElement).siblings().first().focus(); 16937} 16938SocaliaMediaShare.prototype.shareLinkKeyUp = function (e) { 16939 var openingCodes = [39, 40]; 16940 var closingCodes = [27]; 16941 var toggleCodes = [13, 32]; 16942 16943 if (openingCodes.indexOf(e.which) > -1) { 16944 this.openDropdown(); 16945 this.$socialLinks.first().focus(); 16946 } 16947 if (toggleCodes.indexOf(e.which) > -1) this.toggleDropdown(); 16948 if (closingCodes.indexOf(e.which) > -1) this.closeDropdown(); 16949} 16950SocaliaMediaShare.prototype.dropdownFocusOut = function (e) { 16951 if (this.$dropdown.has(e.relatedTarget).length < 1) this.closeDropdown(); 16952} 16953SocaliaMediaShare.prototype.shareLinkFocusOut = function (e) { 16954 if (this.$container.has(e.relatedTarget).length < 1) this.closeDropdown(); 16955} 16956$(".social-media-share-wrapper").each(function (index, item) { 16957 new SocaliaMediaShare(item).eventListeners(); 16958});; 16959function changeTabs(e) { 16960 e.preventDefault(); 16961 16962 var $this = $(this), 16963 idx = $this.index(), 16964 $parent = $this.closest(".flextabs"), 16965 $triggers = $parent.find(".flextab-triggers"), 16966 $target = $parent.find(".flextab-content"), 16967 tHeight = $target.eq(idx).height(); 16968 16969 $this.addClass("set").siblings().removeClass("set"); 16970 $target.removeClass("set").eq(idx).addClass("set"); 16971 16972 $this.closest(".flextabs").stop(true).animate({ 16973 height: tHeight + $triggers.height() 16974 }); 16975} 16976 16977function updateTabs() { 16978 var $triggers = $(".flextab-triggers"); 16979 16980 $(".flextabs").each(function () { 16981 $(this).height($(".flextab-content.set").height() + $triggers.height()); 16982 }); 16983} 16984 16985$(function () { 16986 $(".flextab-triggers").on("click", "a", changeTabs); 16987 updateTabs(); 16988 $(window).on("resize", updateTabs); 16989}); 16990; 16991var $scroller = $(".scroller"); 16992var $scrollerMobile = $(".scroller-mobile"); 16993var docHeight = $(document).height(); 16994var winHeight = $(window).height(); 16995var hasScrolled = false; 16996var scrollEl = $(".scrollTo").val(); 16997var scrollSpeed = parseInt($(".scrollSpeed").val()); 16998var scrollOffset = parseInt($(".scrollTopOffset").val()); 16999 17000var upScroller = $(".upScroller").val(); 17001var downScroller = $(".downScroller").val(); 17002 17003var lastScrollTop = 0; 17004var screenTop = 0; 17005 17006function addScroller() { 17007 if (docHeight > winHeight && downScroller !== undefined) { 17008 if ($(window).width() < parseInt(downScroller) || downScroller === "all") { 17009 $scroller.addClass("show-scroller"); 17010 } 17011 } 17012} 17013 17014$scroller.on("click", function() { 17015 var scrollToElement = $("." + scrollEl); 17016 var offsetElement = scrollToElement.offset().top - scrollOffset; 17017 $("html, body").animate( 17018 { 17019 scrollTop: offsetElement 17020 }, 17021 scrollSpeed 17022 ); 17023}); 17024 17025$scrollerMobile.on("click", function() { 17026 $("html, body").animate( 17027 { 17028 scrollTop: 0 17029 }, 17030 scrollSpeed 17031 ); 17032}); 17033 17034function getScrollDirection() { 17035 // get scroll direction 17036 if ( 17037 100 < screenTop && 17038 screenTop < lastScrollTop && 17039 $(window).width() < upScroller 17040 ) { 17041 // if scrolling up 17042 $scrollerMobile.addClass("show-scroller-mobile-up"); 17043 } else { 17044 $scrollerMobile.removeClass("show-scroller-mobile-up"); 17045 } 17046 17047 lastScrollTop = screenTop; 17048} 17049 17050$(window).on("scroll", function() { 17051 screenTop = $(document).scrollTop(); 17052 if (docHeight > winHeight && screenTop > 100) { 17053 $scroller.removeClass("show-scroller"); 17054 hasScrolled = true; 17055 } else if (docHeight > winHeight && screenTop < 100 && hasScrolled !== true) { 17056 $scroller.addClass("show-scroller"); 17057 } 17058 getScrollDirection(); 17059}); 17060 17061$(window).on("load", function() { 17062 17063 addScroller(); 17064});; 17065$(function() { 17066 17067 if ($("#resourceCurrentPage").length) { 17068 BuildPager(); 17069 } 17070 17071 $(".resource-pager-prev").on("click", function(e) { 17072 ArrowClick(-1, e); 17073 }); 17074 17075 $(".resource-pager-next").on("click", function(e) { 17076 ArrowClick(1, e); 17077 });
17078}); 17079 17080function ArrowClick(add, e) { 17081 17082 $(".resource-pager-link").removeClass("select-it"); 17083 e.stopPropagation(); 17084 var page = CurrentPage() + add; 17085 17086 if (page < 1) { 17087 page = PageCount(); 17088 } 17089 17090 if (page > PageCount()) { 17091 page = 1; 17092 } 17093 17094 LoadMore(true, page - 1); 17095 $("#resourceCurrentPage").val(page); 17096 BuildPager(); 17097} 17098 17099function BuildPager() { 17100 17101 $(".resource-pager-links").html(""); 17102 17103 if (PageCount() > 12) { 17104 BuildBottomThird(); 17105 BuildMiddleThird(); 17106 BuildTopThird(); 17107 } else { 17108 BuildSmallPager(); 17109 } 17110 17111 17112 $(".resource-pager-links").on("click", ".resource-pager-link", function(e) { 17113 $(".resource-pager-link").removeClass("select-it"); 17114 e.stopPropagation(); 17115 var page = parseInt($(this).data("page")); 17116 LoadMore(true, page); 17117 $("#resourceCurrentPage").val(page + 1); 17118 BuildPager(); 17119 }); 17120} 17121 17122function BuildSmallPager() { 17123 17124 for (var i = 1; i <= PageCount(); i++) { 17125 AddPagerLink(i, i); 17126 } 17127} 17128 17129function BuildMiddleThird() { 17130 17131 var middlePage = Math.floor(PageCount() / 2); 17132 17133 if (CurrentPage() > 4 && CurrentPage() < (PageCount() - 4)) { 17134 middlePage = CurrentPage(); 17135 } 17136 17137 LeftEllipse(middlePage, CurrentPage()); 17138 17139 AddPagerLink(middlePage - 1, middlePage - 1); 17140 AddPagerLink(middlePage, middlePage); 17141 AddPagerLink(middlePage + 1, middlePage + 1); 17142 17143 RightEllipse(middlePage, CurrentPage()); 17144} 17145 17146function LeftEllipse(middlePage, currentPage) { 17147 17148 var leftElip = Math.ceil((middlePage + 3) / 2); 17149 leftElip = currentPage === 6 ? 4 : leftElip; 17150 17151 var leftElipText = currentPage === 6 ? leftElip : "..."; 17152 17153 if (leftElip <= 4 && currentPage < 6) { 17154 return; 17155 } 17156 17157 AddPagerLink(leftElip, leftElipText); 17158} 17159 17160function RightEllipse(middlePage, currentPage) { 17161 17162 var rightElip = Math.ceil((PageCount() - 2 - middlePage) / 2) + middlePage; 17163 var rightElipText = rightElip === (middlePage + 2) && (currentPage + 5 === PageCount()) ? rightElip : "..."; 17164 AddPagerLink(rightElip, rightElipText); 17165} 17166 17167function BuildBottomThird() { 17168 17169 AddPagerLink(1, 1); 17170 AddPagerLink(2, 2); 17171 17172 var third = CurrentPage() === 4 ? 4 : 3; 17173 AddPagerLink(third, third); 17174} 17175 17176function BuildTopThird() { 17177 17178 var first = CurrentPage() <= (PageCount() - 2) && CurrentPage() >= (PageCount() - 4) ? CurrentPage() : PageCount() - 2; 17179 17180 AddPagerLink(first, first); 17181 AddPagerLink(PageCount() - 1, PageCount() - 1); 17182 AddPagerLink(PageCount(), PageCount()); 17183} 17184 17185function PageCount() { 17186 17187 var pageSize = parseInt($("#resourcePageSize").val()); 17188 var totalCount = parseInt($("#resourcesAvailable").val()); 17189 17190 return Math.ceil(totalCount / pageSize); 17191} 17192 17193function AddPagerLink(page, text) { 17194 17195 var template = $(".resource-pager-link").first().clone(); 17196 17197 template.attr("data-page", page - 1); 17198 template.text(text); 17199 template.show(); 17200 17201 if (CurrentPage() === page) { 17202 template.addClass("select-it"); 17203 } 17204 17205 $(".resource-pager-links").append(template); 17206} 17207 17208function CurrentPage() { 17209 17210 return parseInt($("#resourceCurrentPage").val()); 17211}; 17212$(function() { 17213 initContentSlider(); 17214 equalizeContentImageHeights(); 17215 17216 fadeInDots(); 17217 17218 /** 17219 * Initialize the Content Slider(s) via ID 17220 * 17221 */ 17222 function initContentSlider() { 17223 $(".content-slider").each(function() { 17224 17225 var $this = $(this); 17226 var contentId = $this.attr("id"); 17227 var $parent = $this.parent(); 17228 var autoPlay = $parent.find(".contentAutoPlay").val() === "true"; 17229 var pauseOnHover = $parent.find(".contentPauseOnHover").val() === "true"; 17230 var contentFade = $parent.find(".contentFade").val() === "true"; 17231 var contentInfinite = $parent.find(".contentInfinite").val() === "true"; 17232 17233 var dotText = $parent.find(".contentDotText").val() === "true"; 17234 var dotTextMobile = $parent.find(".contentDotTextMobile").val() === "true"; 17235 17236 var slidesToShow = $parent.find(".contentSlidesToShow").val(); 17237 var slidesToScroll = $parent.find(".contentSlidesToScroll").val(); 17238 var breakPointSlideShow = (slidesToShow || "").toString().split("|"); 17239 var breakPointSlidesToScroll = (slidesToScroll || "").toString().split("|"); 17240 17241 if (breakPointSlideShow.length !== 4) { 17242 breakPointSlideShow = ["1", "1", "1", "1"]; 17243 } 17244 if (breakPointSlidesToScroll.length !== 4) { 17245 breakPointSlidesToScroll = ["1", "1", "1", "1"]; 17246 } 17247 17248 var pointSlideShow0 = parseInt(breakPointSlideShow[0]); 17249 var pointSlideShow1 = parseInt(breakPointSlideShow[1]); 17250 var pointSlideShow2 = parseInt(breakPointSlideShow[2]); 17251 var pointSlideShow3 = parseInt(breakPointSlideShow[3]); 17252 17253 var pointSlideScroll0 = parseInt(breakPointSlidesToScroll[0]); 17254 var pointSlideScroll1 = parseInt(breakPointSlidesToScroll[1]); 17255 var pointSlideScroll2 = parseInt(breakPointSlidesToScroll[2]); 17256 var pointSlideScroll3 = parseInt(breakPointSlidesToScroll[3]); 17257 17258 var breakpoints = [ 17259 { 17260 breakpoint: '(max-width: 766px) and (orientation: portrait)', 17261 settings: { 17262 slidesToShow: pointSlideShow0, 17263 slidesToScroll: pointSlideScroll0, 17264 fade: pointSlideShow0 === 1 ? contentFade : false, 17265 customPaging: dotTextMobile ? customPagingFunc : undefined 17266 } 17267 }, 17268 { 17269 breakpoint: '(max-width: 766px) and (orientation: landscape)', 17270 settings: { 17271 slidesToShow: pointSlideShow1, 17272 slidesToScroll: pointSlideScroll1, 17273 fade: pointSlideShow1 === 1 ? contentFade : false, 17274 customPaging: dotTextMobile ? customPagingFunc : undefined 17275 } 17276 }, 17277 { 17278 breakpoint: '(min-width: 767px) and (orientation: portrait)', 17279 settings: { 17280 slidesToShow: pointSlideShow2, 17281 slidesToScroll: pointSlideScroll2, 17282 fade: pointSlideShow2 === 1 ? contentFade : false, 17283 customPaging: dotText ? customPagingFunc : undefined 17284 } 17285 }, 17286 { 17287 breakpoint: '(min-width: 767px) and (orientation: landscape)', 17288 settings: { 17289 slidesToShow: pointSlideShow3, 17290 slidesToScroll: pointSlideScroll3, 17291 fade: pointSlideShow3 === 1 ? contentFade : false, 17292 customPaging: dotText ? customPagingFunc : undefined 17293 } 17294 } 17295 ]; 17296 17297 if (dotText) { 17298 17299 var textBottom = $parent 17300 .hasClass("content-slider-dot-text-bottom"); 17301 var $headingWrapper = $this.find(".content-slider-heading"); 17302 var $contentLinks = $this.find("a"); 17303 var halfWidthVariant = $parent 17304 .hasClass("content-slider-half-width-wrapper"); 17305 17306 if ($(window).width() < 768) { 17307 halfWidthVariant 17308 ? $headingWrapper.each(function() { 17309 var $parents = $(this).parents(".content-slide"); 17310 var headingText = $parents.data("dot-text"); 17311 var text = 17312 "<p class='content-slider-dot-text-mobile'>" + 17313 headingText + 17314 "</p>"; 17315 17316 textBottom ? $parents.append(text) : $parents.prepend(text); 17317 }) 17318 : $contentLinks.each(function() { 17319 var $this = $(this); 17320 var dataText = $this.attr("data-dot-text"); 17321 var text = 17322 "<p class='content-slider-dot-text-mobile'>" +
17323 dataText + 17324 "</p>"; 17325 textBottom ? $this.append(text) : $this.prepend(text); 17326 }); 17327 } 17328 } 17329 17330 var newContentSlider = new ContentSlider( 17331 "#" + contentId, 17332 autoPlay, 17333 parseInt( 17334 $parent 17335 .find(".contentSpeed") 17336 .val() 17337 ), 17338 contentInfinite, 17339 pauseOnHover, 17340 breakpoints, 17341 dotText, 17342 contentFade 17343 ); 17344 17345 newContentSlider.init(); 17346 if (dotText) { 17347 resizeDotText(this); 17348 var that = this; 17349 $(window).on( 17350 "resize", 17351 _.debounce(function() { 17352 resizeDotText(that); 17353 }, 17354 300) 17355 ); 17356 } 17357 }); 17358 } 17359 17360 function customPagingFunc(slider, i) { 17361 var text = $(slider.$slides[i]) 17362 .find(".content-slider-cta") 17363 .data("dot-text"); 17364 return "<a>" + text + "</a>"; 17365 } 17366 17367 /** 17368 * Resize the dot text area 17369 * 17370 * @param {string} slider 17371 */ 17372 function resizeDotText(slider) { 17373 var $sliderWrapper = $(slider); 17374 var sliderFullHeight = $sliderWrapper 17375 .parents(".content-slider-wrapper") 17376 .hasClass("content-slider-full-height"); 17377 var sliderHalfWidth = $sliderWrapper 17378 .parents(".content-slider-wrapper") 17379 .hasClass("content-slider-half-width-wrapper"); 17380 var dotTextHeight = $sliderWrapper.find(".slick-dots").outerHeight(); 17381 17382 if (!sliderFullHeight || sliderHalfWidth) { 17383 $sliderWrapper.find(".slick-dots").css("bottom", -dotTextHeight); 17384 $sliderWrapper.parents('.content-slider-wrapper').css("paddingBottom", dotTextHeight); 17385 } 17386 } 17387 17388 /** 17389 * Content Slider 17390 * 17391 * @param {string} name 17392 * @param {boolean} autoplay 17393 * @param {number} speed 17394 * @param {boolean} infinite 17395 * @param {boolean} pauseOnHover 17396 * @param {array} breakpoints 17397 * @param {string} dotText 17398 * @param {boolean} contentFade 17399 */ 17400 function ContentSlider( 17401 name, 17402 autoplay, 17403 speed, 17404 infinite, 17405 pauseOnHover, 17406 breakpoints, 17407 dotText, 17408 contentFade 17409 ) { 17410 this.name = $(name); 17411 this.init = function() { 17412 if (dotText) { 17413 this.name.slick({ 17414 arrows: true, // arrows turned on by default and shut off with class 17415 dots: true, // dots turned on by default and shut off with class 17416 autoplay: autoplay || false, 17417 fade: contentFade || false, 17418 speed: speed || 300, 17419 infinite: infinite, 17420 pauseOnHover: pauseOnHover || false, 17421 waitForAnimate: true, 17422 useTransform: true, 17423 cssEase: "ease-in-out", 17424 responsive: breakpoints 17425 }); 17426 } else { 17427 this.name.slick({ 17428 arrows: true, // arrows turned on by default and shut off with class 17429 dots: true, // dots turned on by default and shut off with class 17430 autoplay: autoplay || false, 17431 fade: contentFade || false, 17432 speed: speed || 300, 17433 infinite: infinite, 17434 pauseOnHover: pauseOnHover || false, 17435 waitForAnimate: true, 17436 useTransform: true, 17437 cssEase: "cubic-bezier(0.250, 0.460, 0.450, 0.940)", 17438 responsive: breakpoints 17439 }); 17440 } 17441 17442 $(name) 17443 .find(".slick-dots") 17444 .addClass("fade-in"); 17445 17446 _.delay(function() { 17447 moveDots(name); 17448 }, 17449 100); 17450 17451 $(name).on("beforeChange", 17452 function() { 17453 _.delay(function() { 17454 moveDots(name); 17455 }, 17456 100); 17457 }); 17458 17459 contentLightBox(); 17460 }; 17461 } 17462 17463 /** 17464 * Equalize Content Image Heights for half width slider 17465 * 17466 */ 17467 function equalizeContentImageHeights() { 17468 var maxHeightImg = 100000; 17469 var equalHeights = []; 17470 var $halfWidthWrapper = $(".content-slider-half-width-wrapper"); 17471 if ($(window).width() < 992) { 17472 $halfWidthWrapper.each(function() { 17473 var $images = $(this).find(".content-slider-half-image"); 17474 $images.each(function() { 17475 if ($(this).height() < maxHeightImg) { 17476 maxHeightImg = $(this).height(); 17477 } 17478 }); 17479 $images.height(maxHeightImg); 17480 }); 17481 } 17482 } 17483 17484 /** 17485 * 17486 * Move Dots for half-width variant 17487 * 17488 * @param {string} name 17489 */ 17490 function moveDots(name) { 17491 var $currentSlide = $(name).find(".slick-current"); 17492 var $slider = $currentSlide.parents(".content-slider-wrapper"); 17493 var halfWidth = $(name).find(".slick-current > .content-slider-half-image-wrapper"); 17494 if (halfWidth) { 17495 var right = halfWidth.index() === 1 17496 if (right) { 17497 $slider.addClass("image-right"); 17498 } else { 17499 $slider.addClass("image-left"); 17500 } 17501 } 17502 } 17503 17504 /** 17505 * 17506 * Content Slider Lightbox 17507 * 17508 */ 17509 function contentLightBox() { 17510 $(".content-slider-wrapper").each(function() { 17511 if ($(this).hasClass("content-slider-gallery")) { 17512 $(this).magnificPopup({ 17513 delegate: ".mfp", 17514 gallery: { 17515 enabled: true 17516 } 17517 }); 17518 } else { 17519 $(this).magnificPopup({ 17520 delegate: ".mfp" 17521 }); 17522 } 17523 }); 17524 // autoplay kaltura vids 17525 $(".kaltura-auto").on("click", 17526 function() { 17527 this.href += "[autoPlay]=true[streamerType]=auto"; 17528 }); 17529 } 17530 17531 /** 17532 * Fade In Dots for resizing 17533 * 17534 */ 17535 function fadeInDots() { 17536 _.delay(function() { 17537 loadAnimations(); 17538 }, 17539 200); 17540 } 17541 $(window).on("resize", _.debounce(fadeInDots, 500)); 17542}); 17543 17544; 17545/* Vanilla Navigation JS */ 17546 17547var slideNavExists = $(".nav-slidenav").length > 0;
17548 17549if (slideNavExists) { 17550 17551 jQuery(document).ready(function($) { 17552 //if you change this breakpoint in the style.css file (or _layout.scss if you use SASS), don't forget to update this value as well 17553 //updating this value will change the JS functionality that relies on this breakpoint 17554 var breakOn = 1024; 17555 //var breakOn = 4000; 17556 //move nav element position according to window width 17557 //still working on a solid solution for positioning (setting heights and such) when resizing from mobile to standard or vice-versa 17558 moveNavigation(); 17559 17560 // using this as the reset function 17561 var navWindowWidth1 = $(window).width(); 17562 if ($(window).width() >= 768) { 17563 $(window).on("resize", function() { 17564 if ($(window).width() != navWindowWidth1) { 17565 navWindowWidth1 = $(window).width(); 17566 var breakOn = 1024; 17567 $(".close-subnav").css("display", "none"); 17568 $(".nav-overlay").removeClass("is-visible"); 17569 $( 17570 ".main-content, .primary-nav, .nav-trigger, .nav-main-header" 17571 ).removeClass("nav-is-visible"); 17572 !window.requestAnimationFrame 17573 ? setTimeout(moveNavigation, 300) 17574 : window.requestAnimationFrame(moveNavigation); 17575 if ($(window).width() >= breakOn) { 17576 var navHeight = $(".nav-main-header").outerHeight(); 17577 $(".primary-nav .secondary-nav").css("top", navHeight + 16); 17578 setTimeout(function() { 17579 $(".secondary-nav").css("width", "310"); 17580 resetDesktop(); 17581 }, 350); 17582 } 17583 if ($(window).width() < breakOn) { 17584 var headerHeight = $(".nav-header-buttons").height() + 82; 17585 $(".nav-main-header").css("height", headerHeight); 17586 setTimeout(function() { 17587 $(".secondary-nav").css("width", "260"); 17588 resetMobile(); 17589 $('.primary-nav').css('opacity', '1'); 17590 $(".nav-trigger").click(function() { 17591 $(this).addClass("nav-is-visible"); 17592 $('.secondary-nav').removeAttr('style'); 17593 $(".primary-nav").addClass("nav-is-visible"); 17594 $(".nav-main-header").addClass("nav-is-visible"); 17595 $(".main-content") 17596 .addClass("nav-is-visible") 17597 .one( 17598 "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", 17599 function() { 17600 $("body").addClass("overflow-hidden"); 17601 } 17602 ); 17603 toggleSearch("close"); 17604 $(".nav-overlay").addClass("is-visible"); 17605 }); 17606 $(".secondary-nav li.has-children > a").click(function() { 17607 $(this).addClass("selected"); 17608 $(this) 17609 .parent("li.has-children") 17610 .parent("ul") 17611 .addClass("moves-out") 17612 .removeAttr('style'); 17613 $(this) 17614 .siblings("ul") 17615 .removeClass("is-hidden") 17616 .removeAttr('style'); 17617 }); 17618 }, 350); 17619 } 17620 } 17621 }); 17622 } 17623 17624 //issues with content jumping, so hacked it a little 17625 $("body").css("opacity", "1"); 17626 17627 //make the mobile nav the default 17628 if ($("body").hasClass("van-mobile-nav")) { 17629 breakOn = 4000;
17630 var $navigation = $(".nav"); 17631 $navigation.detach(); 17632 $navigation.insertAfter(".main-content"); 17633 } 17634 17635 if ($(window).width() >= breakOn) { 17636 var navHeight = $(".nav-main-header").outerHeight(); 17637 $(".primary-nav .secondary-nav").css("top", navHeight + 16); 17638 } 17639 17640 //mobile - set the height of the header 17641 if ($(window).width() < breakOn) { 17642 var headerHeight = $(".nav-header-buttons").height() + 82; 17643 $(".nav-main-header").css("height", headerHeight); 17644 } 17645 //mobile - open lateral menu clicking on the menu icon 17646 $(".nav-trigger").on("click", function(event) { 17647 event.preventDefault(); 17648 $('.primary-nav').removeClass('moves-out'); 17649 if ($(".main-content").hasClass("nav-is-visible")) { 17650 closeNav(); 17651 $(".nav-overlay").removeClass("is-visible"); 17652 } else { 17653 $(this).addClass("nav-is-visible"); 17654 $(".primary-nav").addClass("nav-is-visible"); 17655 $(".nav-main-header").addClass("nav-is-visible"); 17656 $(".main-content") 17657 .addClass("nav-is-visible") 17658 .one( 17659 "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", 17660 function() { 17661 $("body").addClass("overflow-hidden"); 17662 } 17663 ); 17664 toggleSearch("close"); 17665 $(".nav-overlay").addClass("is-visible"); 17666 } 17667 }); 17668 17669 var internalHeight = 0; 17670 17671 function resetInternalHeight() { 17672 var internalHeight = 0; 17673 $(".secondary-nav ul").css("height", "auto"); 17674 } 17675 17676 if ($(window).width() >= breakOn) { 17677 //subnav should always go back to height: auto when primary nav is clicked 17678 $(".primary-nav > li > a").click(function() { 17679 varInViewHeight = 0; 17680 $(".secondary-nav ul").css("height", "auto"); 17681 if ( 17682 $(this) 17683 .siblings(".secondary-nav") 17684 .find(".in-view").length 17685 ) { 17686 var inViewHeight = $(this) 17687 .siblings(".secondary-nav") 17688 .find(".in-view") 17689 .outerHeight(); 17690 $(this) 17691 .siblings(".secondary-nav") 17692 .css("height", inViewHeight + 83); 17693 $(this) 17694 .siblings(".secondary-nav") 17695 .find(".in-view") 17696 .css("height", inViewHeight); 17697 $(this) 17698 .siblings(".secondary-nav") 17699 .find(".is-hidden.moves-out, .is-hidden:not(.moves-out)") 17700 .css("height", inViewHeight + 122); 17701 } else { 17702 $( 17703 ".in-view, .secondary-nav, .is-hidden.moves-out, .is-hidden:not(.moves-out)" 17704 ).css("height", "auto"); 17705 } 17706 }); 17707 17708 if ($(".click-nav").length) { 17709 } else { 17710 $(".primary-nav > li > a").hover(function() { 17711 varInViewHeight = 0; 17712 $(".secondary-nav ul").css("height", "auto"); 17713 if ( 17714 $(this) 17715 .siblings(".secondary-nav") 17716 .find(".in-view").length 17717 ) { 17718 var inViewHeight = $(this) 17719 .siblings(".secondary-nav") 17720 .find(".in-view") 17721 .outerHeight(); 17722 $(this) 17723 .siblings(".secondary-nav") 17724 .css("height", inViewHeight + 83); 17725 $(this) 17726 .siblings(".secondary-nav")
17727 .find(".in-view") 17728 .css("height", inViewHeight); 17729 $(this) 17730 .siblings(".secondary-nav") 17731 .find(".is-hidden.moves-out, .is-hidden:not(.moves-out)") 17732 .css("height", inViewHeight + 122); 17733 } else { 17734 $( 17735 ".in-view, .secondary-nav, .is-hidden.moves-out, .is-hidden:not(.moves-out)" 17736 ).css("height", "auto"); 17737 } 17738 }); 17739 } 17740 17741 $(".secondary-nav li.has-children > a").click(function() { 17742 resetInternalHeight(); 17743 var internalHeight = $(this) 17744 .siblings("ul") 17745 .outerHeight(); 17746 $(this) 17747 .siblings("ul.is-hidden") 17748 .addClass("in-view"); 17749 $(".secondary-nav").css("height", "auto"); 17750 $(this) 17751 .siblings(".in-view") 17752 .css("height", internalHeight); 17753 $(".is-hidden.moves-out, .is-hidden:not(.moves-out)").css( 17754 "height", 17755 internalHeight 17756 ); 17757 }); 17758 17759 $(".go-back.first-level > a").click(function() { 17760 $(this) 17761 .parent("li.go-back") 17762 .parent("ul") 17763 .removeClass("in-view") 17764 .addClass("is-hidden"); 17765 $(this) 17766 .parents(".is-hidden, .secondary-nav") 17767 .css("height", "auto"); 17768 }); 17769 17770 $(".go-back:not(.first-level) > a").click(function() { 17771 var parentHeight = $(this) 17772 .closest(".moves-out:not(.is-hidden)") 17773 .outerHeight(); 17774 $(this) 17775 .parent("li.go-back") 17776 .parent("ul") 17777 .parent("li.has-children") 17778 .parent("ul") 17779 .css("height", parentHeight); 17780 $(this) 17781 .parent("li.go-back") 17782 .parent("ul") 17783 .removeClass("in-view"); 17784 $(this) 17785 .parents(".is-hidden") 17786 .css("height", parentHeight); 17787 $(this) 17788 .parents(".secondary-nav") 17789 .css("height", "auto"); 17790 }); 17791 } 17792 17793 //open search form 17794 $(".nav-search-trigger").on("click", function(event) { 17795 event.preventDefault(); 17796 toggleSearch(); 17797 closeNav(); 17798 }); 17799 17800 //close lateral menu on mobile and swipe functionality 17801 if ($(window).width < breakOn) { 17802 $(".nav-overlay").on("swiperight", function() { 17803 if ($(".primary-nav").hasClass("nav-is-visible")) { 17804 closeNav(); 17805 $(".nav-overlay").removeClass("is-visible"); 17806 } 17807 }); 17808 if (!$(".nav-overall-wrapper").hasClass("nav-left")) { 17809 $("body").on("swipeleft", function() { 17810 $(".main-content, .nav-main-header, .primary-nav").addClass( 17811 "nav-is-visible" 17812 ); 17813 $(".nav-overlay").addClass("is-visible"); 17814 }); 17815 } else { 17816 $("body").on("swiperight", function() { 17817 $(".main-content, .nav-main-header, .primary-nav").addClass( 17818 "nav-is-visible" 17819 ); 17820 $(".nav-overlay").addClass("is-visible"); 17821 }); 17822 } 17823 $(".nav-left .nav-overlay").on("swipeleft", function() { 17824 if ($(".primary-nav").hasClass("nav-is-visible")) { 17825 closeNav(); 17826 $(".nav-overlay").removeClass("is-visible"); 17827 } 17828 }); 17829 } 17830 17831 $(".nav-overlay").on("click", function() { 17832 closeNav(); 17833 toggleSearch("close"); 17834 $(".nav-overlay").removeClass("is-visible"); 17835 }); 17836 17837 var $desktopinside = $(".nav").html(); 17838 //console.log( $desktopinside ); 17839 17840 if ($(window).width() < breakOn) { 17841 $desktopinside = $(".nav").html(); 17842 $(".primary-nav > li.has-children > a") 17843 .siblings("ul.top-level-sub") 17844 .children("li.has-children")
17845 .children("ul.is-hidden") 17846 .each(function() { 17847 var $inside = $(this).html(); 17848 //console.log( $inside ); 17849 $(this) 17850 .parent("li.has-children") 17851 .replaceWith($inside); 17852 }); 17853 $(".primary-nav > li.has-children > a").click(function() { 17854 $(".primary-nav").addClass("moves-out"); 17855 $(this) 17856 .siblings("ul.top-level-sub") 17857 .children("li.has-children") 17858 .children("a") 17859 .click(function() { 17860 $(this).addClass("selected"); 17861 $(this) 17862 .parent("li.has-children") 17863 .parent("ul.top-level-sub") 17864 .addClass("moves-out"); 17865 $(this) 17866 .siblings("ul") 17867 .removeClass("is-hidden"); 17868 }); 17869 }); 17870 } 17871 if ($(window).width() > 767 && $(window).width() < 1025) { 17872 var navWindowWidth2 = $(window).width(); 17873 $(window).resize(function() { 17874 if ($(window).width() != navWindowWidth2) { 17875 navWindowWidth2 = $(window).width(); 17876 if ($(window).width() < breakOn) { 17877 $(".primary-nav > li.has-children > a") 17878 .siblings("ul.top-level-sub") 17879 .children("li.has-children") 17880 .children("ul.is-hidden") 17881 .each(function() { 17882 var $inside = $(this).html(); 17883 $(this) 17884 .parent("li.has-children") 17885 .replaceWith($inside); 17886 }); 17887 } else { 17888 $(".primary-nav").replaceWith($desktopinside); 17889 } 17890 } 17891 }); 17892 } 17893 17894 //Multiple levels deep 17895 $(".secondary-nav a").click(function() { 17896 if ( 17897 $(this) 17898 .parent("li.has-children") 17899 .parent("ul.in-view").length 17900 ) { 17901 $(this) 17902 .parents("ul") 17903 .removeClass("in-view"); 17904 } 17905 }); 17906 17907 if ($(".nav-overall-wrapper").hasClass("click-nav")) { 17908 //prevent default clicking on direct children of .primary-nav 17909 $(".primary-nav") 17910 .children(".has-children") 17911 .children("a") 17912 .on("click", function(event) { 17913 event.preventDefault(); 17914 //detect number of children 17915 if ($(window).width() >= breakOn) { 17916 var childCount = $(this) 17917 .siblings(".secondary-nav") 17918 .children(".has-children").length; 17919 if (childCount > 0) { 17920 $(".secondary-nav").addClass("single-nav"); 17921 $(".single-nav") 17922 .parent() 17923 .addClass("single-child"); 17924 $(".secondary-nav").css("width", "310"); 17925 $(".secondary-nav .has-children").css("width", "100%"); 17926 $(".secondary-nav > li").css("border", "none"); 17927 } 17928 } 17929 }); 17930 //open submenu 17931 $(".has-children") 17932 .children("a") 17933 .on("click", function(event) { 17934 if (!checkWindowWidth()) event.preventDefault(); 17935 var selected = $(this); 17936 if (selected.next("ul").hasClass("is-hidden")) { 17937 //desktop version only 17938 selected 17939 .addClass("selected") 17940 .next("ul") 17941 .removeClass("is-hidden") 17942 .end() 17943 .parent(".has-children") 17944 .parent("ul") 17945 .addClass("moves-out"); 17946 selected 17947 .parent(".has-children") 17948 .siblings(".has-children") 17949 .children("ul") 17950 .addClass("is-hidden") 17951 .end() 17952 .children("a") 17953 .removeClass("selected"); 17954 $(".nav-overlay").addClass("is-visible"); 17955 $(".close-subnav").css("display", "block"); 17956 //positions the .close-subnav "x" to display wherever the subnav is on the page...even when the window is resized.
17957 var $navHeight = $(".nav").outerHeight(); 17958 var $targeted = $("ul.top-level-sub:not(.is-hidden)"); 17959 var position = $targeted[0].getBoundingClientRect(); // Get position in viewport coordinates 17960 $(".close-subnav").css("left", position.right - 40); 17961 $(".close-subnav").css("top", $navHeight + 10); 17962 } else { 17963 selected 17964 .removeClass("selected") 17965 .next("ul") 17966 .addClass("is-hidden") 17967 .removeClass("in-front") 17968 .end() 17969 .parent(".has-children") 17970 .parent("ul") 17971 .removeClass("moves-out"); 17972 $(".nav-overlay").removeClass("is-visible"); 17973 $(".close-subnav").css("display", "none"); 17974 } 17975 toggleSearch("close"); 17976 }); 17977 } else { 17978 //open submenu 17979 $(".has-children") 17980 .children("a") 17981 .on("click", function(event) { 17982 if (!checkWindowWidth()) event.preventDefault(); 17983 var selected = $(this); 17984 if (selected.next("ul").hasClass("is-hidden")) { 17985 //desktop version only 17986 selected 17987 .addClass("selected") 17988 .next("ul") 17989 .removeClass("is-hidden") 17990 .end() 17991 .parent(".has-children") 17992 .parent("ul") 17993 .addClass("moves-out"); 17994 selected 17995 .parent(".has-children") 17996 .siblings(".has-children") 17997 .children("ul") 17998 .addClass("is-hidden") 17999 .end() 18000 .children("a") 18001 .removeClass("selected"); 18002 $(".nav-overlay").addClass("is-visible"); 18003 $(".close-subnav").css("display", "block"); 18004 } 18005 toggleSearch("close"); 18006 }); 18007 18008 //Hover Functionality - the hover and click functionalities are separate so one can be blocked out to make the other one the default 18009 //this is the hover version of the click event to open the submenu 18010 $(".primary-nav") 18011 .children("li") 18012 .children("a") 18013 .hover(function() { 18014 //detect number of children 18015 $('a').removeClass('selected'); 18016 $(this).addClass('selected'); 18017 if ($(window).width() >= breakOn) { 18018 var childCount = $(this) 18019 .siblings(".secondary-nav") 18020 .children(".has-children").length; 18021 if (childCount > 0) { 18022 $(".secondary-nav").addClass("single-nav"); 18023 $(".single-nav") 18024 .parent() 18025 .addClass("single-child"); 18026 $(".secondary-nav").css("width", "310"); 18027 $(".secondary-nav .has-children").css("width", "100%"); 18028 $(".secondary-nav > li").css("border", "none"); 18029 } 18030 } 18031 18032 $(this).addClass("selected"); 18033 $(".secondary-nav, .nav-gallery, .nav-icons").addClass("is-hidden"); 18034 $(this) 18035 .siblings(".secondary-nav, .nav-gallery, .nav-icons") 18036 .removeClass("is-hidden"); 18037 $(".nav-overlay").addClass("is-visible"); 18038 $(".close-subnav").css("display", "none"); 18039 }); 18040 18041 var count = 0; 18042 var delay; 18043 $(".primary-nav, .secondary-nav, .nav-gallery, .nav-icons") 18044 .mouseenter(function() { 18045 count++;
18046 delay = setTimeout(function() { 18047 $(".primary-nav").addClass("moves-out"); 18048 $(this).removeClass("is-hidden"); 18049 $(".nav-overlay").addClass("is-visible"); 18050 $(".primary-nav").removeClass("moves-out"); 18051 $(".close-subnav").css("display", "none"); 18052 }, 400); 18053 }) 18054 .mouseleave(function() { 18055 clearTimeout(delay); 18056 count--; 18057 setTimeout(function() { 18058 if (!count) { 18059 $('a').removeClass('selected'); 18060 $(".secondary-nav, .nav-gallery, .nav-icons").addClass("is-hidden"); 18061 $(".nav-overlay").removeClass("is-visible"); 18062 $(".primary-nav").addClass("moves-out"); 18063 $(".close-subnav").css("display", "none"); 18064 } 18065 }, 500); 18066 }); 18067 } 18068 18069 //Add margin to .main-content when nav is fixed overall or just on mobile 18070 if ($(".nav-overall-wrapper").is(".is-fixed")) { 18071 var divBeforeHeights = []; 18072 var totalHeights = 0; 18073 $('.is-fixed').prevAll('div:not(.filter-overlay)').each(function() { 18074 divBeforeHeights.push($(this).outerHeight()); 18075 }); 18076 for (var i = 0; i < divBeforeHeights.length; i++) { 18077 totalHeights += divBeforeHeights[i] << 0; 18078 } 18079 $('.nav-main-header').css('top', totalHeights); 18080 var $headerHeight = $(".nav-main-header").height(); 18081 $(".main-content").css("margin-top", $headerHeight); 18082 } else { 18083 if ($(window).width() < breakOn) { 18084 if ($(".nav-overall-wrapper").is(".is-fixed-mobile")) { 18085 var $mobileHeaderHeight = $(".nav-main-header").height(); 18086 $(".main-content").css("margin-top", $mobileHeaderHeight); 18087 } 18088 } 18089 } 18090 18091 //submenu items - go back link 18092 $(".go-back").on("click", function() { 18093 $(this) 18094 .parent("ul") 18095 .addClass("is-hidden") 18096 .parent(".has-children") 18097 .parent("ul") 18098 .removeClass("moves-out") 18099 .addClass('in-view'); 18100 }); 18101 18102 $(".close-subnav").click(function() { 18103 $(".secondary-nav, .nav-gallery, .nav-icons").addClass("is-hidden"); 18104 $(".secondary-nav, .nav-gallery, .nav-icons") 18105 .parent(".has-children") 18106 .children("a") 18107 .removeClass("selected"); 18108 $(".nav-overlay").removeClass("is-visible"); 18109 $(".close-subnav").css("display", "none"); 18110 $("primary-nav").removeClass("moves-out"); 18111 }); 18112 //end functionality for the close icon 18113 18114 //insert the address at the bottom of the ul for every subnav on mobile 18115 if ($(window).width() < breakOn) { 18116 var $this = $(".nav-address-mobile"); 18117 //$($this).css("display", "block"); 18118 if ($this[0]) { 18119 var $mobileAddressBlock = $(".nav-address-mobile")[0].outerHTML; 18120 $(".top-level-sub, .top-level-sub ul").append($mobileAddressBlock); 18121 } else { 18122 //$(".nav-address-mobile").css("display", "none"); 18123 } 18124 18125 var navWindowWidth = $(window).width(); 18126 $(window).resize(function() { 18127 if ($(window).width() != navWindowWidth) { 18128 navWindowWidth = $(window).width(); 18129 if ($(window).width() < breakOn) { 18130 var $this = $(".nav-address-mobile"); 18131 //$($this).css("display", "block"); 18132 if ($this[0]) { 18133 var $mobileAddressBlock = $(".nav-address-mobile")[0].outerHTML; 18134 $(".top-level-sub, .top-level-sub ul").append($mobileAddressBlock); 18135 } 18136 } else { 18137 //$(".nav-address-mobile").css("display", "none"); 18138 } 18139 } 18140 }); 18141 } 18142 18143 if ($(".nav-overall-wrapper").hasClass("nav-address-centered")) { 18144 $(".nav-address-mobile").css("text-align", "center"); 18145 } 18146 18147 function closeNav() { 18148 $(".nav-trigger").removeClass("nav-is-visible"); 18149 $(".nav-main-header").removeClass("nav-is-visible"); 18150 $(".primary-nav").removeClass("nav-is-visible"); 18151 $(".has-children ul").addClass("is-hidden"); 18152 $(".has-children a").removeClass("selected"); 18153 $(".moves-out").removeClass("moves-out"); 18154 $(".close-subnav").css("display", "none"); 18155 $(".main-content") 18156 .removeClass("nav-is-visible") 18157 .one( 18158 "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", 18159 function() { 18160 $("body").removeClass("overflow-hidden"); 18161 } 18162 ); 18163 } 18164 18165 function toggleSearch(type) { 18166 if (type == "close") { 18167 //close search 18168 $(".nav-search").removeClass("is-visible"); 18169 $(".nav-search-trigger").removeClass("search-is-visible"); 18170 $(".nav-overlay").removeClass("search-is-visible"); 18171 } else { 18172 //toggle search visibility 18173 $(".nav-search").toggleClass("is-visible"); 18174 $(".nav-search-trigger").toggleClass("search-is-visible"); 18175 $(".nav-overlay").toggleClass("search-is-visible"); 18176 if ( 18177 $(window).width() > breakOn && 18178 $(".nav-search").hasClass("is-visible") 18179 ) 18180 $(".nav-search") 18181 .find('input[type="search"]') 18182 .focus(); 18183 $(".nav-search").hasClass("is-visible") 18184 ? $(".nav-overlay").addClass("is-visible") 18185 : $(".nav-overlay").removeClass("is-visible"); 18186 } 18187 } 18188 18189 function checkWindowWidth() { 18190 //check window width (scrollbar included) 18191 var e = window, 18192 a = "inner"; 18193 if (!("innerWidth" in window)) { 18194 a = "client"; 18195 e = document.documentElement || document.body; 18196 } 18197 if (e[a + "Width"] >= breakOn) { 18198 return true; 18199 } else { 18200 return false; 18201 } 18202 } 18203 18204 function moveNavigation() { 18205 var navigation = $(".nav"); 18206 var desktop = checkWindowWidth(); 18207 if (desktop) { 18208 navigation.insertBefore(".nav-header-buttons"); 18209 //$(".nav-address-mobile").css("display", "none"); 18210 $(".primary-nav").removeClass("moves-out"); 18211 } else { 18212 navigation.insertAfter(".main-content"); 18213 //$(".nav-address-mobile").css("display", "block"); 18214 $(".primary-nav").removeClass("moves-out"); 18215 $('.secondary-nav').removeClass('single-nav').removeAttr('style'); 18216 $('.has-children').removeClass('single-child'); 18217 $('ul').removeClass('in-view'); 18218 } 18219 } 18220 });
18221 18222 var resetDesktop = function () { 18223 var breakOn = 1024; 18224 $(".primary-nav > li > a").click(function() { 18225 varInViewHeight = 0; 18226 $(".secondary-nav ul").css("height", "auto"); 18227 if ( 18228 $(this) 18229 .siblings(".secondary-nav") 18230 .find(".in-view").length 18231 ) { 18232 var inViewHeight = $(this) 18233 .siblings(".secondary-nav") 18234 .find(".in-view") 18235 .outerHeight(); 18236 $(this) 18237 .siblings(".secondary-nav") 18238 .css("height", inViewHeight + 83); 18239 $(this) 18240 .siblings(".secondary-nav") 18241 .find(".in-view") 18242 .css("height", inViewHeight); 18243 $(this) 18244 .siblings(".secondary-nav") 18245 .find(".is-hidden.moves-out, .is-hidden:not(.moves-out)") 18246 .css("height", inViewHeight + 122); 18247 } else { 18248 $( 18249 ".in-view, .secondary-nav, .is-hidden.moves-out, .is-hidden:not(.moves-out)" 18250 ).css("height", "auto"); 18251 } 18252 }); 18253 var navHeight = $(".nav-main-header").outerHeight(); 18254 $(".primary-nav .secondary-nav").css("top", navHeight + 16); 18255 18256 if ($(".click-nav").length) { 18257 } else { 18258 $(".primary-nav > li > a").hover(function() { 18259 varInViewHeight = 0; 18260 $(".secondary-nav ul").css("height", "auto"); 18261 if ( 18262 $(this) 18263 .siblings(".secondary-nav") 18264 .find(".in-view").length 18265 ) { 18266 var inViewHeight = $(this) 18267 .siblings(".secondary-nav") 18268 .find(".in-view") 18269 .outerHeight(); 18270 $(this) 18271 .siblings(".secondary-nav") 18272 .css("height", inViewHeight + 83); 18273 $(this) 18274 .siblings(".secondary-nav") 18275 .find(".in-view") 18276 .css("height", inViewHeight); 18277 $(this) 18278 .siblings(".secondary-nav") 18279 .find(".is-hidden.moves-out, .is-hidden:not(.moves-out)") 18280 .css("height", inViewHeight + 122); 18281 } else { 18282 $( 18283 ".in-view, .secondary-nav, .is-hidden.moves-out, .is-hidden:not(.moves-out)" 18284 ).css("height", "auto"); 18285 } 18286 }); 18287 } 18288 18289 $(".secondary-nav li.has-children > a").click(function() { 18290 resetInternalHeight(); 18291 var internalHeight = $(this) 18292 .siblings("ul") 18293 .outerHeight(); 18294 $(this) 18295 .siblings("ul.is-hidden") 18296 .addClass("in-view"); 18297 $(".secondary-nav").css("height", "auto"); 18298 $(this) 18299 .siblings(".in-view") 18300 .css("height", internalHeight); 18301 $(".is-hidden.moves-out, .is-hidden:not(.moves-out)").css( 18302 "height", 18303 internalHeight 18304 ); 18305 }); 18306 18307 $(".go-back.first-level > a").click(function() { 18308 $(this) 18309 .parent("li.go-back") 18310 .parent("ul") 18311 .removeClass("in-view") 18312 .addClass("is-hidden"); 18313 $(this) 18314 .parents(".is-hidden, .secondary-nav") 18315 .css("height", "auto"); 18316 }); 18317 18318 $(".go-back:not(.first-level) > a").click(function() { 18319 var parentHeight = $(this) 18320 .closest(".moves-out:not(.is-hidden)") 18321 .outerHeight(); 18322 $(this) 18323 .parent("li.go-back") 18324 .parent("ul") 18325 .parent("li.has-children") 18326 .parent("ul") 18327 .css("height", parentHeight); 18328 $(this) 18329 .parent("li.go-back") 18330 .parent("ul") 18331 .removeClass("in-view"); 18332 $(this)
18333 .parents(".is-hidden") 18334 .css("height", parentHeight); 18335 $(this) 18336 .parents(".secondary-nav") 18337 .css("height", "auto"); 18338 }); 18339 18340 //prevent default clicking on direct children of .primary-nav 18341 $(".primary-nav") 18342 .children(".has-children") 18343 .children("a") 18344 .on("click", function(event) { 18345 event.preventDefault(); 18346 //detect number of children 18347 if ($(window).width() >= breakOn) { 18348 var childCount = $(this) 18349 .siblings(".secondary-nav") 18350 .children(".has-children").length; 18351 if (childCount > 0) { 18352 $(".secondary-nav").addClass("single-nav"); 18353 $(".single-nav") 18354 .parent() 18355 .addClass("single-child"); 18356 $(".secondary-nav").css("width", "310"); 18357 $(".secondary-nav .has-children").css("width", "100%"); 18358 $(".secondary-nav > li").css("border", "none"); 18359 } 18360 } 18361 }); 18362 //open submenu 18363 $(".has-children") 18364 .children("a") 18365 .on("click", function(event) { 18366 if (!checkWindowWidth()) event.preventDefault(); 18367 var selected = $(this); 18368 if (selected.next("ul").hasClass("is-hidden")) { 18369 //desktop version only 18370 selected 18371 .addClass("selected") 18372 .next("ul") 18373 .removeClass("is-hidden") 18374 .end() 18375 .parent(".has-children") 18376 .parent("ul") 18377 .addClass("moves-out"); 18378 selected 18379 .parent(".has-children") 18380 .siblings(".has-children") 18381 .children("ul") 18382 .addClass("is-hidden") 18383 .end() 18384 .children("a") 18385 .removeClass("selected"); 18386 $(".nav-overlay").addClass("is-visible"); 18387 $(".close-subnav").css("display", "block"); 18388 //positions the .close-subnav "x" to display wherever the subnav is on the page...even when the window is resized. 18389 var $navHeight = $(".nav").outerHeight(); 18390 var $targeted = $("ul.top-level-sub:not(.is-hidden)"); 18391 var position = $targeted[0].getBoundingClientRect(); // Get position in viewport coordinates 18392 $(".close-subnav").css("left", position.right - 40); 18393 $(".close-subnav").css("top", $navHeight + 10); 18394 } else { 18395 selected 18396 .removeClass("selected") 18397 .next("ul") 18398 .addClass("is-hidden") 18399 .removeClass("in-front") 18400 .end() 18401 .parent(".has-children") 18402 .parent("ul") 18403 .removeClass("moves-out"); 18404 $(".nav-overlay").removeClass("is-visible"); 18405 $(".close-subnav").css("display", "none"); 18406 } 18407 toggleSearch("close"); 18408 }); 18409 18410 $(".go-back").on("click", function() { 18411 $(this) 18412 .parent("ul") 18413 .addClass("is-hidden") 18414 .parent(".has-children") 18415 .parent("ul") 18416 .removeClass("moves-out"); 18417 }); 18418 18419 $(".close-subnav").click(function() { 18420 $(".secondary-nav, .nav-gallery, .nav-icons").addClass("is-hidden"); 18421 $(".secondary-nav, .nav-gallery, .nav-icons") 18422 .parent(".has-children") 18423 .children("a") 18424 .removeClass("selected"); 18425 $(".nav-overlay").removeClass("is-visible"); 18426 $(".close-subnav").css("display", "none"); 18427 $("primary-nav").removeClass("moves-out"); 18428 }); 18429 18430 function closeNav() { 18431 $(".nav-trigger").removeClass("nav-is-visible"); 18432 $(".nav-main-header").removeClass("nav-is-visible"); 18433 $(".primary-nav").removeClass("nav-is-visible"); 18434 $(".has-children ul").addClass("is-hidden"); 18435 $(".has-children a").removeClass("selected"); 18436 $(".moves-out").removeClass("moves-out"); 18437 $(".close-subnav").css("display", "none"); 18438 $(".main-content") 18439 .removeClass("nav-is-visible") 18440 .one( 18441 "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", 18442 function() { 18443 $("body").removeClass("overflow-hidden"); 18444 } 18445 ); 18446 } 18447 18448 function toggleSearch(type) { 18449 if (type == "close") { 18450 //close search 18451 $(".nav-search").removeClass("is-visible"); 18452 $(".nav-search-trigger").removeClass("search-is-visible"); 18453 $(".nav-overlay").removeClass("search-is-visible"); 18454 } else { 18455 //toggle search visibility 18456 $(".nav-search").toggleClass("is-visible"); 18457 $(".nav-search-trigger").toggleClass("search-is-visible"); 18458 $(".nav-overlay").toggleClass("search-is-visible"); 18459 if ( 18460 $(window).width() > breakOn && 18461 $(".nav-search").hasClass("is-visible") 18462 ) 18463 $(".nav-search") 18464 .find('input[type="search"]') 18465 .focus(); 18466 $(".nav-search").hasClass("is-visible") 18467 ? $(".nav-overlay").addClass("is-visible") 18468 : $(".nav-overlay").removeClass("is-visible"); 18469 } 18470 } 18471 18472 function checkWindowWidth() { 18473 //check window width (scrollbar included) 18474 var e = window, 18475 a = "inner"; 18476 if (!("innerWidth" in window)) { 18477 a = "client"; 18478 e = document.documentElement || document.body; 18479 } 18480 if (e[a + "Width"] >= breakOn) { 18481 return true; 18482 } else { 18483 return false; 18484 } 18485 } 18486 18487 function moveNavigation() { 18488 var navigation = $(".nav"); 18489 var desktop = checkWindowWidth(); 18490 if (desktop) { 18491 navigation.insertBefore(".nav-header-buttons"); 18492 $(".nav-address-mobile").css("display", "none"); 18493 $(".primary-nav").removeClass("moves-out"); 18494 } else { 18495 navigation.insertAfter(".main-content"); 18496 //$(".nav-address-mobile").css("display", "block"); 18497 $(".primary-nav").removeClass("moves-out"); 18498 } 18499 } 18500 18501 var internalHeight = 0; 18502 18503 function resetInternalHeight() { 18504 internalHeight = 0; 18505 $(".secondary-nav ul").css("height", "auto"); 18506 } 18507 }; 18508 18509 var resetMobile = function () { 18510 var breakOn = 1024; 18511 $(".nav-trigger").on("click", function(event) { 18512 event.preventDefault(); 18513 if ($(".main-content").hasClass("nav-is-visible")) { 18514 closeNav(); 18515 $(".nav-overlay").removeClass("is-visible"); 18516 } else { 18517 $(this).addClass("nav-is-visible"); 18518 $(".primary-nav").addClass("nav-is-visible"); 18519 $(".nav-main-header").addClass("nav-is-visible"); 18520 $(".main-content") 18521 .addClass("nav-is-visible") 18522 .one( 18523 "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", 18524 function() { 18525 $("body").addClass("overflow-hidden"); 18526 } 18527 ); 18528 toggleSearch("close"); 18529 $(".nav-overlay").addClass("is-visible"); 18530 } 18531 }); 18532 18533 $(".nav-overlay").on("swiperight", function() { 18534 if ($(".primary-nav").hasClass("nav-is-visible")) { 18535 closeNav(); 18536 $(".nav-overlay").removeClass("is-visible"); 18537 } 18538 }); 18539 if (!$(".nav-overall-wrapper").hasClass("nav-left")) { 18540 $("body").on("swipeleft", function() { 18541 $(".main-content, .nav-main-header, .primary-nav").addClass( 18542 "nav-is-visible" 18543 ); 18544 $(".nav-overlay").addClass("is-visible"); 18545 }); 18546 } else { 18547 $("body").on("swiperight", function() { 18548 $(".main-content, .nav-main-header, .primary-nav").addClass( 18549 "nav-is-visible" 18550 ); 18551 $(".nav-overlay").addClass("is-visible"); 18552 }); 18553 } 18554 $(".nav-left .nav-overlay").on("swipeleft", function() { 18555 if ($(".primary-nav").hasClass("nav-is-visible")) { 18556 closeNav(); 18557 $(".nav-overlay").removeClass("is-visible"); 18558 } 18559 }); 18560 $(".go-back").on("click", function() { 18561 $(this) 18562 .parent("ul") 18563 .addClass("is-hidden") 18564 .parent(".has-children") 18565 .parent("ul") 18566 .removeClass("moves-out"); 18567 }); 18568 18569 $(".close-subnav").click(function() { 18570 $(".secondary-nav, .nav-gallery, .nav-icons").addClass("is-hidden"); 18571 $(".secondary-nav, .nav-gallery, .nav-icons") 18572 .parent(".has-children") 18573 .children("a") 18574 .removeClass("selected"); 18575 $(".nav-overlay").removeClass("is-visible"); 18576 $(".close-subnav").css("display", "none"); 18577 $("primary-nav").removeClass("moves-out"); 18578 }); 18579 18580 function closeNav() { 18581 $(".nav-trigger").removeClass("nav-is-visible"); 18582 $(".nav-main-header").removeClass("nav-is-visible"); 18583 $(".primary-nav").removeClass("nav-is-visible"); 18584 $(".has-children ul").addClass("is-hidden"); 18585 $(".has-children a").removeClass("selected"); 18586 $(".moves-out").removeClass("moves-out"); 18587 $(".close-subnav").css("display", "none"); 18588 $(".main-content") 18589 .removeClass("nav-is-visible") 18590 .one( 18591 "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", 18592 function() { 18593 $("body").removeClass("overflow-hidden"); 18594 } 18595 ); 18596 } 18597 18598 function toggleSearch(type) { 18599 if (type == "close") { 18600 //close search 18601 $(".nav-search").removeClass("is-visible"); 18602 $(".nav-search-trigger").removeClass("search-is-visible"); 18603 $(".nav-overlay").removeClass("search-is-visible"); 18604 } else { 18605 //toggle search visibility 18606 $(".nav-search").toggleClass("is-visible"); 18607 $(".nav-search-trigger").toggleClass("search-is-visible"); 18608 $(".nav-overlay").toggleClass("search-is-visible"); 18609 if ( 18610 $(window).width() > breakOn && 18611 $(".nav-search").hasClass("is-visible") 18612 ) 18613 $(".nav-search") 18614 .find('input[type="search"]') 18615 .focus(); 18616 $(".nav-search").hasClass("is-visible") 18617 ? $(".nav-overlay").addClass("is-visible") 18618 : $(".nav-overlay").removeClass("is-visible"); 18619 } 18620 } 18621 18622 function checkWindowWidth() { 18623 //check window width (scrollbar included) 18624 var e = window, 18625 a = "inner"; 18626 if (!("innerWidth" in window)) { 18627 a = "client"; 18628 e = document.documentElement || document.body; 18629 } 18630 if (e[a + "Width"] >= breakOn) { 18631 return true; 18632 } else { 18633 return false; 18634 } 18635 } 18636 18637 function moveNavigation() {
18638 var $navigation = $(".nav"); 18639 var desktop = checkWindowWidth(); 18640 if (desktop) { 18641 $navigation.insertBefore(".nav-header-buttons"); 18642 $(".nav-address-mobile").css("display", "none"); 18643 $(".primary-nav").removeClass("moves-out"); 18644 } else { 18645 $navigation.insertAfter(".main-content"); 18646 //$(".nav-address-mobile").css("display", "block"); 18647 $(".primary-nav").removeClass("moves-out"); 18648 } 18649 } 18650 }; 18651 18652}; 18653var dropNavExists = $(".nav-navigation-drop").length > 0; 18654var $subitem = $( 18655 ".sub-a, .parent-nav-item a, .nav-overall-wrapper:not(.van-mobile-nav) .nav .primary-nav .nav-subnav li:not(.nav-top-link) a" 18656); 18657$subitem.click(function (e) { 18658 18659 e.stopPropagation(); 18660}); 18661 18662 18663// ---------------------------------------------------------- 18664// If you're not in IE (or IE version is less than 5) then: 18665// ie === undefined 18666// If you're in IE (>=5) then you can determine which version: 18667// ie === 7; // IE7 18668// Thus, to detect IE: 18669// if (ie) {} 18670// And to detect the version: 18671// ie === 6 // IE6 18672// ie > 7 // IE8, IE9, IE10 ... 18673// ie < 9 // Anything less than IE9 18674// ---------------------------------------------------------- 18675var ie = (function () { 18676 var undef, rv = -1; // Return value assumes failure. 18677 var ua = window.navigator.userAgent; 18678 var msie = ua.indexOf('MSIE '); 18679 var trident = ua.indexOf('Trident/'); 18680 18681 if (msie > 0) { 18682 // IE 10 or older => return version number 18683 rv = parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); 18684 } else if (trident > 0) { 18685 // IE 11 (or newer) => return version number 18686 var rvNum = ua.indexOf('rv:'); 18687 rv = parseInt(ua.substring(rvNum + 3, ua.indexOf('.', rvNum)), 10); 18688 } 18689 18690 return ((rv > -1) ? rv : undef); 18691}()); 18692 18693// Fixes 377878 - mouse cursor remains fixed 18694if (ie !== undefined) { 18695 $('.nav-subnav').mouseleave(function () { 18696 $('.investor-access-wrapper').find('input').blur(); 18697 }); 18698} 18699 18700 18701if (dropNavExists) { 18702 /* Vanilla Nav */ 18703 $(function() { 18704 "use strict"; 18705 var $targets = $(".nav-overlay, .slide-in"); 18706 var $navInternalWrapper = $(".nav-internal-wrapper"); 18707 18708 var navOpened = function() { 18709 $targets.removeClass("nav-closed").addClass("nav-opened"); 18710 $(".primary-nav").attr("aria-hidden", false); 18711 }; 18712 18713 var navClosed = function() { 18714 $targets.removeClass("nav-opened").addClass("nav-closed"); 18715 $(".primary-nav").attr("aria-hidden", true); 18716 }; 18717 18718 $("#trigger").click(function(e) { 18719 e.preventDefault(); 18720 if ($navInternalWrapper.hasClass("nav-opened")) { 18721 $(navClosed); 18722 } else { 18723 $(navOpened); 18724 } 18725 }); 18726 18727 $navInternalWrapper.click(function() { 18728 if ($navInternalWrapper.hasClass("nav-opened")) { 18729 $(navClosed); 18730 } 18731 }); 18732 18733 $("#trigger, .nav-overlay").click(function() { 18734 $(".nav-overall-wrapper").toggleClass("out-from-left"); 18735 }); 18736 18737 $(".primary-nav li") 18738 .has(".nav-subnav, .nav-subnav-second, .nav-subnav-third") 18739 .prepend( 18740 '<span class="has-children-arrow-wrapper"><i class="has-children-arrow fa fa-angle-down"></i></span>' 18741 ); 18742 18743 var vanMobileNav = $(".van-mobile-nav"); 18744 // for hover nav only when arrows are used 18745 if ($(window).width() > 844 && vanMobileNav.length === 0) { 18746 $( 18747 ".nav-with-arrows:not(.click-nav) .primary-link.has-children, .nav-with-arrows:not(.click-nav) .has-children-second" 18748 ).hover(function() { 18749 $(this) 18750 .children(".has-children-arrow-wrapper") 18751 .children(".has-children-arrow") 18752 .toggleClass("rotate"); 18753 }); 18754 18755 $(".nav-with-arrows:not(.click-nav) .has-children-third").hover( 18756 function() { 18757 $(this) 18758 .find(".has-children-arrow") 18759 .toggleClass("rotate"); 18760 } 18761 ); 18762 } 18763 18764 // for hover nav only when only sub arrows are used 18765 $(".nav-with-sub-arrows:not(.click-nav) .has-children").hover(function() { 18766 $(this) 18767 .find(".has-children-arrow") 18768 .toggleClass("rotate"); 18769 });
18770 18771 var navOverallWrapper = $(".nav-overall-wrapper"); 18772 var clickNav = navOverallWrapper.hasClass("click-nav"); 18773 var primaryLink = $(".primary-link"); 18774 if (clickNav) { 18775 $(".sub-a, .investor-access-links-wrapper a").click(function (e) { 18776 18777 e.stopPropagation(); 18778 }); 18779 } 18780 if (vanMobileNav.length) { 18781 navOverallWrapper.addClass("click-nav"); 18782 primaryLink.click(function(e) { 18783 var hasChildren = $(this).hasClass("has-children"); 18784 if (hasChildren) { 18785 e.preventDefault(); 18786 $(this) 18787 .children(".nav-subnav") 18788 .slideToggle("400"); 18789 $(this) 18790 .children(".nav-subnav") 18791 .toggleClass("clicked"); 18792 $(this) 18793 .children(".has-children-arrow-wrapper") 18794 .children("i") 18795 .toggleClass("rotate"); 18796 $(this) 18797 .siblings("li") 18798 .children("a") 18799 .removeClass("selected"); 18800 $(this) 18801 .siblings(".has-children") 18802 .children(".has-children-arrow-wrapper") 18803 .children("i") 18804 .removeClass("rotate"); 18805 $(this) 18806 .siblings(".has-children") 18807 .children(".nav-subnav") 18808 .removeClass("clicked") 18809 .slideUp("400"); 18810 $(this) 18811 .siblings(".has-children") 18812 .children(".nav-subnav") 18813 .children(".has-children") 18814 .children(".nav-subnav-second") 18815 .removeClass("clicked") 18816 .slideUp("400"); 18817 $(this) 18818 .siblings(".has-children") 18819 .children(".nav-subnav") 18820 .children(".has-children") 18821 .children(".nav-subnav-second") 18822 .children(".has-children") 18823 .children(".nav-subnav-third") 18824 .removeClass("clicked") 18825 .slideUp("400"); 18826 $(this) 18827 .siblings(".has-children") 18828 .children(".nav-subnav") 18829 .children(".has-children") 18830 .children(".has-children-arrow-wrapper") 18831 .children("i") 18832 .removeClass("rotate"); 18833 $(this) 18834 .siblings(".has-children") 18835 .children(".nav-subnav") 18836 .children(".has-children") 18837 .children(".nav-subnav-second") 18838 .children(".has-children") 18839 .children(".has-children-arrow-wrapper") 18840 .children("i") 18841 .removeClass("rotate"); 18842 if ($(this).find(".nav-subnav-second.clicked").length) { 18843 $(".nav-subnav-second, .nav-subnav-third").slideUp("400"); 18844 $(".nav-subnav-second, .nav-subnav-third").removeClass("clicked"); 18845 $(".has-children-arrow-wrapper") 18846 .children(".has-children-arrow") 18847 .removeClass("rotate"); 18848 } 18849 } 18850 }); 18851 18852 $(".has-children:not(.primary-link) > a:not(.sub-a)").click(function (e) { 18853 18854 e.stopPropagation(); 18855 }); 18856 18857 $(".has-children.has-children-second > a:not(.sub-a)").click(function( 18858 event 18859 ) { 18860 18861 event.preventDefault(); 18862 $(this) 18863 .parent(".has-children-second") 18864 .siblings(".has-children-second") 18865 .children(".nav-subnav-second") 18866 .slideUp("400"); 18867 setTimeout(function() { 18868 $(this) 18869 .parent(".has-children-second") 18870 .siblings(".has-children-second") 18871 .children(".nav-subnav-second") 18872 .removeClass("clicked"); 18873 }, 400); 18874 $(this) 18875 .parent(".has-children-second") 18876 .siblings(".has-children-second") 18877 .children(".has-children-arrow-wrapper") 18878 .children("i") 18879 .removeClass("rotate"); 18880 $(this) 18881 .siblings(".nav-subnav-second") 18882 .toggleClass("clicked"); 18883 $(this) 18884 .siblings(".nav-subnav-second") 18885 .slideToggle("400"); 18886 $(this) 18887 .siblings(".has-children-arrow-wrapper") 18888 .children("i") 18889 .toggleClass("rotate"); 18890 }); 18891 18892 $(".has-children.has-children-third > a:not(.sub-a)").click(function( 18893 event 18894 ) { 18895 18896 event.preventDefault(); 18897 $(this) 18898 .parent(".has-children-third") 18899 .siblings(".has-children-third") 18900 .children(".nav-subnav-third") 18901 .slideUp("400"); 18902 setTimeout(function() { 18903 $(this) 18904 .parent(".has-children-third") 18905 .siblings(".has-children-third") 18906 .children(".nav-subnav-third") 18907 .removeClass("clicked"); 18908 }, 400); 18909 $(this) 18910 .parent(".has-children-third") 18911 .siblings(".has-children-third") 18912 .children(".has-children-arrow-wrapper") 18913 .children("i") 18914 .removeClass("rotate"); 18915 $(this) 18916 .siblings(".nav-subnav-third") 18917 .toggleClass("clicked"); 18918 $(this) 18919 .siblings(".nav-subnav-third") 18920 .slideToggle("400"); 18921 $(this) 18922 .siblings(".has-children-arrow-wrapper") 18923 .children("i") 18924 .toggleClass("rotate"); 18925 }); 18926 } else { 18927 if ($(window).width() <= 844) { 18928 $(".investor-access-remember-me").click(function (e) { 18929 e.stopPropagation(); 18930 }); 18931 primaryLink.click(function(e) { 18932 var $target = $(e.target); 18933 var inputs = $target.is("input"); 18934 var labels = $target.is("label"); 18935 var buttons = $target.is("button"); 18936 var hasChildren = $(this).hasClass("has-children"); 18937 if (!inputs && !labels && !buttons && hasChildren) { 18938 e.preventDefault(); 18939 } 18940 if (!inputs && !labels && !buttons) { 18941 $(this) 18942 .children(".nav-subnav") 18943 .toggleClass("clicked"); 18944 $(this) 18945 .children(".has-children-arrow-wrapper") 18946 .children("i") 18947 .toggleClass("rotate"); 18948 $(this) 18949 .siblings("li") 18950 .children("a") 18951 .removeClass("selected"); 18952 $(this) 18953 .siblings(".has-children") 18954 .children(".has-children-arrow-wrapper") 18955 .children("i") 18956 .removeClass("rotate"); 18957 $(this) 18958 .children(".nav-subnav") 18959 .slideToggle("400"); 18960 $(this) 18961 .siblings(".has-children") 18962 .children(".nav-subnav") 18963 .removeClass("clicked") 18964 .slideUp("400"); 18965 $(this) 18966 .siblings(".has-children") 18967 .children(".nav-subnav") 18968 .children(".has-children") 18969 .children(".nav-subnav-second") 18970 .removeClass("clicked") 18971 .slideUp("400"); 18972 $(this) 18973 .siblings(".has-children") 18974 .children(".nav-subnav") 18975 .children(".has-children") 18976 .children(".nav-subnav-second") 18977 .children(".has-children") 18978 .children(".nav-subnav-third") 18979 .removeClass("clicked") 18980 .slideUp("400"); 18981 $(this) 18982 .siblings(".has-children") 18983 .children(".nav-subnav") 18984 .children(".has-children") 18985 .children(".has-children-arrow-wrapper") 18986 .children("i") 18987 .removeClass("rotate"); 18988 $(this) 18989 .siblings(".has-children") 18990 .children(".nav-subnav") 18991 .children(".has-children") 18992 .children(".nav-subnav-second") 18993 .children(".has-children") 18994 .children(".has-children-arrow-wrapper") 18995 .children("i") 18996 .removeClass("rotate"); 18997 if ($(this).find(".nav-subnav-second.clicked").length) { 18998 $(".nav-subnav-second, .nav-subnav-third").removeClass("clicked").slide
18998Up("400"); 18999 $(".has-children-arrow-wrapper") 19000 .children(".has-children-arrow") 19001 .removeClass("rotate"); 19002 } 19003 } 19004 if (hasChildren) { 19005 e.stopPropagation(); 19006 } 19007 }); 19008 19009 $(".has-children:not(.primary-link) > a:not(.sub-a)").click(function( 19010 e 19011 ) { 19012 19013 19014 e.stopPropagation(); 19015 }); 19016 19017 $(".has-children.has-children-second > a:not(.sub-a)").click(function( 19018 e 19019 ) { 19020 19021 e.preventDefault(); 19022 $(this) 19023 .parent(".has-children-second") 19024 .siblings(".has-children-second") 19025 .children(".nav-subnav-second") 19026 .slideUp("400"); 19027 $(this) 19028 .parent(".has-children-second") 19029 .siblings(".has-children-second") 19030 .children(".has-children-arrow-wrapper") 19031 .children("i") 19032 .removeClass("rotate"); 19033 $(this) 19034 .siblings(".nav-subnav-second") 19035 .toggleClass("clicked"); 19036 $(this) 19037 .siblings(".nav-subnav-second") 19038 .slideToggle("400", function () { 19039 $(this) 19040 .parent(".has-children-second") 19041 .siblings(".has-children-second") 19042 .children(".nav-subnav-second") 19043 .removeClass("clicked"); 19044 }); 19045 $(this) 19046 .siblings(".has-children-arrow-wrapper") 19047 .children("i") 19048 .toggleClass("rotate"); 19049 if ($(this).hasClass("has-children")) { 19050 19051 e.stopPropagation(); 19052 } 19053 }); 19054 19055 $(".has-children.has-children-third > a:not(.sub-a)").click(function( 19056 event 19057 ) { 19058 19059 event.preventDefault(); 19060 $(this) 19061 .parent(".has-children-third") 19062 .siblings(".has-children-third") 19063 .children(".nav-subnav-third") 19064 .slideUp("400"); 19065 setTimeout(function() { 19066 $(this) 19067 .parent(".has-children-third") 19068 .siblings(".has-children-third") 19069 .children(".nav-subnav-third") 19070 .removeClass("clicked"); 19071 }, 400); 19072 $(this) 19073 .parent(".has-children-third") 19074 .siblings(".has-children-third") 19075 .children(".has-children-arrow-wrapper") 19076 .children("i") 19077 .removeClass("rotate"); 19078 $(this) 19079 .siblings(".nav-subnav-third") 19080 .toggleClass("clicked"); 19081 $(this) 19082 .siblings(".nav-subnav-third") 19083 .slideToggle("400"); 19084 $(this) 19085 .siblings(".has-children-arrow-wrapper") 19086 .children("i") 19087 .toggleClass("rotate"); 19088 }); 19089 } 19090 $(document).click(function() { 19091 $(".nav-subnav.clicked").removeClass("clicked").slideUp("400"); 19092 $(".nav-subnav-second.clicked, .nav-subnav-third.clicked").removeClass("clicked").slideUp("400"); 19093 19094 $("a.selected").removeClass("selected"); 19095 if (navOverallWrapper.hasClass("click-nav")) { 19096 $("i").removeClass("rotate"); 19097 } 19098 }); 19099 // for the click nav option on desktop 19100 if ($(window).width() >= 845 && $(".click-nav").length > 0) { 19101 primaryLink.click(function(e) { 19102 $(this) 19103 .siblings("li") 19104 .children("a") 19105 .removeClass("selected"); 19106 $(this) 19107 .siblings(".has-children") 19108 .children(".has-children-arrow-wrapper") 19109 .children("i") 19110 .removeClass("rotate"); 19111 $(this) 19112 .siblings(".has-children") 19113 .children(".nav-subnav") 19114 .removeClass("clicked"); 19115 $(this) 19116 .siblings(".has-children") 19117 .children(".nav-subnav") 19118 .children(".has-children") 19119 .children(".nav-subnav-second") 19120 .removeClass("clicked"); 19121 $(this) 19122 .siblings(".has-children") 19123 .children(".nav-subnav") 19124 .children(".has-children") 19125 .children(".nav-subnav-second") 19126 .children(".has-children") 19127 .children(".nav-subnav-third") 19128 .removeClass("clicked"); 19129 $(this) 19130 .siblings(".has-children") 19131 .children(".nav-subnav") 19132 .children(".has-children") 19133 .children(".has-children-arrow-wrapper") 19134 .children("i") 19135 .removeClass("rotate"); 19136 $(this) 19137 .siblings(".has-children") 19138 .children(".nav-subnav") 19139 .children(".has-children") 19140 .children(".nav-subnav-second") 19141 .children(".has-children") 19142 .children(".has-children-arrow-wrapper") 19143 .children("i") 19144 .removeClass("rotate"); 19145 $(this) 19146 .siblings(".has-children") 19147 .children(".nav-subnav") 19148 .children(".has-children") 19149 .children(".nav-subnav-second") 19150 .children(".has-children") 19151 .children(".nav-subnav-third") 19152 .removeClass("clicked"); 19153 if ( 19154 $(this).find(".nav-subnav-second.clicked").length > 0 && 19155 $(this).find(".account-access-link").length === 0 19156 ) { 19157 $(".nav-subnav-second, .nav-subnav-third").removeClass("clicked"); 19158 $(".has-children-arrow-wrapper") 19159 .children(".has-children-arrow") 19160 .removeClass("rotate"); 19161 } 19162 if ($(this).hasClass("has-children")) { 19163 19164 e.stopPropagation(); 19165 } 19166 }); 19167 19168 $(".has-children:not(.primary-link) > a:not(.sub-a)").click(function( 19169 e 19170 ) { 19171 19172 e.stopPropagation(); 19173 }); 19174 19175 $(".has-children > a:not(.sub-a)").click(function(e) { 19176 $(this) 19177 .parent(".has-children-second") 19178 .siblings(".has-children-second") 19179 .children(".nav-subnav-second") 19180 .removeClass("clicked"); 19181 $(this) 19182 .parent(".has-children-second") 19183 .siblings(".has-children-second") 19184 .children(".has-children-arrow-wrapper") 19185 .children("i") 19186 .removeClass("rotate"); 19187 $(this) 19188 .parent(".has-children-third") 19189 .siblings(".has-children-third") 19190 .children(".nav-subnav-third") 19191 .removeClass("clicked"); 19192 $(this) 19193 .parent(".has-children-third") 19194 .siblings(".has-children-third") 19195 .children(".has-children-arrow-wrapper") 19196 .children("i") 19197 .removeClass("rotate"); 19198 $(this).toggleClass("selected"); 19199 $(this) 19200 .siblings(".nav-subnav") 19201 .toggleClass("clicked"); 19202 $(this) 19203 .siblings(".has-children-arrow-wrapper") 19204 .children(".has-children-arrow") 19205 .toggleClass("rotate"); 19206 $(this) 19207 .siblings(".nav-subnav-second") 19208 .toggleClass("clicked"); 19209 $(this) 19210 .siblings(".nav-subnav-third") 19211 .toggleClass("clicked"); 19212 19213 e.preventDefault(); 19214 }); 19215 } 19216 } 19217 19218 // fixed nav push content below 19219 if ($(".is-fixed").length) { 19220 var navHeight = navOverallWrapper.outerHeight(); 19221 navOverallWrapper 19222 .next() 19223 .css("padding-top", navHeight); 19224 } 19225 19226 // fixed nav after scroll 19227 if ($(".is-fixed-scroll").length) { 19228 var navPosition = $(".is-fixed-scroll").offset().top; 19229 $(window).scroll(function() { 19230 if ($(window).scrollTop() > navPosition) { 19231 $(".is-fixed-scroll").addClass("is-fixed"); 19232 } else { 19233 $(".is-fixed-scroll").removeClass("is-fixed"); 19234 } 19235 }); 19236 } 19237 19238 if ($(window).width() <= 1024 && $(window).width() > 768) { 19239 $(".has-children > a:not(.sub-a)").click(function (event) { 19240 19241 event.preventDefault(); 19242 }); 19243 } else { 19244 if ($(".click-nav").length === 0) { 19245 $(".has-children > a:not(.sub-a)").unbind("click"); 19246 } 19247 } 19248 19249 19250 19251 //Make active state for menu 19252 $(function() { 19253 var url = window.location.href.split("#")[0]; 19254 var page = url.substr(url.lastIndexOf("/") + 1); 19255 19256 if (page.length === 0) { 19257 page = "./"; 19258 } 19259 19260 var $activLink = $('.nav a[href="' + page + '"]'); 19261 19262 $activLink.addClass("selected"); 19263 19264 if ( 19265 $activLink 19266 .parent() 19267 .parent() 19268 .hasClass("nav-subnav") 19269 ) { 19270 $activLink 19271 .parent() 19272 .parent() 19273 .siblings("a") 19274 .addClass("selected"); 19275 } 19276 });
19277 19278 // iPad Pro landscape nav handling 19279 $(function() { 19280 var isTouchDevice = "ontouchstart" in document.documentElement; 19281 if (isTouchDevice && $(window).width() > 844) { 19282 $(".nav-top-link").addClass("show"); 19283 $(".has-children > a:not(.sub-a)").click(function (event) { 19284 event.preventDefault(); 19285 }); 19286 } 19287 }); 19288 19289 //swipe functionality 19290 if ($(window).width() <= 844) { 19291 if (navOverallWrapper.hasClass("nav-right")) { 19292 $(document).on("swiperight", "body", function() { 19293 $(navClosed); 19294 }); 19295 19296 $(document).on("swipeleft", "body", function() { 19297 $(navOpened); 19298 }); 19299 } else { 19300 $(document).on("swiperight", "body", function() { 19301 $(navOpened); 19302 }); 19303 19304 $(document).on("swipeleft", "body", function() { 19305 $(navClosed); 19306 }); 19307 } 19308 } 19309 19310 // swipe functionality for van-mobile-nav 19311 if (vanMobileNav.length) { 19312 if ($(window).width() <= 1024) { 19313 if (navOverallWrapper.hasClass("nav-right")) { 19314 $(document).on("swiperight", "body", function() { 19315 $(navClosed); 19316 }); 19317 19318 $(document).on("swipeleft", "body", function() { 19319 $(navOpened); 19320 }); 19321 } else { 19322 $(document).on("swiperight", "body", function () { 19323 $(navOpened); 19324 }); 19325 19326 $(document).on("swipeleft", "body", function() { 19327 $(navClosed); 19328 }); 19329 } 19330 } 19331 } 19332 }); 19333 19334 if ($(".click-nav").length === 0 && $(window).width() < 1024) { 19335 $(".nav-overall-wrapper").addClass("click-nav"); 19336 } 19337 19338 // Resize functionality 19339 // Transition from mobile to desktop and vice versa 19340 $(window).on('orientationchange', function (e) { //use orientation change instead of resize to account for Android keyboards which trigger unwanted resize events 19341 _.delay(function() { 19342 $(".nav-subnav").removeAttr("style"); 19343 $(".nav-subnav-second").removeAttr("style"); 19344 $(".nav-subnav-third").removeAttr("style"); 19345 $(".nav-overall-wrapper").removeClass("out-from-left"); 19346 $(".nav-internal-wrapper").removeClass("nav-opened nav-closed"); 19347 $(".nav-trigger").removeClass("nav-opened"); 19348 $(".nav").removeClass("nav-opened nav-closed"); 19349 $(".nav-subnav").removeClass("clicked"); 19350 $(".nav-subnav-second").removeClass("clicked"); 19351 $(".nav-subnav-third").removeClass("clicked"); 19352 $(".has-children-arrow-wrapper > i").removeClass("rotate"); 19353 if ($(".click-nav").length === 0 || $(window).width() < 1024) { 19354 $(".nav-overall-wrapper").addClass("click-nav"); 19355 } else { 19356 $(".nav-overall-wrapper").removeClass("click-nav"); 19357 } 19358 }, 19359 100); 19360 }); 19361} 19362; 19363function AccountAccess() { 19364 this.$link = $(".page-link-client-access a"); 19365 this.$menu = this.$link.closest(".page-link-client-access"); 19366} 19367AccountAccess.prototype.events = function () { 19368 this.$link.focus(this.linkFocus.bind(this)); 19369 this.$link.focusout(this.linkFocusout.bind(this)); 19370} 19371AccountAccess.prototype.linkFocus = function (e) { 19372 this.$menu.addClass("has-focus"); 19373} 19374AccountAccess.prototype.linkFocusout = function (e) { 19375 if (this.$menu.has(e.relatedTarget).length < 1) this.$menu.removeClass("has-focus"); 19376} 19377$(window).load(function (e) { 19378 var accountAccess = new AccountAccess(); 19379 accountAccess.events(); 19380});; 19381(function ($) { 19382 var $win = $(window); 19383 var $doc = $(document); 19384 $win.on("load", function () { 19385 var $timelineNavigationWrapper = $(".timeline-navigation-wrapper"); 19386 var $timelineNavigation = $(".timeline-navigation"); 19387 var NAVWIDTH = $timelineNavigation.width(); 19388 var $timelineContainer = $(".timeline-container"); 19389 if ($timelineNavigationWrapper) { 19390 var screenTop = 0; 19391 var fixedNavHeight = $(".nav-overall-wrapper.is-fixed").outerHeight(); 19392 var navHeight = $timelineNavigationWrapper.outerHeight(); 19393 var navHeights = fixedNavHeight + navHeight; 19394 if ($timelineNavigationWrapper.offset() !== undefined) { 19395 var navTop = $timelineNavigationWrapper.offset().top; 19396 var top = navHeights + navTop; 19397 } 19398 19399 $(".timeline-blocks").each(function(i) { 19400 $(this).attr("data-count", i); 19401 $( 19402 '.timeline-blocks[data-count="' + 19403 i + 19404 '"] .timeline-block-left-column .timeline-block.right' 19405 ).each(function() { 19406 $(this) 19407 .clone() 19408 .appendTo( 19409 '.timeline-blocks[data-count="' + 19410 i + 19411 '"] .timeline-block-right-column' 19412 ); 19413 }); 19414 }); 19415 19416 $timelineNavigation.on("click", "a", function(e) { 19417 e.preventDefault(); 19418 $(this).addClass("active"); 19419 $(this) 19420 .siblings() 19421 .removeClass("active"); 19422 var href = $(this).attr("href"); 19423 var $decade = $(".timeline-decade[data-decade='" + href + "']"); 19424 $decade 19425 .parent() 19426 .next() 19427 .slideDown(); 19428 $decade.next().removeClass("rotate"); 19429 var offTop = $decade.offset().top; 19430 $("html, body").animate({ scrollTop: offTop - navHeights }, 500); 19431 }); 19432 $(".timeline-decade-wrapper").on("click", function() { 19433 $(this) 19434 .next() 19435 .slideToggle(); 19436 $(this) 19437 .find(".timeline-decade-arrow") 19438 .toggleClass("rotate"); 19439 }); 19440 $win.on("scroll", function() { 19441 screenTop = $doc.scrollTop() + navHeights; 19442 if (screenTop >= top - fixedNavHeight) { 19443 $timelineNavigationWrapper.addClass("sticky"); 19444 $timelineNavigation.css({ 19445 width: NAVWIDTH, 19446 top: fixedNavHeight 19447 }); 19448 $timelineContainer.css("paddingTop", navHeight); 19449 } else { 19450 $timelineNavigationWrapper.removeClass("sticky"); 19451 $timelineNavigation.css("top", ""); 19452 $timelineContainer.css("paddingTop", ""); 19453 } 19454 }); 19455 $win.on( 19456 "resize", 19457 _.debounce(function() { 19458 $timelineNavigation.css("width", ""); 19459 NAVWIDTH = $timelineNavigation.width(); 19460 }, 200) 19461 ); 19462 } 19463 });
19464})(window.jQuery); 19465; 19466(function ($) { 19467 $(function () { 19468 var ConnectedAdvisorSlider = function(name) { 19469 this.init = function () { 19470 $(name).slick({ 19471 arrows: false, 19472 dots: true, 19473 slidesToShow: 1, 19474 autoplay: true, 19475 speed: 500, 19476 infinite: true, 19477 waitForAnimate: true, 19478 useTransform: true, 19479 cssEase: "cubic-bezier(0.250, 0.460, 0.450, 0.940)" 19480 }); 19481 $(name) 19482 .find(".slick-active") 19483 .not("li.slick-active, .slick-cloned") 19484 .addClass("fade-in"); 19485 $(name).find(".slick-dots").addClass("fade-in"); 19486 }; 19487 }; 19488 19489 var tallestSlideHeight = 0; 19490 var $connectedAdvisorContainer = $(".connected-advisor-container"); 19491 19492 var equalHeightConnectedAdvisor = function (el) { 19493 var $el = $(el); 19494 tallestSlideHeight = 0; 19495 $el.each(function () { 19496 var elHeight = $(this).height(); 19497 if (elHeight > tallestSlideHeight) { 19498 tallestSlideHeight = elHeight; 19499 } 19500 }); 19501 $el.height(tallestSlideHeight); 19502 }; 19503 if ($connectedAdvisorContainer.length > 0) { 19504 var connectedAdvisor = new ConnectedAdvisorSlider( 19505 ".connected-advisor-container" 19506 ); 19507 connectedAdvisor.init(); 19508 equalHeightConnectedAdvisor(".connected-advisor-slide-link"); 19509 $(window).resize( 19510 _.debounce(function () { 19511 $(".connected-advisor-slide-link").css("height", ""); 19512 equalHeightConnectedAdvisor(".connected-advisor-slide-link"); 19513 }, 100) 19514 ); 19515 } 19516 }); 19517})(window.jQuery); 19518; 19519(function ($) { 19520 $(window).load(function () { 19521 var $signature = $(".welcome-letter-signature"); 19522 var signatureWidth = $signature.width(); 19523 if (signatureWidth >= 100) { 19524 $signature.show(); 19525 $signature.siblings().hide(); 19526 } else { 19527 $signature.hide(); 19528 $signature.siblings().show(); 19529 } 19530 }); 19531})(window.jQuery); 19532; 19533var resourceContentSel = ".press-release-landing-inner-content, .resource-landing-inner-content, .resource-card-landing-inner-content"; 19534var contentSel = resourceContentSel; 19535 19536$(function() { 19537 CheckLoadMore(); 19538 19539 if ($(".resource-landing-load-more").length) { 19540 $(".resource-landing-load-more").on("click", function(e) { 19541 e.preventDefault(); 19542 e.stopPropagation(); 19543 LoadMore(); 19544 }); 19545 } 19546}); 19547 19548function CheckLoadMore() { 19549 var noMore = $(resourceContentSel).find(".has-more-records:last").val() === "False"; 19550 if (noMore) { 19551 $(".resource-landing-load-more-container").hide(); 19552 } else { 19553 $(".resource-landing-load-more-container").show(); 19554 } 19555} 19556 19557function GetNextPage(overwrite, page) { 19558 19559 if (page != null && page !== undefined) { 19560 return page; 19561 } 19562 19563 if (overwrite) { 19564 return 0; 19565 } else { 19566 var pageSize = parseInt($("#resourcePageSize").val()); 19567 var count = $(resourceContentSel).find("[data-resourceItemId]"); 19568 var nextPage = parseInt(count.size() / pageSize); 19569 return nextPage; 19570 } 19571} 19572 19573function GetFilterData(overwrite, page) { 19574 19575 var topicFilter = $("#filterTopic").val(); 19576 var catFilter = $("#filterCat").val(); 19577 var dateFilter = $("#filterDate").val(); 19578 var mediaFilter = $("#filterMedia").val(); 19579 var teaserLength = $("#teaserLength").val(); 19580 var variant = $("#variant").val(); 19581 var tagSeparator = $("#tagSeparator").val(); 19582 var dateFormat = $("#dateFormat").val(); 19583 var categoriesToDisplay = $("#categoriesToDisplay").val(); 19584 19585 var contextItemId = $(".contextItemId").val(); 19586 var siteContextItemId = $(".siteContextItemId").val(); 19587 var resourceDetailPageId = $(".resourceDetailPageId").val(); 19588 19589 var pageSize = parseInt($("#resourcePageSize").val()); 19590 19591 var filterData = { 19592 contextItemId: contextItemId, 19593 resourceDetailPageId: resourceDetailPageId, 19594 siteContextItemId: siteContextItemId, 19595 variant: variant, 19596 startNumber: GetNextPage(overwrite, page), 19597 numberToFetch: pageSize, 19598 dateFilter: dateFilter, 19599 categoryFilter: catFilter, 19600 topicFilter: topicFilter, 19601 mediaTypeFilter: mediaFilter, 19602 teaserLength: teaserLength, 19603 categoriesToDisplay: categoriesToDisplay, 19604 dateFormat: dateFormat, 19605 renderingParameters: $("#presentationParameters").val(), 19606 tagSeparator: tagSeparator, 19607 currentLang: GetParameterByName(window.location.href, "sc_lang"), 19608 SearchTerm: $(".search-term").val() 19609 }; 19610 19611 return filterData; 19612} 19613 19614function LoadMore(overwrite, page) { 19615 19616 var url = window.dataUrl || $("#ajaxUrlLanding").val(); 19617 19618 $.ajax({
19619 type: "POST", 19620 url: url, 19621 cache: false, 19622 data: GetFilterData(overwrite, page) 19623 }).done(function(data) { 19624 var targetGrid = $(".resource-landing-content-container"); 19625 var targetLoadMore = $(targetGrid).find(resourceContentSel); 19626 if (overwrite) { 19627 $(targetLoadMore).html(data); 19628 } else { 19629 $(targetLoadMore).append(data); 19630 } 19631 $(targetGrid).show(); 19632 19633 CheckLoadMore(); 19634 19635 if(typeof LoadFilterBar === "function") LoadFilterBar(null); 19636 19637 if (overwrite) { 19638 window.scrollTo(0, 0); 19639 } 19640 }); 19641 19642 19643}; 19644(function($) { 19645 $(function() { 19646 if ($(".nap-wrapper")) { 19647 var $interiorLeft = $(".interior-left"); 19648 var $window = $(window); 19649 19650 if ($window.width() < 992) { 19651 $interiorLeft.addClass("mobileOrdering"); 19652 } 19653 19654 $window.resize( 19655 _.debounce(function() { 19656 if ($window.width() >= 992) { 19657 $interiorLeft.removeClass("mobileOrdering"); 19658 } else { 19659 $interiorLeft.addClass("mobileOrdering"); 19660 } 19661 }, 100)); 19662 } 19663 }); 19664})(window.jQuery); 19665; 19666(function ($) { 19667 $(function () { 19668 $("form#investor-access").submit(pushUsername); 19669 $("form#mobile-investor-access").submit(pushUsername); 19670 $("form#client-access-on-page-form").submit(pushUsername); 19671 19672 function pushUsername(event) { 19673 if ($(this).find('#ia-checkbox').is(':checked') || $(this).find('#client-access-on-page-remember-me').is(':checked')) { 19674 var enteredUsername = $(this).find("input[name='LoginName']").val(); 19675 if (enteredUsername) { 19676 $.ajax({
19677 url: "/advisorsites/investoraccess/encryptusername", 19678 method: "POST", 19679 data: { username: enteredUsername }, 19680 dataType: "json" 19681 }) 19682 .done(function (data) { 19683 if (console && console.log) console.log("PUSH SUCCESS: " + data); 19684 }) 19685 .fail(function (data) { 19686 if (console && console.log) console.log("PUSH ERROR : " + data.responseText); 19687 }) 19688 .always(function () { 19689 $("input[name='VariableParameter2']").val(''); 19690 }); 19691 } 19692 } else { 19693 $.ajax({ 19694 url: "/advisorsites/investoraccess/forgetusername", 19695 method: "GET", 19696 dataType: "json" 19697 }) 19698 .done(function (data) { 19699 if (console && console.log) console.log("FORGET SUCCESS: " + data); 19700 }) 19701 .fail(function (data) { 19702 if (console && console.log) console.log("FORGET ERROR : " + data.responseText); 19703 }) 19704 .always(function () { 19705 // clear the username 19706 $("input[name='LoginName']").val(''); 19707 $("#mm-ia-username").val(''); 19708 $(".client-access-on-page-login-name").val(''); 19709 //clear the pw 19710 $("input[name='VariableParameter2']").val(''); 19711 //uncheck remember me 19712 $('.chk-remember-me').prop('checked', false); 19713 $('.investor-access-remember-me').prop('checked', false); 19714 $('.client-access-on-page-remember-me').prop('checked', false); 19715 }); 19716 } 19717 } 19718 19719 function pullUsername() { 19720 $.ajax({ 19721 url: "/advisorsites/investoraccess/decryptusername", 19722 method: "GET", 19723 dataType: "json", 19724 success: function (data) { 19725 if (console && console.log) console.log("PULL SUCCESS: decrypted: " + data.UsernameWasDecrypted + ", username: " + data.DecryptedUsername); 19726 if (data && data.UsernameWasDecrypted && data.DecryptedUsername) { 19727 var desktopUsernameTextbox = $("input[name='LoginName']"); 19728 if (desktopUsernameTextbox) { 19729 desktopUsernameTextbox.val(data.DecryptedUsername); 19730 $(`.login-name-label`).addClass('filled-out'); 19731 } 19732 var mobileUsernameTextbox = $("#mm-ia-username"); 19733 if (mobileUsernameTextbox) { 19734 mobileUsernameTextbox.val(data.DecryptedUsername); 19735 $('label[for=mm-ia-username]').addClass('filled-out'); 19736 } 19737 var onPageUsernameTextbox = $(".client-access-on-page-login-name"); 19738 if (onPageUsernameTextbox) { 19739 onPageUsernameTextbox.val(data.DecryptedUsername); 19740 $('.client-access-on-page-login-name-label').addClass('filled-out'); 19741 } 19742 19743 $('.chk-remember-me').prop('checked', true); 19744 $('.investor-access-remember-me').prop('checked', true); 19745 $('.client-access-on-page-remember-me').prop('checked', true); 19746 } 19747 }, 19748 error: function (data) { 19749 if (console && console.log) console.log("PULL ERROR : " + data.responseText); 19750 } 19751 }); 19752 } 19753 19754 pullUsername(); 19755 }); 19756})(window.jQuery);; 19757(function ($) { 19758 $(function () { 19759 var $horizontalTimeline = $(".horizontal-timeline"); 19760 var $window = $(window); 19761 var HorizontalTimeline = function (name) { 19762 this.init = function () { 19763 $(name).slick({ 19764 arrows: true, 19765 dots: false, 19766 slidesToShow: 3, 19767 autoplay: false, 19768 speed: 500, 19769 infinite: false, 19770 waitForAnimate: true, 19771 useTransform: true, 19772 cssEase: "cubic-bezier(0.250, 0.460, 0.450, 0.940)" 19773 }); 19774 }; 19775 }; 19776 if ($horizontalTimeline.length > 0) { 19777 var horizontalTimeline = new HorizontalTimeline(".horizontal-timeline"); 19778 $horizontalTimeline.on("init", function () { 19779 var current = $(this).find( 19780 ".horizontal-timeline-slide.first.slick-active" 19781 ); 19782 var bg = $(current).data("background"); 19783 $(this).css("background", bg); 19784 }); 19785 19786 $horizontalTimeline.on("afterChange", function () { 19787 var current = $(this).find(".horizontal-timeline-slide.slick-current"); 19788 var bg = $(current).data("background"); 19789 $(this).css("background", bg); 19790 }); 19791 19792 var $horizontalTimelineSlide = $(".horizontal-timeline-slide"); 19793 var init = function() { 19794 if ($window.width() >= 768) { 19795 $horizontalTimelineSlide.hover( 19796 function () { 19797 $(this).find(".horizontal-timeline-copy").slideDown(); 19798 }, 19799 function () { 19800 $(this).find(".horizontal-timeline-copy").slide
19800Up(); 19801 } 19802 ); 19803 } 19804 19805 var isInitialized = $horizontalTimeline.hasClass("slick-initialized"); 19806 var wide = $(window).width() >= 768; 19807 if (isInitialized && !wide) { 19808 $horizontalTimeline.slick("unslick"); 19809 $horizontalTimelineSlide.unbind("mouseenter mouseleave"); 19810 } else if (!isInitialized && wide) { 19811 horizontalTimeline.init(); 19812 } 19813 } 19814 init(); 19815 19816 $window.resize( 19817 _.debounce(function () { 19818 init(); 19819 }, 200) 19820 ); 19821 } 19822 }); 19823})(window.jQuery); 19824; 19825(function () { 19826 19827 function redirect(url) { 19828 if (!url) { 19829 return; 19830 } 19831 window.location.href = url; 19832 } 19833 19834 class Consent { 19835 constructor() { 19836 this.$langPopup = $(".language-popup"); 19837 if (!this.$langPopup.length) { 19838 return; 19839 } 19840 19841 this.$acceptBtn = this.$langPopup.find(".language-popup-accept"); 19842 this.$declineBtn = this.$langPopup.find(".language-popup-decline"); 19843 19844 this.$acceptBtn.on('click', this.handleAccept.bind(this)); 19845 this.$declineBtn.on('click', this.handleDecline.bind(this)); 19846 19847 $("body").append(this.$langPopup); 19848 19849 } 19850 setUrl(url) { 19851 this.url = url; 19852 this.openPopup(); 19853 } 19854 handleAccept() { 19855 sessionStorage.setItem("accepted-consent-spanish", "true"); 19856 19857 this.closePopup(); 19858 19859 if (this.url) { 19860 redirect(this.url); 19861 } 19862 } 19863 handleDecline() { 19864 sessionStorage.setItem("accepted-consent-spanish", "false"); 19865 19866 this.closePopup(); 19867 19868 if (Consent.isSpanish()) { 19869 const href = UpdateURLParameter(window.location.href, "sc_lang", "en"); 19870 redirect(href); 19871 } 19872 } 19873 openPopup() { 19874 if (!this.$langPopup.length) { 19875 return; 19876 } 19877 19878 this.$langPopup.removeClass('hidden'); 19879 this.preventBodyScroll(true); 19880 } 19881 closePopup() { 19882 this.$langPopup.addClass('hidden'); 19883 this.preventBodyScroll(false); 19884 } 19885 preventBodyScroll(prevent) { 19886 $("body").toggleClass("overflow-hidden", prevent); 19887 } 19888 static hasConsented() { 19889 return sessionStorage.getItem("accepted-consent-spanish") === "true"; 19890 } 19891 static isSpanish() { 19892 return document.documentElement.lang === "es"; 19893 } 19894 } 19895 19896 const languageConsent = new Consent(); 19897 19898 if (Consent.isSpanish() && !Consent.hasConsented()) { 19899 languageConsent.openPopup(); 19900 } 19901 19902 $(document).on("click", ".language-toggle", function (e) { 19903 $.ajax({
19904 url: "/advisorsites/language/changelanguage", 19905 type: "POST", 19906 data: { currentLanguage: window.currentLanguage, siteType: window.siteType }, 19907 dataType: "json", 19908 success: function (switchLang) { 19909 if (switchLang) { 19910 const url = window.location.href; 19911 const newUrl = UpdateURLParameter(url, "sc_lang", switchLang); 19912 const spanish = "es-es"; 19913 19914 if (switchLang === spanish) { 19915 if ($('.language-popup').length && !Consent.hasConsented()) { 19916 languageConsent.setUrl(newUrl); 19917 return; 19918 } 19919 } 19920 19921 redirect(newUrl); 19922 } 19923 } 19924 }); 19925 }); 19926})();; 19927$(function () { 19928 (function () { 19929 if (!$('.simple-form').length) return; 19930 // DATEPICKER 19931 var $datePicker = $('.date-picker'); 19932 $datePicker.each(function () { 19933 var $this = $(this); 19934 var isStatic = $this.hasClass('static'); 19935 $this.flatpickr({ 19936 static: isStatic || false, 19937 onReady: function (selectedDates, dateStr, instance) { 19938 // Step attribute on input type date is not supported so set it to null 19939 if (instance.isMobile) { 19940 $(instance.mobileInput).attr('step', null); 19941 } else { 19942 $this.addClass('simple-form-date-picker-not-mobile'); 19943 $this.wrap('<span class="simple-form-custom-date-wrapper"></span>'); 19944 $this.after('<span class="simple-form-custom-date"></span><i class="fa fa-calendar"></i>'); 19945 } 19946 }, 19947 onOpen: function (selectedDates, dateStr, instance) { 19948 if (!instance.isMobile) { 19949 $this.next().text(''); 19950 instance.input.value = ''; 19951 } 19952 }, 19953 onChange: function (selectedDates, dateStr, instance) { 19954 if (!instance.isMobile) { 19955 $this.next().text(instance.formatDate(selectedDates[0], 'm-d-Y')); 19956 } 19957 } 19958 }); 19959 }); 19960 19961 // SELECT 19962 $('.custom-select').each(function() { 19963 $(this).select2({ 19964 placeholder: '', 19965 width: '100%' 19966 }); 19967 }); 19968 19969 // RADIOS 19970 var $radios = $('input[type="radio"]'); 19971 $radios.each(function () { 19972 $(this).parent().addClass('radio-label'); 19973 }); 19974 19975 var $radioLabels = $('.radio-label'); 19976 $radioLabels.each(function () { 19977 var text = $(this).find('input').val(); 19978 $(this).prepend('<span class="label-text">' + text + '</span>'); 19979 $(this).find('input')[0].nextSibling.nodeValue = ''; 19980 $(this).append('<span class="radio-button"></span>'); 19981 $(this).wrap('<div></div>'); 19982 }); 19983 19984 // CHECKBOX 19985 var $checkboxLabels = $('.checkbox-label'); 19986 $checkboxLabels.each(function () { 19987 var text = $(this).find('input')[0].nextSibling.nodeValue.trim(); 19988 $(this).find('input')[0].nextSibling.nodeValue = ''; 19989 $(this).prepend('<span class="label-text">' + text + '</span>'); 19990 $(this).append('<span class="custom-checkbox"></span>'); 19991 $(this).wrap('<div></div>'); 19992 }); 19993 19994 //CHECKBOX LIST 19995 var $checkboxList = $('.checkbox-list'); 19996 var $checkboxes = $checkboxList.find('input[type="checkbox"]'); 19997 19998 $checkboxes.each(function() { 19999 var text = ''; 20000 if ($(this).parent().find('[data-sc-conditions-required]').length) { 20001 text = $(this).parent().text().trim(); 20002 $(this)[0].nextSibling.nextSibling.nodeValue = ''; 20003 } else { 20004 text = $(this)[0].nextSibling.nodeValue.trim(); 20005 $(this)[0].nextSibling.nodeValue = ''; 20006 } 20007 20008 $(this).parent().prepend('<span class="label-text">
20008' + text + '</span>'); 20009 $(this).parent().append('<span class="custom-checkbox"></span>'); 20010 $(this).parent().addClass('checkbox-label'); 20011 $(this).parent().wrap('<div></div>'); 20012 }); 20013 20014 })(); 20015}); 20016; 20017var $hoverLabelInputs = $(".find-an-advisor-container .form-field input"); 20018$hoverLabelInputs.each(function () { 20019 $(this).focus(function () { 20020 $(this).addClass("label-hovered"); 20021 }); 20022 $(this).blur(function () { 20023 if ($(this).val().length < 1) { 20024 $(this).removeClass("label-hovered"); 20025 } 20026 }); 20027});; 20028function Podcast() { 20029 this.transcriptButton = $(".podcast-episode-details-cta-transcript")[0]; 20030 this.podcastContainer = $(".podcast-episode-details")[0]; 20031 this.loadMore = $(".podcast-episodes-load-more")[0]; 20032 this.loadMoreUrl = $("#loadMoreAjaxUrl").val(); 20033} 20034Podcast.prototype.events = function () { 20035 $(this.transcriptButton).click(this.toggleTranscript.bind(this)); 20036 $(this.loadMore).click(this.loadMoreClick.bind(this)); 20037} 20038Podcast.prototype.initialize = function () { 20039 this.events(); 20040} 20041Podcast.prototype.toggleTranscript = function () { 20042 $(this.podcastContainer).toggleClass("closed"); 20043} 20044Podcast.prototype.loadMoreClick = function () { 20045 $.ajax({
20046 type: "GET", 20047 url: this.loadMoreUrl, 20048 cache: false, 20049 data: this.GetFilterData() 20050 }).done(function (data) { 20051 $(".podcast-episodes").append(data); 20052 if ($("#no-more-episodes").length > 0) $(".podcast-episodes-load-more").addClass("no-more-episodes"); 20053 }); 20054 20055} 20056Podcast.prototype.GetFilterData = function () { 20057 var contextItemId = $(".contextItemId").val(); 20058 var siteContextItemId = $(".siteContextItemId").val(); 20059 var loadMoreEpisodeCount = parseInt($("#loadMoreEpisodeCount").val()); 20060 var episodeDetailPageUrl = $(".episodeDetailPageUrl").val(); 20061 var startNumber = $(".podcast-episode").length; 20062 20063 return { 20064 contextItemId: contextItemId, 20065 siteContextItemId: siteContextItemId, 20066 StartNumber: startNumber, 20067 NumberToFetch: loadMoreEpisodeCount, 20068 EpisodeDetailPageUrl: episodeDetailPageUrl 20069 }; 20070} 20071//Audio Player 20072function AudioPlayer(pid) { 20073 this.kdp = document.getElementById(pid); 20074 var p = this.kdp.parentNode; 20075 var gp = p.parentNode; 20076 this.elem = gp.parentNode; 20077 this.seekbar = this.elem.getElementsByClassName("seek")[0]; 20078 this.bufferbar = this.elem.getElementsByClassName("buffer")[0]; 20079 this.timeTxt = this.elem.getElementsByClassName("time")[0]; 20080 this.durationTxt = this.elem.getElementsByClassName("duration")[0]; 20081 this.playBtn = this.elem.getElementsByClassName("play")[0]; 20082 this.playIcon = this.elem.getElementsByClassName("play-icon")[0]; 20083 this.forwardBtn = this.elem.getElementsByClassName("forward")[0]; 20084 this.rewindBtn = this.elem.getElementsByClassName("rewind")[0]; 20085 20086 this.seekbarWraper = this.seekbar.parentNode; 20087} 20088AudioPlayer.prototype.init = function () { 20089 this.kdp.kBind('mediaReady', this.mediaReady.bind(this)); 20090} 20091AudioPlayer.prototype.events = function () { 20092 $(this.playBtn).click(this.play.bind(this)); 20093 $(this.forwardBtn).click(this.seekForward.bind(this)); 20094 $(this.rewindBtn).click(this.seekBackward.bind(this)); 20095 $(this.seekbarWraper).click(this.seekbarClickEvent.bind(this)); 20096 20097 this.kdp.kBind('playerUpdatePlayhead', this.updateAudioPlayer.bind(this)); 20098 this.kdp.kBind('seeked', this.updateAudioPlayer.bind(this)); 20099 this.kdp.kBind('bufferProgress', this.updateBufferbarElem.bind(this)); 20100 this.kdp.kBind('playerPlayed', this.playClickEvent.bind(this)); 20101 this.kdp.kBind('playerPaused', this.pauseClickEvent.bind(this)); 20102} 20103AudioPlayer.prototype.updateAudioPlayer = function () { 20104 this.updateSeekbarElem(); 20105 this.updateCurrentTime(); 20106} 20107AudioPlayer.prototype.mediaReady = function () { 20108 this.playBtn.setAttribute("class", "play ui-btn ready"); 20109 this.forwardBtn.setAttribute("class", "forward ui-btn ready"); 20110 this.rewindBtn.setAttribute("class", "rewind ui-btn ready"); 20111 this.duration = this.kdp.evaluate("{duration}"); 20112 this.mask = this.getTimeMask(this.duration); 20113 this.updateCurrentTime(); 20114 this.updateDurationElem(); 20115 this.events(); 20116} 20117AudioPlayer.prototype.play = function (e) { 20118 var isPlay = this.playBtn.getAttribute("data-state") === "play"; 20119 isPlay ? this.kdp.sendNotification("doPause") : this.kdp.sendNotification("doPlay"); 20120 this.playIcon.setAttribute("class", isPlay ? "play-icon fa fa-play" : "play-icon fa fa-pause"); 20121} 20122AudioPlayer.prototype.seekForward = function (e) { 20123 var seekPosition = this.getSeekbarTime() + 15; 20124 this.kdp.sendNotification("doSeek", seekPosition); 20125} 20126AudioPlayer.prototype.seekBackward = function (e) { 20127 var seekPosition = this.getSeekbarTime() - 15; 20128 this.kdp.sendNotification("doSeek", seekPosition); 20129} 20130AudioPlayer.prototype.seekbarClickEvent = function (e) { 20131 var x = e.offsetX; 20132 var width = this.seekbarWraper.clientWidth; 20133 var perc = (x / width); 20134 this.seekPercentage(perc); 20135} 20136AudioPlayer.prototype.updateDurationElem = function () { 20137 this.durationTxt.innerHTML = this.secondsToHms(this.duration); 20138} 20139AudioPlayer.prototype.playClickEvent = function () { 20140 this.playBtn.setAttribute("data-state", "play"); 20141} 20142AudioPlayer.prototype.pauseClickEvent = function () { 20143 this.playBtn.setAttribute("data-state", "paused"); 20144} 20145AudioPlayer.prototype.seekSec = function (sec) { 20146 this.kdp.sendNotification("doSeek", sec); 20147} 20148AudioPlayer.prototype.seekPercentage = function (perc) { 20149 var sec = perc * this.duration; 20150 this.seekSec(sec); 20151} 20152AudioPlayer.prototype.getSeekbarTime = function () { 20153 return this.kdp.evaluate("{video.player.currentTime}"); 20154} 20155AudioPlayer.prototype.getBufferbarPercent = function () { 20156 return this.kdp.evaluate("{video.buffer.percent}") * 100; 20157} 20158AudioPlayer.prototype.getBarPercentage = function (time) { 20159 return (time / this.duration) * 100; 20160} 20161AudioPlayer.prototype.updateSeekbarElem = function () {
20162 var time = this.getSeekbarTime(); 20163 var perc = this.getBarPercentage(time); 20164 this.seekbar.setAttribute("style", "width: " + perc + "%;"); 20165} 20166AudioPlayer.prototype.updateBufferbarElem = function () { 20167 var perc = this.getBufferbarPercent(); 20168 this.bufferbar.setAttribute("style", "width: " + perc + "%;"); 20169} 20170 20171AudioPlayer.prototype.updateCurrentTime = function () { 20172 var currentTime = this.secondsToHms(this.getSeekbarTime()); 20173 this.timeTxt.innerHTML = this.applyMask(this.mask, currentTime); 20174} 20175AudioPlayer.prototype.secondsToHms = function (d) { 20176 d = Number(d); 20177 var h = Math.floor(d / 3600); 20178 var m = Math.floor(d % 3600 / 60); 20179 var s = Math.floor(d % 3600 % 60); 20180 20181 var hDisplay = h > 0 ? h + ":" : ""; 20182 var mDisplay = m > 0 ? m + ":" : "00:"; 20183 var sDisplay = "00" + s; 20184 20185 sDisplay = sDisplay.slice(sDisplay.length - 2, sDisplay.length); 20186 return "" + hDisplay + mDisplay + sDisplay; 20187} 20188AudioPlayer.prototype.getTimeMask = function (d) { 20189 var mask = this.secondsToHms(d); 20190 return mask.replace(/\d/g, "0"); 20191} 20192AudioPlayer.prototype.applyMask = function (m, s) { 20193 var length = s.length; 20194 return m.substring(0, m.length - length) + s; 20195} 20196 20197$(function () { 20198 var kalturaEntryId = $(".podcast-episode-details-audio-player").attr("data-episode-id"); 20199 if (kalturaEntryId) { 20200 kWidget.embed({ 20201 "targetId": "kaltura_player_001", 20202 "flashvars": {}, 20203 "wid": "_1727781", 20204 "uiconf_id": 48918542, 20205 "cache_st": 1634936801, 20206 20207 "entry_id": kalturaEntryId, 20208 "options": { 20209 "html5": { 20210 "hls": {}, 20211 "dash": {} 20212 } 20213 } 20214 }); 20215 } 20216 var podcast = new Podcast(); 20217 podcast.initialize(); 20218}); 20219 20220function jsCallbackReady(pid) { 20221 if($(".podcast-episode-details .audio-player").length > 0) { 20222 var audioPlayer = new AudioPlayer(pid); 20223 audioPlayer.init(); 20224 } 20225} 20226; 20227(function () { 20228 const $charts = $(".rj-mega-chart-container"); 20229 if (!$charts.length) { 20230 return; 20231 } 20232 20233 const barChartTemplateId = "973b7b5f-5d5c-46da-add4-67bf0c1d4e19"; 20234 const colChartTemplateId = "c435800c-472c-4ebc-b063-d21d1751dd1b"; 20235 const boxWhiskerChartTemplateId = "66cda39f-40d6-4889-8b83-49d89048aa63"; 20236 20237 $charts.each((containerIndex, containerElem) => { 20238 const outputElem = $(containerElem).find(".rj-mega-chart")[0]; 20239 const $fields = $(containerElem).find(".chart-field"); 20240 const categoryData = parseValue("chart-category-data"); 20241 const seriesData = getSeriesData(); 20242 const absoluteLabelData = getAbsoluteLabelData(); 20243 const seriesLabelData = getSeriesLabelData(); 20244 const option = buildOption(); 20245 initialize(); 20246 20247 function initialize() { 20248 const myEChart = echarts.init(outputElem); 20249 option && myEChart.setOption(option); 20250 20251 $(window).on("resize", function () { 20252 myEChart.resize(); 20253 }); 20254 } 20255 function getValue(subKey) { 20256 const result = $fields.filter(`.${subKey}`); 20257 if (!result.length) { 20258 return false; 20259 } 20260 return $(result).val(); 20261 } 20262 function parseValue(subKey) { 20263 const result = getValue(subKey); 20264 return result ? JSON.parse(result) : false; 20265 } 20266 //Series Data 20267 function getSeriesData() { 20268 const seriesDataContainers = [].slice.call($(containerElem).find(".series-container")); 20269 return seriesDataContainers.reduce(function (total, item) { 20270 total.push({ 20271 //Common: Required 20272 type: $(item).find(".series-type").val(), 20273 data: $(item).find(".series-data").val(), 20274 //Common: Optional 20275 name: $(item).find(".series-name").length > 0 ? $(item).find(".series-name").val() : "", 20276 color: $(item).find(".series-color").length > 0 ? $(item).find(".series-color").val() : "", 20277 //Pie 20278 selectedMode: $(item).find(".series-selected-mode").length > 0 ? $(item).find(".series-selected-mode").val() : "", 20279 selectedOffset: $(item).find(".series-selected-offset").length > 0 ? $(item).find(".series-selected-offset").val() : "", 20280 clockwise: $(item).find(".series-clockwise").length > 0 ? $(item).find(".series-clockwise").val() : true, 20281 top: $(item).find(".series-top").length > 0 ? $(item).find(".series-top").val() : false, 20282 left: $(item).find(".series-left").length > 0 ? $(item).find(".series-left").val() : false, 20283 radius: $(item).find(".series-radius").length > 0 ? $(item).find(".series-radius").val() : false, 20284 //Stacked 20285 stack: $(item).find(".series-stack").length > 0 ? $(item).find(".series-stack").val() : false, 20286 dataFormat: $(item).find(".series-data-format").length > 0 ? $(item).find(".series-data-format").val() : "{data}", 20287 }); 20288 return total; 20289 }, []); 20290 } 20291 //Label Data 20292 function getLabelContainers() { 20293 const $labelContainers = $(containerElem).find(".label-container"); 20294 const $result = $labelContainers.has(".label-absolute-position, .label-series-position"); 20295 return [].slice.call($result); 20296 }
20297 function getLabelContainersData() { 20298 const labelContainers = getLabelContainers(); 20299 return labelContainers.map(labelContainer => { 20300 return getLabelContainerData(labelContainer); 20301 }); 20302 } 20303 function getLabelContainerData(labelContainer) { 20304 const getString = function (selector, defaultValue) { 20305 const $result = $(labelContainer).find(selector); 20306 return $result.length ? $result.val() : defaultValue; 20307 }; 20308 const getJSON = function (selector, defaultValue) { 20309 const val = getString(selector, false); 20310 if (!val) { 20311 return defaultValue; 20312 } 20313 return JSON.parse(val); 20314 }; 20315 const absolutePosition = getJSON(".label-absolute-position", false); 20316 const seriesPosition = getJSON(".label-series-position", false); 20317 20318 const result = { 20319 color: getString(".label-color", ""), 20320 backgroundColor: getString(".label-background-color", ""), 20321 borderColor: getString(".label-border-color", ""), 20322 borderWidth: getString(".label-border-width", ""), 20323 fontSize: getString(".label-font-size", ""), 20324 chartTemplateId: getString(".label-chart-template-id", ""), 20325 borderRadius: parseInt(getString(".label-border-radius", "")), 20326 lineHeight: parseInt(getString(".label-line-height", "")), 20327 padding: getJSON(".label-padding", [0, 0, 0, 0]), 20328 text: getJSON(".label-text", [""]), 20329 position: !seriesPosition ? !absolutePosition ? [0, 0] : absolutePosition : seriesPosition, 20330 isAbsolute: absolutePosition !== false, 20331 isSeries: seriesPosition !== false, 20332 }; 20333 return result; 20334 } 20335 function getAbsoluteLabelData() {
20336 const labelContainersData = getLabelContainersData(); 20337 return labelContainersData.filter((labelContainerData) => labelContainerData.isAbsolute); 20338 } 20339 function getSeriesLabelData() { 20340 const labelContainersData = getLabelContainersData(); 20341 return labelContainersData.filter((labelContainerData) => labelContainerData.isSeries); 20342 } 20343 //Labels: Shared 20344 function buildLabelLayout(params) { 20345 if (!seriesData) { 20346 return {}; 20347 } 20348 if (!seriesData[params.seriesIndex]) { 20349 return {}; 20350 } 20351 if (!params.text.length) { 20352 return {}; 20353 } 20354 const data = JSON.parse(seriesData[params.seriesIndex].data); 20355 const isBarChart = seriesLabelData[0].chartTemplateId === barChartTemplateId; 20356 const isColChart = seriesLabelData[0].chartTemplateId === colChartTemplateId; 20357 const chartWidth = $(containerElem).find(".rj-mega-chart").width(); 20358 20359 const value = data[params.dataIndex]; 20360 const horizontalMargin = 30; 20361 const verticalMargin = 5; 20362 const maxWidth = 400; 20363 20364 const dynamicMaxWidth = ((chartWidth - params.labelRect.x - (params.labelRect.width / 2)) * 2) - (horizontalMargin); 20365 const labelWidth = params.labelRect.width > dynamicMaxWidth ? dynamicMaxWidth : params.labelRect.width; 20366 const labelTop = params.rect.y - (verticalMargin); 20367 const labelBottom = params.rect.y + params.rect.height + (verticalMargin); 20368 const labelCenter = params.rect.x + (params.rect.width / 2); 20369 20370 20371 const getBarChartLabelDimensions = () => { 20372 if (value < 0) { 20373 const left = params.rect.x - (horizontalMargin / 2); 20374 const barDynamicMaxWidth = maxWidth < params.rect.x - horizontalMargin ? maxWidth : params.rect.x - horizontalMargin; 20375 const barDynamicLabelWidth = params.labelRect.width < barDynamicMaxWidth ? params.labelRect.width : barDynamicMaxWidth; 20376 const x = left - (barDynamicLabelWidth / 2); 20377 return { 20378 x: x, 20379 width: barDynamicLabelWidth, 20380 labelTop: params.rect.y, 20381 } 20382 } 20383 const right = params.rect.x + params.rect.width + (horizontalMargin / 2); 20384 const barDynamicMaxWidth = params.rect.x + params.rect.width + maxWidth + horizontalMargin < chartWidth ? maxWidth : chartWidth - params.rect.x - params.rect.width - horizontalMargin; 20385 const barDynamicLabelWidth = params.labelRect.width < barDynamicMaxWidth ? params.labelRect.width : barDynamicMaxWidth; 20386 const x = right + (barDynamicLabelWidth / 2); 20387 return { 20388 x: x, 20389 width: barDynamicLabelWidth, 20390 labelTop: params.rect.y, 20391 } 20392 } 20393 const barChartDimensions = getBarChartLabelDimensions(); 20394 const result = isBarChart ? { 20395 x: barChartDimensions.x, 20396 y: barChartDimensions.labelTop, 20397 align: "center", 20398 verticalAlign: "top", 20399 width: barChartDimensions.width, 20400 } : isColChart ? { 20401 x: labelCenter, 20402 y: value < 0 ? labelBottom : labelTop, 20403 align: "center", 20404 verticalAlign: value < 0 ? "top" : "bottom", 20405 width: labelWidth, 20406 } : { 20407 x: labelCenter, 20408 y: labelTop, 20409 align: "center", 20410 verticalAlign: "bottom", 20411 width: labelWidth, 20412 } 20413 return result 20414 } 20415 //Labels: Mark Points 20416 function buildMarkPoint(shouldBuild) { 20417 if (!shouldBuild) { 20418 return {}; 20419 } 20420 const labels = buildMarkLabels(); 20421 const base = { 20422 symbol: "rect", 20423 data: [], 20424 }; 20425 return labels.reduce((total, label) => { 20426 label.offset = [0, 20]; 20427 const pos = label.position; 20428 label.position = "top"; 20429 const obj = { 20430 coord: pos, 20431 itemStyle: { 20432 backgroundColor: "transparent", 20433 color: "transparent", 20434 }, 20435 label: label, 20436 }; 20437 total.data.push(obj); 20438 return total; 20439 }, base); 20440 } 20441 function buildMarkLabels() { 20442 if (!seriesLabelData.length) { 20443 return []; 20444 } 20445 return seriesLabelData.reduce((total, label) => { 20446 const obj = { 20447 show: true, 20448 position: label.position, 20449 backgroundColor: label.backgroundColor, 20450 borderColor: label.borderColor, 20451 borderWidth: label.borderWidth, 20452 borderRadius: label.borderRadius, 20453 padding: label.padding, 20454 fontSize: label.fontSize, 20455 overflow: "break", 20456 formatter: label.text.join("\n"), 20457 color: label.color, 20458 lineHeight: label.lineHeight, 20459 }; 20460 total.push(obj); 20461 return total; 20462 }, []); 20463 } 20464 //Labels: Series 20465 function buildSeriesLabel() { 20466 if (!seriesLabelData.length) { 20467 return {}; 20468 } 20469 const firstLabelData = seriesLabelData[0]; 20470 return { 20471 show: true, 20472 position: firstLabelData.chartTemplateId === barChartTemplateId ? "right" : "top", 20473 backgroundColor: firstLabelData.backgroundColor, 20474 borderColor: firstLabelData.borderColor, 20475 borderWidth: firstLabelData.borderWidth, 20476 borderRadius: firstLabelData.borderRadius, 20477 padding: firstLabelData.padding, 20478 overflow: "break", 20479 rich: buildSeriesLabelStyles(seriesLabelData), 20480 formatter: (params) => { return buildSeriesLabelFormatter(params.data, params.dataIndex); }, 20481 }; 20482 } 20483 function buildSeriesLabelStyles(arr) { 20484 return arr.reduce((total, labelData, i) => { 20485 const newLabelName = `label${i}`; 20486 const newLabel = { 20487 color: labelData.color, 20488 lineHeight: labelData.lineHeight, 20489 fontSize: labelData.fontSize, 20490 opacity: 1, 20491 }; 20492 total[newLabelName] = newLabel; 20493 return total; 20494 }, {}); 20495 } 20496 function dataFormatter(params) { 20497 let hasTitle = false; 20498 let result = ""; 20499 for (let i = 0; i < params.length; i++) { 20500 const val = params[i].data; 20501 if (val === null || val === undefined || params[i].axisValue === 0 || params[i].axisType.includes(".value")) { 20502 continue; 20503 } 20504 if (!hasTitle) { 20505 result += `<p>${params[0].axisValue}</br>`; 20506 hasTitle = true; 20507 } 20508 const pattern = seriesData[params[i].axisIndex].dataFormat; 20509 const itemData = pattern.replace(new RegExp("{data}", "g"), params[i].data) 20510 result += `${params[i].marker} ${params[i].seriesName} <strong>${itemData}</strong></br>`; 20511 } 20512 result = result.length > 0 ? `${result}</p>` : result; 20513 return result; 20514 } 20515 function buildSeriesLabelFormatter(data, index) { 20516 let result = ""; 20517 for (let i = 0; i < seriesLabelData.length; i++) { 20518 const labelData = seriesLabelData[i]; 20519 const categoryIndex = getCategoryIndex(labelData.position[0]); 20520 if (categoryIndex === index && labelData.position[1] === data) { 20521 result = result + `{label${i}|${labelData.text.join("\n")}}`; 20522 } 20523 } 20524 return result; 20525 } 20526 function getCategoryIndex(key) { 20527 let result = -1; 20528 for (var i = 0; i < categoryData.length; i++) { 20529 const category = categoryData[i]; 20530 if (key === category) { 20531 result = i; 20532 } 20533 } 20534 return result; 20535 } 20536 //Labels: Absolute 20537 function buildAbsoluteLabels() { 20538 const result = []; 20539 for (let i = 0; i < absoluteLabelData.length; i++) { 20540 const labelData = absoluteLabelData[i]; 20541 const obj = { 20542 type: 'scatter', 20543 data: [[0, 0]], 20544 symbolSize: 0, 20545 label: { 20546 show: true, 20547 color: labelData.color, 20548 lineHeight: labelData.lineHeight, 20549 fontSize: labelData.fontSize, 20550 opacity: 1, 20551 align: "center", 20552 formatter: labelData.text.join("\n"), 20553 backgroundColor: labelData.backgroundColor, 20554 borderColor: labelData.borderColor, 20555 borderWidth: labelData.borderWidth, 20556 borderRadius: labelData.borderRadius, 20557 padding: labelData.padding, 20558 position: labelData.position, 20559 }, 20560 labelLayout: (params) => { buildLabelLayout(params); }, 20561 xAxisIndex: xAxisIndex, 20562 yAxisIndex: yAxisIndex, 20563 tooltip: { 20564 extraCssText: 'display: none;', 20565 } 20566 }; 20567 result.push(obj); 20568 } 20569 return result; 20570 } 20571 //Option 20572 function hasXAxisPointer() { 20573 let result = 0; 20574 if (getValue("x-axis-pointer-value")) { 20575 result++; 20576 } 20577 if (getValue("x-axis-pointer-snap")) { 20578 result++; 20579 } 20580 if (getValue("x-axis-pointer-color")) { 20581 result++; 20582 } 20583 if (getValue("x-axis-pointer-width")) { 20584 result++; 20585 } 20586 if (getValue("x-axis-pointer-type")) { 20587 result++; 20588 } 20589 if (getValue("x-axis-pointer-opacity")) { 20590 result++; 20591 } 20592 return result === 6; 20593 } 20594 function hasYAxisPointer() { 20595 let result = 0; 20596 if (getValue("y-axis-pointer-value")) { 20597 result++; 20598 } 20599 if (getValue("y-axis-pointer-snap")) { 20600 result++; 20601 } 20602 if (getValue("y-axis-pointer-color")) { 20603 result++; 20604 } 20605 if (getValue("y-axis-pointer-width")) { 20606 result++; 20607 } 20608 if (getValue("y-axis-pointer-type")) { 20609 result++; 20610 } 20611 if (getValue("y-axis-pointer-opacity")) { 20612 result++; 20613 } 20614 return result === 6; 20615 } 20616 function buildOption() { 20617 const result = { 20618 title: { 20619 text: getValue("title-text"), 20620 textStyle: { 20621 color: getValue("title-color"), 20622 } 20623 }, 20624 tooltip: { 20625 trigger: "axis", 20626 formatter: (params) => dataFormatter(params), 20627 }, 20628 legend: { 20629 orient: getValue("legend-orientation"), 20630 left: getValue("legend-left"), 20631 top: getValue("legend-top"), 20632 }, 20633 xAxis: [{ 20634 type: getValue("bottom-x-axis-type"), 20635 }], 20636 yAxis: [ 20637 { 20638 type: getValue("left-y-axis-type"), 20639 }, 20640 ], 20641 }; 20642 /**OPTIONAL Values**/ 20643 //X-Axis Pointer 20644 if (hasXAxisPointer()) { 20645 result.xAxis[0].axisPointer = { 20646 value: getValue("x-axis-pointer-value"), 20647 snap: getValue("x-axis-pointer-snap"), 20648 type: ",solid,dashed,dotted,".indexOf("," + getValue("x-axis-pointer-type") + ",") > -1 ? "line" : getValue("x-axis-pointer-type"), 20649 shadowStyle: { 20650 color: getValue("x-axis-pointer-color"), 20651 width: getValue("x-axis-pointer-width"), 20652 opacity: getValue("x-axis-pointer-opacity"), 20653 }, 20654 lineStyle: { 20655 color: getValue("x-axis-pointer-color"), 20656 width: getValue("x-axis-pointer-width"), 20657 opacity: getValue("x-axis-pointer-opacity"), 20658 type: getValue("x-axis-pointer-type"), 20659 }, 20660 label: { 20661 show: true, 20662 backgroundColor: getValue("x-axis-pointer-color") 20663 }, 20664 handle: { 20665 show: true, 20666 color: getValue("x-axis-pointer-color") 20667 } 20668 }; 20669 } 20670 if (result.xAxis.length && result.xAxis[0].type === 'value') { 20671 result.xAxis[0].axisLabel = { 20672 formatter: (value, index) => { 20673 const pattern = seriesData[0].dataFormat; 20674 return pattern.replace(new RegExp("{data}", "g"), value); 20675 } 20676 } 20677 } 20678 //y-Axis Pointer 20679 if (hasYAxisPointer()) { 20680 result.yAxis[0].axisPointer = { 20681 value: getValue("y-axis-pointer-value"), 20682 snap: getValue("y-axis-pointer-snap"), 20683 type: ["solid", "dashed", "dotted"].includes(getValue("y-axis-pointer-type")) ? "line" : getValue("y-axis-pointer-type"), 20684 shadowStyle: { 20685 color: getValue("y-axis-pointer-color"), 20686 width: getValue("y-axis-pointer-width"), 20687 opacity: getValue("y-axis-pointer-opacity"), 20688 }, 20689 lineStyle: { 20690 color: getValue("y-axis-pointer-color"), 20691 width: getValue("y-axis-pointer-width"), 20692 opacity: getValue("y-axis-pointer-opacity"), 20693 type: getValue("y-axis-pointer-type"), 20694 }, 20695 label: { 20696 show: true, 20697 backgroundColor: getValue("y-axis-pointer-color") 20698 }, 20699 handle: { 20700 show: true, 20701 color: getValue("y-axis-pointer-color") 20702 } 20703 }; 20704 } 20705 if (result.yAxis.length && result.yAxis[0].type === 'value') { 20706 result.yAxis[0].axisLabel = { 20707 formatter: (value, index) => { 20708 const pattern = seriesData[0].dataFormat; 20709 return pattern.replace(new RegExp("{data}", "g"), value); 20710 } 20711 } 20712 } 20713 //Left Y-Axis 20714 if (getValue("left-y-axis-min")) { 20715 result.yAxis[0].min = getValue("left-y-axis-min"); 20716 } 20717 if (getValue("left-y-axis
20717-max")) { 20718 result.yAxis[0].max = getValue("left-y-axis-max"); 20719 } 20720 //Bottom X-Axis 20721 if (getValue("bottom-x-axis-min")) { 20722 result.xAxis[0].min = getValue("bottom-x-axis-min"); 20723 } 20724 if (getValue("left-y-axis-max")) { 20725 result.xAxis[0].max = getValue("bottom-x-axis-max"); 20726 } 20727 //Right Y-Axis 20728 if (getValue("right-y-axis-min") && getValue("right-y-axis-max")) { 20729 if (result.yAxis.length < 2) { 20730 result.yAxis.push({ 20731 type: getValue("right-y-axis-type"), 20732 min: getValue("right-y-axis-min"), 20733 max: getValue("right-y-axis-max"), 20734 }); 20735 } 20736 result.series.push({ 20737 type: "line", 20738 data: [0], 20739 yAxisIndex: 1, 20740 show: false, 20741 }); 20742 } 20743 //Top X-Axis 20744 if (getValue("top-x-axis-min") && getValue("top-x-axis-max")) { 20745 if (result.xAxis.length < 2) { 20746 result.xAxis.push({ 20747 type: getValue("top-x-axis-type"), 20748 min: getValue("top-x-axis-min"), 20749 max: getValue("top-x-axis-max"), 20750 }); 20751 } 20752 result.series.push({ 20753 type: "line", 20754 data: [0], 20755 xAxisIndex: 1, 20756 show: false, 20757 }); 20758 } 20759 if (getValue("left-y-axis-data")) { 20760 result.yAxis[0].data = parseValue("left-y-axis-data"); 20761 } 20762 if (getValue("bottom-x-axis-data")) { 20763 result.xAxis[0].data = parseValue("bottom-x-axis-data"); 20764 } 20765 if (getValue("right-y-axis-data") && result.yAxis.length > 1) { 20766 result.yAxis[1].data = parseValue("right-y-axis-data"); 20767 } 20768 if (getValue("top-x-axis-data") && result.xAxis.length > 1) { 20769 result.xAxis[1].data = parseValue("top-x-axis-data"); 20770 } 20771 //Visual Map Color Range 20772 if (getValue("visual-map-color-range") && getValue("visual-map-color-range-min") && getValue("visual-map-color-range-max")) { 20773 const visualMap = { 20774 show: false, 20775 min: getValue("visual-map-color-range-min"), 20776 max: getValue("visual-map-color-range-max"), 20777 inRange: { 20778 colorLightness: JSON.parse(getValue("visual-map-color-range")), 20779 } 20780 }; 20781 const supportsVisualMap = seriesData.reduce(function (total, item) { 20782 if (item.type !== "pie") { 20783 total = false; 20784 } 20785 return total; 20786 }, true); 20787 if (supportsVisualMap) { 20788 result.visualMap = visualMap; 20789 } 20790 } 20791 //Series 20792 result.series = seriesData.reduce(function (total, item, i) { 20793 const itemData = JSON.parse(item.data); 20794 const newSeries = { 20795 name: item.name, 20796 type: item.type, 20797 label: buildSeriesLabel(), 20798 labelLayout: (params) => { return buildLabelLayout(params); }, 20799 labelLine: { 20800 lineStyle: { 20801 color: getValue('line-style') 20802 } 20803 }, 20804 markPoint: i === 0 && seriesLabelData.length > 0 ? buildMarkPoint(seriesLabelData[0].chartTemplateId === boxWhiskerChartTemplateId) : {}, 20805 itemStyle: { 20806 normal: { 20807 color: item.color, 20808 shadowBlur: 200, 20809 shadowColor: 'rgba(0, 0, 0, 0.5)', 20810 borderWidth: parseInt(getValue('border-width')), 20811 borderColor: getValue('border-color'), 20812 } 20813 },
20814 animationType: 'scale', 20815 animationEasing: 'elasticOut', 20816 animationDelay: function () { 20817 return Math.random() * 200; 20818 }, 20819 data: itemData, 20820 }; 20821 if (item.type === "pie") { 20822 if (item.radius) { 20823 newSeries.radius = item.radius; 20824 } 20825 if (item.selectedMode) { 20826 newSeries.selectedMode = item.selectedMode; 20827 } 20828 if (item.selectedOffset) { 20829 newSeries.selectedOffset = item.selectedOffset; 20830 } 20831 if (item.clockwise) { 20832 newSeries.clockwise = item.clockwise; 20833 } 20834 if (item.top) { 20835 newSeries.top = item.top; 20836 } 20837 if (item.left) { 20838 newSeries.left = item.left; 20839 } 20840 } 20841 if (item.type === "bar" && item.stack) { 20842 newSeries.stack = item.stack; 20843 } 20844 total.push(newSeries); 20845 return total; 20846 }, []); 20847 //Labels: Absolute 20848 if (absoluteLabelData.length > 0) { 20849 result.xAxis.push({ 20850 type: "value", 20851 axisLabel: { show: false }, 20852 axisLine: { show: false }, 20853 splitLine: { show: false }, 20854 axisTick: { show: false }, 20855 min: -1, 20856 max: 1 20857 }); 20858 result.yAxis.push({ 20859 type: "value", 20860 axisLabel: { show: false }, 20861 axisLine: { show: false }, 20862 splitLine: { show: false }, 20863 axisTick: { show: false }, 20864 min: -1, 20865 max: 1 20866 }); 20867 xAxisIndex = result.xAxis.length - 1; 20868 yAxisIndex = result.yAxis.length - 1; 20869 result.series = result.series.concat(buildAbsoluteLabels()); 20870 } 20871 return result; 20872 } 20873 }); 20874 20875})(); 20876 20877; 20878(()=> { 20879 class TombstoneSlider { 20880 constructor(slider) { 20881 this.$slider = $(slider); 20882 this.$slides = this.$slider.find(".tombstone-slider-slides"); 20883 this.$prev = this.$slider.find(".tombstone-slider-previous"); 20884 this.$next = this.$slider.find(".tombstone-slider-next"); 20885 this.$dotsWrap = this.$slider.find(".tombstone-slider-dots"); 20886 20887 this.maxDots = parseInt(this.$slider.find(".tombstone-slider-page-count").val(), 10) || 1; 20888 this.rows = 2; 20889 this.pageSize = parseInt(this.$slider.find(".tombstone-slider-batch-size").val(), 10) || 100; 20890 20891 this.ajaxUrl = this.$slider.find(".tombstone-slider-load-loadMoreAjaxUrl").val(); 20892 20893 this.prez = this.getPresentationDetails(); 20894 20895 this.isFetching = false; 20896 this.exhausted = false; 20897 this.tps = 1; 20898 this.cur = 0; 20899 this.dotStart = 0; 20900 this.initialized = false; 20901 20902 20903 this.source = this.readInitialTombstones(); 20904 20905 this.computeTps(); 20906 this.rebuildAllSlides(); 20907 this.syncDots(); 20908 this.scrollTo(this.cur); 20909 this.bind(); 20910 } 20911 20912 setupResizeObserver() { 20913 if (window.ResizeObserver) { 20914 this.resizeObserver = new ResizeObserver(() => { 20915 const keep = this.cur; 20916 const oldTps = this.tps; 20917 this.computeTps(); 20918 if (this.tps !== oldTps) { 20919 this.rebuildAllSlides(); 20920 this.cur = this.clamp(keep, 0, Math.max(0, this.totalSlides - 1)); 20921 this.scrollTo(this.cur); 20922 this.keepDotWindowInView(); 20923 } 20924 }); 20925 this.resizeObserver.observe(this.$slides[0]); 20926 } 20927 }
20928 getPresentationDetails() { 20929 const g = v => (v && v !== "" ? v : null); 20930 const $r = this.$slider; 20931 const yearRaw = parseInt($r.find(".tombstone-slider-year").val(), 10); 20932 return { 20933 ContextItemId: g($r.find(".tombstone-slider-context-item-id").val()), 20934 SiteContextItemId: g($r.find(".tombstone-slider-site-context-item-id").val()), 20935 Transaction: g($r.find(".tombstone-slider-transaction").val()), 20936 Industry: g($r.find(".tombstone-slider-industry").val()), 20937 Sector: g($r.find(".tombstone-slider-sector").val()), 20938 Year: Number.isInteger(yearRaw) && yearRaw > 0 ? yearRaw : null, 20939 LinksAreActive: $r.find(".tombstone-slider-links-are-active").val() === "true" 20940 }; 20941 } 20942 20943 readInitialTombstones() { 20944 const tmpl = this.$slider.find("template.tombstone-slider-initial-tombstones").get(0); 20945 if (tmpl?.content) { 20946 return Array.from(tmpl.content.querySelectorAll(".tombstone")).map(n => n.cloneNode(true)); 20947 } 20948 return []; 20949 } 20950 20951 get srcCount() { return this.source.length; } 20952 get totalSlides() { return this.$slides.children(".tombstone-slider-slide").length; } 20953 clamp(v, a, b) { return Math.max(a, Math.min(b, v)); } 20954 20955 computeTps() { 20956 const measure = () => { 20957 let $any = this.$slides.find(".tombstone").first(); 20958 if ($any.length) { 20959 return $any.outerWidth(true) || 1; 20960 } 20961 if (this.source.length) { 20962 const $ghost = $(this.source[0]).clone(); 20963 const $sandbox = $("<div>") 20964 .css({ 20965 position: "absolute", 20966 visibility: "hidden", 20967 width: "auto", 20968 height: "auto", 20969 overflow: "hidden", 20970 left: "-99999px", 20971 top: "-99999px" 20972 }) 20973 .append($ghost) 20974 .appendTo("body"); 20975 const w = $ghost.outerWidth(true) || 1; 20976 $sandbox.remove(); 20977 return w; 20978 } 20979 return 1; 20980 }; 20981 const tombW = measure(); 20982 const cols = Math.max(1, Math.floor(this.$slides.innerWidth() / tombW)); 20983 this.tps = Math.max(1, cols * this.rows); 20984 } 20985 20986 buildSlideAt(globalIdx) { 20987 const start = globalIdx * this.tps, end = start + this.tps; 20988 const slice = this.source.slice(start, end); 20989 if (slice.length < this.tps) { 20990 return null; 20991 } 20992 const $s = $('<div class="tombstone-slider-slide"></div>'); 20993 slice.forEach(node => $s.append($(node).clone(true, true))); 20994 return $s; 20995 } 20996 20997 rebuildAllSlides() { 20998 const hadSlides = this.totalSlides > 0; 20999 this.$slides.children(".tombstone-slider-slide").remove(); 21000 21001 const full = Math.floor(this.srcCount / this.tps); 21002 const limit = (this.initialized || hadSlides) ? full : Math.min(full, this.maxDots); 21003 21004 for (let i = 0; i < limit; i++) { 21005 const $s = this.buildSlideAt(i); 21006 if ($s) { 21007 this.$slides.append($s); 21008 } 21009 } 21010 21011 this.cur = this.clamp(this.cur, 0, Math.max(0, this.totalSlides - 1)); 21012 21013 // keep dots sane relative to current total 21014 this.dotStart = this.clamp(this.dotStart, 0, Math.max(0, this.totalSlides - this.maxDots)); 21015 21016 // mark that initial build is done so future rebuilds (e.g., resize) won’t cap 21017 this.initialized = true; 21018 } 21019 21020 appendMissingSlides() { 21021 const start = this.totalSlides; 21022 const full = Math.floor(this.srcCount / this.tps); 21023 const end = Math.min(full, start + this.maxDots); // cap at one page worth 21024 for (let i = start; i < end; i++) { 21025 const $s = this.buildSlideAt(i); 21026 if ($s) { 21027 this.$slides.append($s); 21028 } 21029 } 21030 } 21031 21032 syncDots() { 21033 const total = this.totalSlides; 21034 if (!total) { 21035 this.$dotsWrap.empty(); 21036 return; 21037 } 21038 this.dotStart = this.clamp(this.dotStart, 0, Math.max(0, total - this.maxDots)); 21039 const visible = Math.min(this.maxDots, total - this.dotStart); 21040 const activeLocal = this.clamp(this.cur - this.dotStart, 0, visible - 1); 21041 21042 const frag = document.createDocumentFragment(); 21043 for (let i = 0; i < visible; i++) { 21044 const dot = document.createElement("button"); 21045 dot.type = "button"; 21046 dot.className = "tombstone-slider-dot" + (i === activeLocal ? " active" : ""); 21047 dot.setAttribute("data-dot-index", i); 21048 dot.setAttribute("aria-label", `Go to slide ${i + 1}`); 21049 if (i === activeLocal) { 21050 dot.setAttribute("aria-current", "true"); 21051 } 21052 frag.appendChild(dot); 21053 } 21054 this.$dotsWrap.empty().append(frag); 21055 this.$dotsWrap.off("click").on("click", ".tombstone-slider-dot", e => { 21056 const i = parseInt($(e.currentTarget).data("dot-index"), 10) || 0; 21057 this.cur = this.dotStart + i; 21058 this.scrollTo(this.cur); 21059 this.prefetchIfEnd(); 21060 this.syncDots(); 21061 }); 21062 } 21063 21064 keepDotWindowInView() { 21065 // Simplified: dots are always derived from current slide. 21066 this.syncDots(); 21067 } 21068 21069 scrollTo(globalIdx) { 21070 const el = this.$slides.children(".tombstone-slider-slide").get(globalIdx); 21071 if (!el) { 21072 return; 21073 } 21074 const c = this.$slides.get(0); 21075 if (!c) { 21076 return; 21077 } 21078 if (typeof c.scrollTo === "function") { 21079 c.scrollTo({ left: el.offsetLeft, behavior: "smooth" }); 21080 } else { 21081 c.scrollLeft = el.offsetLeft; 21082 } 21083 } 21084 21085 next() { 21086 const atLastSlide = this.cur >= this.totalSlides - 1; 21087 const atLastDot = this.cur === this.dotStart + this.maxDots - 1; 21088 if (!atLastSlide) { 21089 this.cur++; 21090 this.scrollTo(this.cur); 21091 21092 // wrap dots back to 0 when crossing the last dot 21093 if (atLastDot) { 21094 this.dotStart = this.cur; 21095 } 21096 21097 this.syncDots(); 21098 this.prefetchIfEnd(); 21099 return; 21100 } 21101 21102 // at last slide: still try to prefetch 21103 this.prefetchIfEnd(); 21104 21105 // if not exhausted and we were at last dot, reset dots 21106 if (!this.exhausted && atLastDot) { 21107 this.dotStart = this.cur; 21108 this.syncDots(); 21109 } 21110 } 21111 21112 prev() { 21113 const atFirstSlide = this.cur <= 0; 21114 const atFirstDot = this.cur === this.dotStart; 21115 21116 if (!atFirstSlide) { 21117 this.cur--; 21118 21119 // wrap dots to the last dot when crossing the first dot 21120 if (atFirstDot) { 21121 this.dotStart = Math.max(0, this.cur - (this.maxDots - 1)); 21122 } 21123 21124 this.scrollTo(this.cur); 21125 this.syncDots(); 21126 } 21127 } 21128 21129 prefetchIfEnd() {
21130 if (this.isFetching || this.exhausted) { 21131 return; 21132 } 21133 const lastIdx = this.totalSlides - 1; 21134 if (lastIdx >= 0 && this.cur >= lastIdx) { 21135 this.fetchNextBatch(); 21136 } 21137 } 21138 21139 fetchNextBatch() { 21140 if (!this.ajaxUrl) { 21141 this.exhausted = true; 21142 return Promise.resolve(false); 21143 } 21144 if (this.exhausted) { 21145 return Promise.resolve(false); 21146 } 21147 if (this.prefetchPromise) { 21148 return this.prefetchPromise; 21149 } 21150 21151 const renderedTombstones = this.totalSlides * this.tps; 21152 const nextSetSize = this.tps * this.maxDots; 21153 const nextBoundary = renderedTombstones + nextSetSize; 21154 if (this.srcCount >= nextBoundary) { 21155 this.appendMissingSlides(); 21156 this.syncDots(); 21157 return Promise.resolve(true); 21158 } 21159 21160 const prevTotalSrc = this.srcCount; 21161 const pageIndex = Math.floor(prevTotalSrc / this.pageSize); 21162 const payload = this.makePayload(pageIndex, this.pageSize); 21163 21164 this.isFetching = true; 21165 21166 const jq = $.get(this.ajaxUrl, payload); 21167 this.prefetchPromise = jq.then(html => { 21168 const $tmp = $("<div>").html(html); 21169 const $new = $tmp.find(".tombstone"); 21170 if ($new.length) { 21171 $new.each((_, t) => this.source.push(t)); 21172 this.appendMissingSlides(); 21173 this.syncDots(); 21174 return true; 21175 } else { 21176 this.exhausted = true; 21177 return false; 21178 } 21179 }).always(() => { 21180 this.isFetching = false; 21181 this.prefetchPromise = null; 21182 21183 if (this.pendingNav) { 21184 const nav = this.pendingNav; 21185 this.pendingNav = null; 21186 if (nav === 'next') { 21187 this.next(); 21188 } else { 21189 this.prev(); 21190 } 21191 } 21192 }); 21193 21194 return this.prefetchPromise; 21195 } 21196 21197 makePayload(pageIndex, pageSize) { 21198 const p = this.prez; 21199 const obj = { 21200 ContextItemId: p.ContextItemId, 21201 SiteContextItemId: p.SiteContextItemId, 21202 StartNumber: pageIndex, 21203 NumberToFetch: pageSize, 21204 Transaction: p.Transaction, 21205 Industry: p.Industry, 21206 Sector: p.Sector, 21207 Year: p.Year, 21208 LinksAreActive: p.LinksAreActive 21209 }; 21210 Object.keys(obj).forEach(k => (obj[k] === null || obj[k] === undefined) && delete obj[k]); 21211 return obj; 21212 } 21213 21214 destroy() { 21215 this.$next.off("click"); 21216 this.$prev.off("click"); 21217 this.$dotsWrap.off("click"); 21218 this.$slides.off("swipeleft swiperight touchstart touchend"); 21219 if (this.resizeObserver) { 21220 this.resizeObserver.disconnect(); 21221 this.resizeObserver = null; 21222 } 21223 } 21224 bind() { 21225 this.$next.on("click", () => this.next()); 21226 this.$prev.on("click", () => this.prev()); 21227 this.$slides.on("swipeleft", () => this.next()); 21228 this.$slides.on("swiperight", () => this.prev()); 21229 this.$slides.on("touchstart", e => { 21230 this._touchStartX = e.originalEvent.touches[0].clientX; 21231 }); 21232 this.$slides.on("touchend", e => { 21233 const endX = e.originalEvent.changedTouches[0].clientX; 21234 if (this._touchStartX - endX > 40) { 21235 this.next(); 21236 } 21237 if (endX - this._touchStartX > 40) { 21238 this.prev(); 21239 } 21240 }); 21241 21242 this.setupResizeObserver(); 21243 } 21244 } 21245 21246 $(".tombstone-slider").each((_i, el) => { 21247 const $el = $(el); 21248 if (!$el.data("tsInstance")) { 21249 $el.data("tsInstance", new TombstoneSlider($el)); 21250 } 21251 });
21252})(); 21253; 21254(() => { 21255 class TombstoneLazyLoad { 21256 constructor(lazyLoadElem) { 21257 this.$root = $(lazyLoadElem); 21258 this.$tombstonesContainer = this.$root.find(".tombstone-lazy-load-tombstones"); 21259 this.$loadMore = this.$root.find(".tombstone-lazy-load-load-more"); 21260 this.$transactionFilter = this.$root.find(".tombstone-lazy-load-filter-transaction"); 21261 this.$industryFilter = this.$root.find(".tombstone-lazy-load-filter-industry"); 21262 this.$sectorFilter = this.$root.find(".tombstone-lazy-load-filter-sector"); 21263 this.$yearFilter = this.$root.find(".tombstone-lazy-load-filter-year"); 21264 this.$companyNameFilter = this.$root.find(".tombstone-lazy-load-filter-company-name"); 21265 this.$idFilter = this.$root.find(".tombstone-lazy-load-filter-id"); 21266 this.$searchTermFilter = this.$root.find(".tombstone-lazy-load-filter-search-term"); 21267 21268 this.loadMoreUrl = this.$root.find(".tombstone-lazy-load-loadMoreAjaxUrl").val();
21269 this.getSectorItemsByIndustryIdAjaxUrl = this.$root.find(".tombstone-lazy-load-getSectorItemsByIndustryIdAjaxUrl").val(); 21270 this.contextItemId = this.$root.find(".contextItemId").val(); 21271 this.siteContextItemId = this.$root.find(".siteContextItemId").val(); 21272 this.loadMoreCount = parseInt(this.$root.find(".tombstone-lazy-load-load-more-count").val(), 10) || 10; 21273 this.initialLoadCount = parseInt(this.$root.find(".tombstone-lazy-load-initial-load-count").val(), 10) || 10; 21274 this.linksAreActive = (this.$root.find(".tombstone-lazy-load-links-are-active").val() || "").toLowerCase() === "true"; 21275 21276 this.onLoadMoreClick = this.onLoadMoreClick.bind(this); 21277 this.onFilterChange = this.onFilterChange.bind(this); 21278 this.onIndustryChange = this.onIndustryChange.bind(this); 21279 21280 this.currentPageIndex = 0; 21281 this.pendingPageIndex = null; 21282 21283 this.applyQueryStringOverrides().always(() => { 21284 this.bindEvents(); 21285 this.onFilterChange(); 21286 }); 21287 } 21288 21289 bindEvents() { 21290 const ns = ".tombstone-lazy-load"; 21291 21292 this.$loadMore.off(`click${ns}`).on(`click${ns}`, this.onLoadMoreClick); 21293 21294 this.$transactionFilter.off(`change${ns}`).on(`change${ns}`, this.onFilterChange); 21295 this.$industryFilter.off(`change${ns}`).on(`change${ns}`, this.onIndustryChange); 21296 this.$sectorFilter.off(`change${ns}`).on(`change${ns}`, this.onFilterChange); 21297 this.$yearFilter.off(`change${ns}`).on(`change${ns}`, this.onFilterChange); 21298 21299 if (!this.debouncedFilterChange) { 21300 this.debouncedFilterChange = this.debounce(this.onFilterChange, 200).bind(this); 21301 } 21302 this.$companyNameFilter.off(`input${ns}`).on(`input${ns}`, this.debouncedFilterChange); 21303 21304 this.$idFilter.off(`change${ns}`).on(`change${ns}`, this.onFilterChange); 21305 21306 if (this.$searchTermFilter?.length) { 21307 this.$searchTermFilter.off(`input${ns}`).on(`input${ns}`, this.debouncedFilterChange); 21308 } 21309 } 21310 21311 getQueryParam(name) { 21312 const params = new URLSearchParams(window.location.search); 21313 const target = String(name || "").toLowerCase(); 21314 for (const [key, value] of params.entries()) { 21315 if (key.toLowerCase() === target) { 21316 return value; 21317 } 21318 } 21319 return null; 21320 } 21321 21322 setIfProvided($el, value) { 21323 if (!$el?.length || value == null) { 21324 return; 21325 } 21326 21327 const target = String(value).trim().toLowerCase(); 21328 const el = $el[0]; 21329 const match = [...el.options].find((opt) => { 21330 return opt.text.trim().toLowerCase() === target; 21331 }); 21332 21333 if (match) { 21334 $el.val(match.value); 21335 } 21336 } 21337 21338 applyQueryStringOverrides() { 21339 const transactionQS = this.getQueryParam("transaction"); 21340 const industryQS = this.getQueryParam("industry"); 21341 const sectorQS = this.getQueryParam("sector"); 21342 this.setIfProvided(this.$transactionFilter, transactionQS); 21343 if (industryQS != null) { 21344 this.setIfProvided(this.$industryFilter, industryQS); 21345 return this.updateSectorsByIndustry().always(() => { 21346 this.setIfProvided(this.$sectorFilter, sectorQS); 21347 }); 21348 } else { 21349 this.setIfProvided(this.$sectorFilter, sectorQS); 21350 return $.Deferred().resolve().promise(); 21351 } 21352 } 21353 21354 onIndustryChange() { 21355 this.updateSectorsByIndustry().always(() => { 21356 this.onFilterChange(); 21357 }); 21358 } 21359 21360 updateSectorsByIndustry() { 21361 const filterData = this.getIndustryFilterData(); 21362 return $.ajax({ 21363 type: "GET",
21364 url: this.getSectorItemsByIndustryIdAjaxUrl, 21365 cache: false, 21366 data: filterData 21367 }).done((html) => { 21368 this.$sectorFilter.html(html); 21369 }); 21370 } 21371 21372 onFilterChange() { 21373 this.$tombstonesContainer.attr("aria-busy", "true").empty(); 21374 this.$root.find(".no-more-tombstones").remove(); 21375 this.$loadMore.prop("disabled", true).removeClass("no-more-episodes"); 21376 21377 this.currentPageIndex = 0; 21378 this.pendingPageIndex = null; 21379 21380 const data = this.getFilterData({ isInitial: true }); 21381 21382 if (this._xhr && this._xhr.readyState !== 4) { this._xhr.abort(); } 21383 21384 this._xhr = $.ajax({ 21385 type: "GET", 21386 url: this.loadMoreUrl, 21387 cache: false, 21388 data 21389 }).done((html) => { 21390 this.currentPageIndex = 0; 21391 this.pendingPageIndex = null; 21392 21393 this.$tombstonesContainer.append(html); 21394 if (this.$root.find(".no-more-tombstones").length > 0) { 21395 this.$loadMore.addClass("no-more-episodes"); 21396 } 21397 }).fail(() => { 21398 this.pendingPageIndex = null; 21399 this.$tombstonesContainer.append('<div class="tombstone-error">Unable to load items.</div>'); 21400 }).always(() => { 21401 this.$tombstonesContainer.removeAttr("aria-busy"); 21402 this.$loadMore.prop("disabled", false); 21403 }); 21404 } 21405 21406 onLoadMoreClick() { 21407 if (this._xhr && this._xhr.readyState !== 4) { this._xhr.abort(); } 21408 this.$loadMore.prop("disabled", true); 21409 21410 const data = this.getFilterData({ isInitial: false }); 21411 21412 this._xhr = $.ajax({ 21413 type: "GET", 21414 url: this.loadMoreUrl, 21415 cache: false, 21416 data 21417 }).done((html) => { 21418 this.currentPageIndex += 1;
21419 this.pendingPageIndex = null; 21420 21421 const $oldTombstones = this.$tombstonesContainer.find(".tombstone"); 21422 $oldTombstones.addClass("loaded-tombstone"); 21423 21424 this.$tombstonesContainer.append(html); 21425 21426 if (this.$root.find(".no-more-tombstones").length > 0) { 21427 this.$loadMore.addClass("no-more-episodes"); 21428 } 21429 21430 const $newTombstones = this.$tombstonesContainer.find(".tombstone:not(.loaded-tombstone)"); 21431 if (typeof window.initializeTombstones === "function") { 21432 window.initializeTombstones($newTombstones); 21433 } 21434 21435 $oldTombstones.removeClass("loaded-tombstone"); 21436 }).fail(() => { 21437 this.pendingPageIndex = null; 21438 this.$tombstonesContainer.append('<div class="tombstone-error">Unable to load more items.</div>'); 21439 }).always(() => { 21440 this.$loadMore.prop("disabled", false); 21441 }); 21442 } 21443 21444 getIndustryFilterData() { 21445 const el = this.$industryFilter[0]; 21446 const opt = el && el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null; 21447 const id = opt ? opt.value : null; 21448 21449 return { 21450 contextItemId: this.contextItemId, 21451 siteContextItemId: this.siteContextItemId, 21452 IndustryId: id || this.$root.find(".tombstone-lazy-load-industry").val() 21453 }; 21454 } 21455 21456 getFilterData({ isInitial }) { 21457 if (this.pendingPageIndex == null) { 21458 this.pendingPageIndex = this.currentPageIndex; 21459 } 21460 21461 const transaction = this.$transactionFilter.val(); 21462 const industry = this.$industryFilter.val(); 21463 const sector = this.$sectorFilter.val(); 21464 const year = this.$yearFilter.val(); 21465 const companyName = this.$companyNameFilter.val(); 21466 const id = this.$idFilter.val(); 21467 21468 const searchTerm = 21469 (this.$searchTermFilter?.length ? this.$searchTermFilter.val() : null) || 21470 this.$root.find(".tombstone-lazy-load-search-term").val() || 21471 ""; 21472 21473 const numberToSkip = isInitial ? 0 : this.initialLoadCount; 21474 const pageSize = isInitial ? this.initialLoadCount : this.loadMoreCount; 21475 const pageIndex = isInitial ? 0 : this.pendingPageIndex; 21476 21477 return { 21478 ContextItemId: this.contextItemId, 21479 SiteContextItemId: this.siteContextItemId, 21480 21481 NumberToSkip: numberToSkip, 21482 PageSize: pageSize, 21483 PageIndex: pageIndex, 21484 21485 Transaction: !transaction ? this.$root.find(".tombstone-lazy-load-transaction").val() : transaction, 21486 Industry: !industry ? this.$root.find(".tombstone-lazy-load-industry").val() : industry, 21487 Sector: !sector ? this.$root.find(".tombstone-lazy-load-sector").val() : sector, 21488 Year: !year ? this.$root.find(".tombstone-lazy-load-year").val() : year, 21489 CompanyName: companyName, 21490 Id: id, 21491 21492 SearchTerm: searchTerm, 21493 21494 LinksAreActive: this.linksAreActive 21495 }; 21496 } 21497 21498 destroy() { 21499 const ns = ".tombstone-lazy-load"; 21500 21501 if (this._xhr && this._xhr.readyState !== 4) { this._xhr.abort(); } 21502 21503 this.$loadMore.off(ns); 21504 this.$transactionFilter.off(ns); 21505 this.$industryFilter.off(ns); 21506 this.$sectorFilter.off(ns); 21507 this.$yearFilter.off(ns); 21508 this.$companyNameFilter.off(ns); 21509 this.$idFilter.off(ns); 21510 21511 if (this.$searchTermFilter?.length) { 21512 this.$searchTermFilter.off(ns); 21513 } 21514 21515 this.$root.removeData("tombstoneLazyLoad"); 21516 } 21517 21518 debounce(fn, ms) { 21519 let t; 21520 return function (...args) { 21521 if (t) { clearTimeout(t); } 21522 t = setTimeout(() => fn.apply(this, args), ms); 21523 }; 21524 } 21525 } 21526 21527 $(".tombstone-lazy-load").each(function (_i, elem) { 21528 $(elem).data("tombstoneLazyLoad", new TombstoneLazyLoad(elem)); 21529 });
21530})(); 21531; 21532$(function() { 21533 const $tombstones = $(".tombstone"); 21534 if (!$tombstones.length) { 21535 return; 21536 } 21537 21538 initializeTombstones($tombstones); 21539}); 21540 21541function initializeTombstones($t) { 21542 const $tombstones = $t; 21543 const $closeBtns = $tombstones.find(".tombstone-close-button"); 21544 21545 $tombstones.on("click", tombstoneClickEvent); 21546 $closeBtns.on("click", tombstoneCloseEvent); 21547 21548 function tombstoneClickEvent(e) { 21549 const $target = $(e.target); 21550 const $link = $target.closest(".tombstone-link"); 21551 if ($link.length) { 21552 return; 21553 } 21554 21555 const $tombstone = $target.closest(".tombstone"); 21556 unclickAlltombstones($tombstone); 21557 $tombstone.addClass("tombstone-clicked"); 21558 } 21559 function tombstoneCloseEvent(e) { 21560 e.stopPropagation(); 21561 const $this = $(this); 21562 const $tombstone = $this.closest(".tombstone"); 21563 $tombstone.removeClass("tombstone-clicked"); 21564 } 21565 function unclickAlltombstones($tombstone) { 21566 const container = $tombstone.parent(); 21567 const $tombstones = $(container).find(".tombstone"); 21568 $tombstones.removeClass("tombstone-clicked"); 21569 } 21570}; 21571(function ($) { 21572 $(function () { 21573 var filter, 21574 $win = $(window), 21575 winWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0), 21576 filterYear, 21577 filterMonth, 21578 filterCategory = [], 21579 filterTopic = [], 21580 filterMedia = [], 21581 filterPagesize = 10, 21582 filterPagenumber = 0, 21583 filterTotalPages; 21584 21585 21586 // intial load ajax call 21587 if ($('#listpage')[0]) { 21588 runAjax(); 21589 } 21590 21591 $('.filters-cont').addClass('open'); 21592 if (winWidth <= 992) { 21593 $('.category-list > li').removeClass('open').addClass('closed'); 21594 } 21595 21596 // if we are going to pass url parameters we need to check and highligt selected topics 21597 21598 function truncateList() { 21599 $('#listpage .topic-list').each(function () { 21600 var children = $(this).children('li').length; 21601 var listName = $(this).attr('data-filter'); 21602 $(this).siblings('a.btn-tl-more,a.btn-tl-less').addClass('hidden'); 21603 if (children === 0) { 21604 $(this).parent().addClass('hidden'); 21605 } else if (listName === 'Year' && filterYear != null) { 21606 $(this).parent().addClass('hidden'); 21607 } else if (listName === 'Month' && filterMonth != null) { 21608 $(this).parent().addClass('hidden'); 21609 } else if (children > 5) { 21610 $(this).siblings('a.btn-tl-more').removeClass('hidden'); 21611 $(this).siblings('a.btn-tl-less').addClass('hidden'); 21612 $(this).children('li').each(function (i) { 21613 if (i > 4) { 21614 $(this).addClass('hidden grt-five'); 21615 } 21616 }); 21617 } else { 21618 $(this).parent().removeClass('hidden'); 21619 } 21620 addSelected(listName); 21621 }); 21622 } 21623 21624 // mobile open/close filters 21625 $('.mobile-arrow').click(function () { 21626 $('.filters-cont').toggleClass('open'); 21627 }); 21628 21629 $('#listpage .btn-tl-more').click(function (e) { 21630 e.preventDefault(); 21631 $(this).siblings().children('.grt-five').removeClass('hidden'); 21632 $(this).siblings('.btn-tl-less').removeClass('hidden'); 21633 $(this).addClass('hidden'); 21634 }); 21635 21636 $('#listpage .btn-tl-less').click(function (e) { 21637 e.preventDefault(); 21638 $(this).siblings().children('.grt-five').addClass('hidden'); 21639 $(this).siblings('.btn-tl-more').removeClass('hidden'); 21640 $(this).addClass('hidden'); 21641 }); 21642 21643 $('#listpage .category-list a[data-category]').click(function (e) { 21644 e.preventDefault(); 21645 var $this = $(this); 21646 if ($this.parent().hasClass('open')) { 21647 $this.parent().removeClass('open'); 21648 $this.parent().addClass('closed'); 21649 } else { 21650 $this.parent().addClass('open'); 21651 $this.parent().removeClass('closed'); 21652 } 21653 }); 21654 // need to edit this 21655 $('body').on('click', '#listpage .topic-list a[data-topic]', function (e) { 21656 e.preventDefault(); 21657 21658 var $this = $(this), 21659 topicSlug = $this.attr('data-topic'), 21660 topicName = $this.html(), 21661 isToggled = $this.hasClass('selected'), 21662 topicFilter = $this.closest('ul').attr('data-filter'); 21663 21664 if (isToggled === true) { 21665 $this.removeClass('selected'); 21666 $('.fbcs-list').children('a[data-topic="' + topicSlug + '"]').remove(); 21667 if (topicFilter === 'Category') {
21668 topicFilter = filterCategory; 21669 } else if (topicFilter === 'Topic') { 21670 topicFilter = filterTopic; 21671 } else if (topicFilter === 'Media') { 21672 topicFilter = filterMedia; 21673 } 21674 removeFromArray(topicFilter, topicSlug); 21675 } else { 21676 $this.addClass('selected'); 21677 $('.fbcs-list').append('<a href="null" data-topic="' + topicSlug + '" data-filter="' + topicFilter + '">' + topicName + '<span>x</span></a>'); 21678 21679 if (topicFilter === 'Year') { 21680 filterYear = topicSlug; 21681 } else if (topicFilter === 'Month') { 21682 filterMonth = topicSlug; 21683 } else if (topicFilter === 'Category') { 21684 filterCategory.push(topicSlug); 21685 } else if (topicFilter === 'Topic') { 21686 filterTopic.push(topicSlug); 21687 } else if (topicFilter === 'Media') { 21688 filterMedia.push(topicSlug); 21689 } 21690 } 21691 21692 21693 // run filter ajax code or reload the page with the selected topic 21694 filterPagenumber = 0; 21695 runAjax(); 21696 clearFiter(); 21697 }); 21698 21699 $('#listpage .btn-reset-filter').click(function (e) { 21700 e.preventDefault(); 21701 $('.topic-list a[data-topic]').removeClass('selected'); 21702 $('.fbcs-list').empty(); 21703 $(this).addClass('hidden'); 21704 21705 // clear all filters 21706 filterYear = null; 21707 filterMonth = null; 21708 filterCategory = []; 21709 filterTopic = []; 21710 filterMedia = []; 21711 filterPagenumber = 0; 21712 21713 // run filter ajax code or reload the page with everything 21714 runAjax(); 21715 }); 21716 21717 $('body').on('click', '#listpage .fbcs-list a', function (e) { 21718 e.preventDefault(); 21719 var fbtopicSlug = $(this).attr('data-topic'); 21720 var fbfilterSlug = $(this).attr('data-filter'); 21721 $('.topic-list a[data-topic="' + fbtopicSlug + '"]').removeClass('selected'); 21722 $(this).remove(); 21723 if (fbfilterSlug === 'Year') { 21724 filterYear = null; 21725 } else if (fbfilterSlug === 'Month') { 21726 filterMonth = null; 21727 } else if (fbfilterSlug === 'Category') { 21728 removeFromArray(filterCategory, fbtopicSlug); 21729 } else if (fbfilterSlug === 'Topic') { 21730 removeFromArray(filterTopic, fbtopicSlug); 21731 } else if (fbfilterSlug === 'Media') { 21732 removeFromArray(filterMedia, fbtopicSlug); 21733 } 21734 clearFiter(); 21735 21736 // run filter ajax code or reload the page to remove the topic close 21737 filterPagenumber = 0; 21738 runAjax(); 21739 }); 21740 21741 21742 $('body').on('click', '#listpage .list-index-nav a', function (e) { 21743 e.preventDefault(); 21744 var $this = $(this); 21745 if ($this.hasClass('first')) { 21746 filterPagenumber = 0; 21747 } else if ($this.hasClass('prev')) { 21748 filterPagenumber = filterPagenumber - 1; 21749 } else if ($this.hasClass('next')) { 21750 filterPagenumber = filterPagenumber + 1; 21751 } else if ($this.hasClass('last')) { 21752 filterPagenumber = filterTotalPages - 1; 21753 } 21754 runAjax(); 21755 }); 21756 21757 function clearFiter() { 21758 var $filterBtn = $('.btn-reset-filter'), 21759 filterCount = $('.fbcs-list a').length; 21760 if (filterCount === 0) { 21761 $filterBtn.addClass('hidden'); 21762 } else { 21763 $filterBtn.removeClass('hidden'); 21764 } 21765 } 21766 21767 function addSelected(listName) { 21768 21769 if (listName === 'Category') { 21770 $('#listpage .topic-list[data-filter="Category"] li a').each(function () { 21771 var tlA = $(this).attr('data-topic'); 21772 if (filterCategory.indexOf(tlA) > -1) { 21773 $(this).addClass('selected'); 21774 } 21775 }); 21776 } else if (listName === 'Topic') { 21777 $('#listpage .topic-list[data-filter="Topic"] li a').each(function () { 21778 var tlA = $(this).attr('data-topic'); 21779 if (filterTopic.indexOf(tlA) > -1) { 21780 $(this).addClass('selected'); 21781 } 21782 }); 21783 } else if (listName === 'Media') { 21784 $('#listpage .topic-list[data-filter="Media"] li a').each(function () { 21785 var tlA = $(this).attr('data-topic'); 21786 if (filterMedia.indexOf(tlA) > -1) { 21787 $(this).addClass('selected'); 21788 } 21789 }); 21790 } 21791 21792 } 21793 21794 function removeFromArray(filter, slug) { 21795 var index = filter.indexOf(slug); 21796 if (index > -1) { 21797 filter.splice(index, 1); 21798 } 21799 } 21800 21801 // on resize events 21802 $win.resize(function () { 21803 winWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 21804 21805 $('.filters-cont').addClass('open'); 21806 21807 if (winWidth <= 992) { 21808 $('.category-list > li').removeClass('open').addClass('closed'); 21809 } 21810 21811 }); 21812 21813 21814 // load initial results
21815 function runAjax() { 21816 $('#listpage .topic-list').each(function () { 21817 $(this).parent().removeClass('hidden'); 21818 $(this).html(''); 21819 }); 21820 $('#listpage .results').html(''); 21821 $.ajax({ 21822 url: "/dotcom/Api/ListPage", 21823 type: 'GET', 21824 data: { 21825 "year": filterYear, 21826 "month": filterMonth, 21827 "categories": filterCategory, 21828 "topics": filterTopic, 21829 "mediatypes": filterMedia, 21830 "pagesize": filterPagesize, 21831 "pagenumber": filterPagenumber 21832 }, 21833 traditional: true, 21834 error: function (xhr, status, error) { 21835 console.error(xhr.responseText); 21836 }, 21837 dataType: 'json', 21838 success: function (data) { 21839 21840 var showPosts = data.Results; 21841 21842 totalPages = Math.ceil(data.TotalResults / filterPagesize); 21843 21844 // Pagination hide show 21845 $('.list-index-nav').show(); 21846 if (totalPages === 1) { 21847 $('.list-index-nav').hide(); 21848 } else if (filterPagenumber === 0 && totalPages === 2) { 21849 $('.result-nav.first, .result-nav.prev, .result-nav.last').addClass('noshow'); 21850 $('.result-nav.next').removeClass('noshow'); 21851 } else if (filterPagenumber === 0 && totalPages > 2) { 21852 $('.result-nav.first, .result-nav.prev').addClass('noshow'); 21853 $('.result-nav.next, .result-nav.last').removeClass('noshow'); 21854 } else if (filterPagenumber > 0 && filterPagenumber !== totalPages - 1) { 21855 $('.result-nav.first, .result-nav.prev, .result-nav.last, .result-nav.next').removeClass('noshow'); 21856 } else if (filterPagenumber === totalPages - 1 && totalPages !== 2) { 21857 $('.result-nav.last, .result-nav.next').addClass('noshow'); 21858 $('.result-nav.first, .result-nav.prev').removeClass('noshow'); 21859 } else if (filterPagenumber === totalPages - 1 && totalPages === 2) { 21860 $('.result-nav.next, .result-nav.last, .result-nav.first').addClass('noshow'); 21861 $('.result-nav.prev').removeClass('noshow'); 21862 } else { 21863 $('.result-nav.first, .result-nav.prev, .result-nav.last, .result-nav-next').removeClass('noshow'); 21864 } 21865 21866 21867 21868 21869 $.each(data.Filters.Years, function (i, item) { 21870 $('.topic-list[data-filter="Year"]').append('<li><a href="null" data-topic="' + item.Value + '">' + item.Display + '</a></li>'); 21871 }); 21872 $.each(data.Filters.Months, function (i, item) { 21873 $('.topic-list[data-filter="Month"]').append('<li><a href="null" data-topic="' + item.Value + '">' + item.Display + '</a></li>'); 21874 }); 21875 $.each(data.Filters.Categories, function (i, item) { 21876 $('.topic-list[data-filter="Category"]').append('<li><a href="null" data-topic="' + item.Value + '">' + item.Display + '</a></li>'); 21877 }); 21878 $.each(data.Filters.Topics, function (i, item) { 21879 $('.topic-list[data-filter="Topic"]').append('<li><a href="null" data-topic="' + item.Value + '">' + item.Display + '</a></li>'); 21880 }); 21881 $.each(data.Filters.MediaTypes, function (i, item) { 21882 $('.topic-list[data-filter="Media"]').append('<li><a href="null" data-topic="' + item.Value + '">' + item.Display + '</a></li>'); 21883 }); 21884 truncateList(); 21885 $.each(showPosts, function (i, item) { 21886 var resultEl = '<div class="list-item clearfix">'; 21887 resultEl += '<a href="' + item.ArticleUrl + '" target="' + item.ArticleUrlTarget + '">'; 21888 if (item.ImageUrl !== null) { 21889 resultEl += '<div class="list-item-image"><img src="' + item.ImageUrl + '" alt="Placeholder" /></div>'; 21890 resultEl += '<div class="list-item-body with-image">'; 21891 } else { 21892 resultEl += '<div class="list-item-body">'; 21893 }; 21894 resultEl += '<div class="list-item-title">' + item.Headline + '</div>'; 21895 if (item.Category !== '') { 21896 resultEl += '<div class="list-item-cat">' + item.Category + ' | ' + item.PostDate + '</div>'; 21897 } else { 21898 if (item.PostDate && item.PostDate !== 'null') { 21899 resultEl += '<div class="list-item-cat">' + postDate + '</div>'; 21900 } 21901 } 21902 if (item.Copy !== '') { 21903 resultEl += '<div class="list-item-content">' + item.Copy + '</div>'; 21904 resultEl += '</div>'; 21905 resultEl += '<div class="clearfix"></div>'; 21906 resultEl += '<div class="list-item-more">Continue Reading</div>'; 21907 } 21908 resultEl += '</a>'; 21909 resultEl += '</div>'; 21910 $('.results').append(resultEl); 21911 $('span.list-index-current-pg').text(filterPagenumber + 1); 21912 $('span.list-index-total-pg').text(totalPages); 21913 filterTotalPages = totalPages; 21914 21915 }); 21916 } 21917 21918 }); 21919 } 21920 });
21921})(window.jQuery);; 21922(function () { 21923 const $clientAccess = $(".client-access-on-page"); 21924 if (!$clientAccess.length) { 21925 return; 21926 } 21927 21928 const $showBtn = $clientAccess.find(".client-access-on-page-password-show"); 21929 21930 $showBtn.click((e) => { 21931 const $target = $(e.target); 21932 const $parent = $target.parent(); 21933 const $password = $parent.find(".client-access-on-page-variable-parameter-2"); 21934 const type = $password.attr("type"); 21935 const newType = type === "password" ? "text" : "password"; 21936 const html = type === "password" ? "hide" : "show"; 21937 $password.attr("type", newType); 21938 $target.html(html); 21939 }); 21940})();; 21941(() => { 21942 const COOKIECONSENT = 'cookieConsent'; 21943 21944 const cookiePreferences = document.querySelector('.cookie-preferences'); 21945 21946 if (!cookiePreferences) { 21947 return; 21948 } 21949 21950 const functional = cookiePreferences.querySelector('[data-cookie-type="functional"]'); 21951 const marketing = cookiePreferences.querySelector('[data-cookie-type="marketing"]'); 21952 21953 functional.addEventListener('click', function handleFunctional() { 21954 handleClick(this, 'analytics_storage'); 21955 }); 21956 21957 marketing.addEventListener('click', function handleMarketing() { 21958 handleClick(this, 'ad_storage'); 21959 }); 21960 21961 document.body.addEventListener('cookie-consent-banner-set', setPreferences); 21962 handleLoad(); 21963 21964 function setPreferences() { 21965 const cookie = getCookie(COOKIECONSENT); 21966 21967 if (!cookie) { 21968 return; 21969 } 21970 21971 const { ad_storage, analytics_storage } = JSON.parse(cookie); 21972 setChecked(functional, ad_storage); 21973 setChecked(marketing, analytics_storage); 21974 } 21975 21976 function setChecked(el, storageType) { 21977 el.checked = storageType === 'granted' ? true : false; 21978 } 21979 21980 function handleClick(el, storageType) { 21981 const isChecked = el.checked; 21982 const consentState = isChecked ? 'granted' : 'denied'; 21983 21984 el.className = ''; 21985 el.classList.add(`${el.id}-${consentState}`); 21986 21987 el.parentNode.setAttribute('data-toggle-state', isChecked ? 'checked' : 'unchecked'); 21988 21989 if (typeof gtag === 'function') { 21990 gtag('consent', 'update', { 21991 [storageType]: consentState 21992 }); 21993 } 21994 21995 if (!getCookie(COOKIECONSENT)) { 21996 setCookie(COOKIECONSENT, JSON.stringify({ [storageType]: consentState })); 21997 return; 21998 } 21999 22000 let preferences = JSON.parse(getCookie(COOKIECONSENT)); 22001 22002 preferences[storageType] = consentState; 22003 22004 setCookie(COOKIECONSENT, JSON.stringify(preferences)); 22005 } 22006 22007 function handleLoad() { 22008 const cookieData = getCookie(COOKIECONSENT); 22009 if (!cookieData) return; 22010 22011 let preferences; 22012 try { 22013 preferences = JSON.parse(cookieData); 22014 } catch { 22015 return; 22016 } 22017 22018 if (Object.prototype.hasOwnProperty.call(preferences, "analytics_storage")) { 22019 setToggle("functional", preferences.analytics_storage === "granted"); 22020 } 22021 22022 if (Object.prototype.hasOwnProperty.call(preferences, "ad_storage")) { 22023 setToggle("marketing", preferences.ad_storage === "granted"); 22024 } 22025 } 22026 22027 function setToggle(key, val) { 22028 const checkbox = document.getElementById(`${key}-cookies-checkbox`); 22029 const toggle = checkbox.parentNode; 22030 22031 if (val) { 22032 toggle.setAttribute("data-toggle-state", "checked"); 22033 checkbox.classList.add(`${key}-cookies-checkbox-granted`); 22034 checkbox.checked = true; 22035 } else { 22036 toggle.setAttribute("data-toggle-state", "unchecked"); 22037 checkbox.classList.add(`${key}-cookies-checkbox-denied`); 22038 checkbox.checked = false; 22039 } 22040 } 22041 function setCookie(name, value, expireMonths = 6) { 22042 const expirationDate = new Date(); 22043 expirationDate.setMonth(expirationDate.getMonth() + expireMonths); 22044 const expiresUTC = expirationDate.toUTCString(); 22045 document.cookie = `${name}=${value}; expires=${expiresUTC}; path=/`; 22046 } 22047 22048 function getCookie(cookieName) { 22049 const name = cookieName + "="; 22050 const cookiesDecoded = decodeURIComponent(document.cookie); 22051 const cookiesArr = cookiesDecoded.split('; '); 22052 let res; 22053 cookiesArr.forEach(val => { 22054 if (val.indexOf(name) === 0) { 22055 res = val.substring(name.length); 22056 } 22057 }); 22058 return res; 22059 } 22060 22061})(); 22062; 22063(() => {
22064 const $contentCollectionSlides = $('.content-collection-slides'); 22065 if (!$contentCollectionSlides.length) { 22066 return; 22067 } 22068 22069 $contentCollectionSlides.each(function () { 22070 const fade = $(this).find('.content-collection-slides-fade').val() === 'true' || true; 22071 const speed = parseInt($(this).find('.content-collection-slides-speed').val()) || 400; 22072 const autoplay = $(this).find('.content-collection-slides-autoplay').val() === 'true' || false; 22073 22074 22075 $(this) 22076 .slick({ 22077 dots: true, 22078 arrows: false, 22079 fade, 22080 speed, 22081 autoplay 22082 }) 22083 .addClass("visible"); 22084 22085 const hasVideo = $(this).find(".video-container").length; 22086 if (!hasVideo) { 22087 return; 22088 } 22089 22090 const $kalturaPlayers = $(this).find('*[id^="kaltura_player_"].kWidgetIframeContainer'); 22091 const $dots = $(this).find(".slick-dots li button"); 22092 22093 $dots.on('click', function () { 22094 $kalturaPlayers.each(function () { 22095 this.sendNotification('doStop'); 22096 }); 22097 }); 22098 22099 }); 22100 22101})(); 22102 22103; 22104(function () { 22105 const $photoAlbumsComponent = $(".photo-albums-wrapper"); 22106 if (!$photoAlbumsComponent.length) { 22107 return; 22108 } 22109 22110 const photoAlbumLoadMoreUrl = $photoAlbumsComponent.find(".photo-albums-load-more-url").val(); 22111 const siteContextItemId = $photoAlbumsComponent.find(".photo-albums-site-context-item-id").val(); 22112 const contextItemId = $photoAlbumsComponent.find(".photo-albums-context-item-id").val(); 22113 const displayOption = $photoAlbumsComponent.find(".photo-albums-display-option").val(); 22114 const IsArchivedPage = $photoAlbumsComponent.find(".photo-albums-is-archived").val().length > 0;
22115 const loadMoreCount = 6; 22116 let itemsToSkip = 0; 22117 22118 let $photoAlbumLoadMoreBtn = $photoAlbumsComponent.find(".photo-albums-load-more-btn"); 22119 22120 initializeEvents($photoAlbumsComponent); 22121 function initializeEvents($container) { 22122 const $photoAlbumShare = $container.find(".photo-album-share-btn"); 22123 const $photoAlbumShareLinks = $container.find(".photo-album-share-dropdown-link"); 22124 const $photoAlbumCard = $container.find(".photo-album-card"); 22125 22126 $photoAlbumShare.on("click", photoAlbumShareClickEvent); 22127 $photoAlbumShare.focusout(photoAlbumShareFocusOutEvent); 22128 $photoAlbumShare.on("keydown", photoAlbumShareKeydownEvent); 22129 $photoAlbumShareLinks.on("keydown", photoAlbumShareLinkKeydownEvent); 22130 $photoAlbumShareLinks.focusout(photoAlbumShareFocusOutEvent); 22131 $photoAlbumLoadMoreBtn.on("click", photoAlbumLoadMoreClickEvent); 22132 $photoAlbumCard.on("click", photoAlbumCardClickEvent); 22133 22134 function photoAlbumCardClickEvent(e) { 22135 const target = e.srcElement || e.target; 22136 const $share = $(target).closest(".photo-album-share"); 22137 if ($share.length) { 22138 return; 22139 } 22140 const $card = $(target).closest(".photo-album-card-wrapper"); 22141 const url = $card.find(".photo-album-card-photo-url").val(); 22142 console.log(target, $card, url); 22143 if (!url) { 22144 return; 22145 } 22146 window.location = url; 22147 } 22148 function photoAlbumShareClickEvent(e) { 22149 const target = e.srcElement || e.target; 22150 const $share = $(target).closest(".photo-album-share"); 22151 22152 const isOpen = $share.hasClass("is-open"); 22153 if (isOpen) { 22154 photoAlbumShareCloseEvent($share); 22155 } else { 22156 photoAlbumShareOpenEvent($share); 22157 } 22158 } 22159 function photoAlbumShareFocusOutEvent(e) { 22160 const target = e.srcElement || e.target; 22161 const $share = $(target).closest(".photo-album-share"); 22162 const isOpen = $share.hasClass("is-open"); 22163 if ($share.has(e.relatedTarget).length < 1 && isOpen) { 22164 photoAlbumShareCloseEvent($share); 22165 } 22166 } 22167 function photoAlbumShareKeydownEvent(e) { 22168 if (e.which === 27) { 22169 const target = e.srcElement || e.target; 22170 const $share = $(target).closest(".photo-album-share"); 22171 photoAlbumShareCloseEvent($share) 22172 } 22173 } 22174 function photoAlbumShareLinkKeydownEvent(e) { 22175 const nextCodes = [39, 40]; 22176 const prevCodes = [37, 38]; 22177 if (nextCodes.indexOf(e.which) > -1) photoAlbumShareNext(); 22178 if (prevCodes.indexOf(e.which) > -1) photoAlbumSharePrev(); 22179 photoAlbumShareKeydownEvent(e); 22180 } 22181 function photoAlbumShareOpenEvent($share) { 22182 $share.addClass("is-open"); 22183 const $shareLinks = $share.find(".photo-album-share-dropdown-link"); 22184 $shareLinks.attr("tabindex", "0"); 22185 $share.find(".photo-album-share-dropdown-link").first().focus(); 22186 } 22187 function photoAlbumShareCloseEvent($share) { 22188 $share.removeClass("is-open"); 22189 const $shareLinks = $share.find(".photo-album-share-dropdown-link"); 22190 $shareLinks.attr("tabindex", "-1"); 22191 $share.find(".photo-album-share-btn").focus(); 22192 } 22193 function photoAlbumSharePrev() { 22194 const isContainer = $(document.activeElement).hasClass(".photo-album-share"); 22195 const $activeElem = isContainer ? $(document.activeElement).find(".photo-album-share-dropdown-link").first() : $(document.activeElement); 22196 var $prev = $activeElem.prev(); 22197 $prev.length > 0 ? $prev.focus() : $activeElem.siblings().last().focus(); 22198 } 22199 function photoAlbumShareNext() { 22200 const isContainer = $(document.activeElement).hasClass(".photo-album-share"); 22201 const $activeElem = isContainer ? $(document.activeElement).find(".photo-album-share-dropdown-link").first() : $(document.activeElement); 22202 var $next = $activeElem.next(); 22203 $next.length > 0 ? $next.focus() : $activeElem.siblings().first().focus(); 22204 } 22205 function photoAlbumLoadMoreClickEvent() { 22206 const request = { 22207 ContextItemId: contextItemId, 22208 SiteContextItemId: siteContextItemId, 22209 ItemsToSkip: itemsToSkip + loadMoreCount, 22210 DisplayOption: displayOption, 22211 IsArchivedPage: IsArchivedPage, 22212 }; 22213 $.ajax({
22214 type: "GET", 22215 url: photoAlbumLoadMoreUrl, 22216 cache: false, 22217 data: request 22218 }).done(function (data) { 22219 const $container = $photoAlbumsComponent.find(".photo-albums-load-more-wrapper").last(); 22220 $container[0].outerHTML = data; 22221 $photoAlbumLoadMoreBtn = $photoAlbumsComponent.find(".photo-albums-load-more-btn"); 22222 const $newContainer = $photoAlbumsComponent.find(".photo-albums").last(); 22223 itemsToSkip = itemsToSkip + loadMoreCount; 22224 initializeEvents($newContainer); 22225 }); 22226 } 22227 } 22228})();; 22229(function () { 22230 const $photoLists = $(".photo-list-wrapper"); 22231 if (!$photoLists.length) { 22232 return; 22233 } 22234 22235 const photoListLightboxUrl = $photoLists.find(".photo-list-lightbox-url").val(); 22236 const siteContextItemId = $photoLists.find(".photo-list-site-context-item-id").val(); 22237 const contextItemId = $photoLists.find(".photo-list-context-item-id").val(); 22238 const photoAlbumId = $photoLists.find(".photo-list-album-id").val(); 22239 22240 const $photoCards = $photoLists.find(".photo-card"); 22241 const $lightbox = $photoLists.find(".photo-lightbox-wrapper"); 22242 $photoCards.on("click", photoCardsClickEvent); 22243 $lightbox.on("click", lightboxClickEvent); 22244 22245 function photoCardsClickEvent(e) { 22246 const $target = $(e.target); 22247 const $parentDownload = $target.closest(".photo-card-download"); 22248 if ($parentDownload.length) { 22249 return; 22250 } 22251 const $parentCard = $target.closest(".photo-card-wrapper"); 22252 const index = $parentCard.find(".photo-card-photo-index").val(); 22253 const request = { 22254 siteContextItemId: siteContextItemId, 22255 contextItemId: contextItemId, 22256 CurrentPhoto: index, 22257 PhotoAlbumId: photoAlbumId, 22258 }; 22259 const $lightbox = $photoLists.find(".photo-lightbox-wrapper"); 22260 $.ajax({
22261 type: "GET", 22262 url: photoListLightboxUrl, 22263 cache: false, 22264 data: request 22265 }).done(function (data) { 22266 $lightbox.html(data); 22267 setCardsHeight(); 22268 const slider = initializeLightboxSlider(); 22269 const activeSlideIndex = $lightbox.find(".photo-lightbox-active-index").val(); 22270 slider.slick('slickGoTo', activeSlideIndex); 22271 22272 const $img = $(".photo-lightbox-photo-card-wrapper.slick-active .photo-lightbox-photo-card-image-wrapper"); 22273 setCardSizeByImg($img); 22274 $lightbox.addClass("open"); 22275 const $lightboxWrapper = $(".photo-lightbox-wrapper"); 22276 const $lightboxTitle = $(".photo-lightbox-album-title"); 22277 const $lightboxClose = $(".photo-lightbox-closer .fslash"); 22278 22279 $('html').animate({ 22280 scrollTop: $lightboxWrapper.offset().top - $lightboxTitle.outerHeight() - $lightboxClose.outerHeight(), 22281 }, 1000); 22282 22283 22284 const docHeight = $(document).outerHeight(); 22285 const lightboxWrapper = $(".photo-lightbox-wrapper"); 22286 lightboxWrapper.css("height", docHeight); 22287 }); 22288 } 22289 function lightboxClickEvent(e) { 22290 const $target = $(e.target); 22291 const $component = $target.closest(".photo-list-wrapper"); 22292 const $lightbox = $component.find(".photo-lightbox-wrapper"); 22293 if ($target.hasClass("photo-lightbox-wrapper") || $target.hasClass("photo-lightbox-photo-card-wrapper") || 22294 $target.hasClass("slick-track") || $target.hasClass("fslash") || $target.hasClass("bslash")) { 22295 $lightbox.removeClass("open"); 22296 } 22297 } 22298 22299 function initializeLightboxSlider() { 22300 const slickSliderContainer = $lightbox.find('.photo-lightbox-photo-cards'); 22301 const activeSlideIndex = $lightbox.find(".photo-lightbox-active-index").val(); 22302 22303 const autoPlay = $lightbox.find(".photo-lightbox-auto-play").val().length > 0; 22304 const autoPlayDuration = $lightbox.find(".photo-lightbox-auto-play-duration").val(); 22305 22306 slickSliderContainer.slick({ 22307 arrows: true, 22308 dots: false, 22309 slidesToShow: 1, 22310 autoplay: autoPlay, 22311 autoplaySpeed: autoPlayDuration, 22312 speed: 300, 22313 infinite: true, 22314 pauseOnHover: true, 22315 waitForAnimate: true, 22316 useTransform: true, 22317 cssEase: "cubic-bezier(0.250, 0.460, 0.450, 0.940)", 22318 prevArrow: $('.slick-prev'), 22319 nextArrow: $('.slick-next'), 22320 initialSlide: activeSlideIndex, 22321 responsive: [ 22322 { 22323 breakpoint: 768, 22324 settings: { 22325 arrows: true, 22326 slidesToShow: 1 22327 } 22328 } 22329 ] 22330 }); 22331 return slickSliderContainer; 22332 } 22333 function setCardSizeByImg($img) { 22334 const h = parseInt($img.find(".photo-lightbox-photo-card-image-height").val()); 22335 const w = parseInt($img.find(".photo-lightbox-photo-card-image-width").val()); 22336 let cardWidth = $(window).outerWidth() * .8; 22337 if (cardWidth >= 500) { 22338 cardWidth = 500; 22339 } 22340 const thinerThanCard = w < cardWidth; 22341 const isSquare = h === w; 22342 const isLandscape = h < w; 22343 const squareScale = "cover"; 22344 const portraitScale = "cover"; 22345 const landscapeScale = thinerThanCard ? "cover" : "contain"; 22346 const bgSize = isSquare ? squareScale : isLandscape ? landscapeScale : portraitScale; 22347 const ratio = h / w; 22348 $img.css("height", cardWidth * ratio); 22349 $img.css("background-size", bgSize); 22350 } 22351 function setCardsHeight() { 22352 const $cards = $(".photo-lightbox-photo-card-image-wrapper"); 22353 $cards.css("height"); 22354 $cards.css("background-size"); 22355 $cards.each((index, img) => { 22356 setCardSizeByImg($(img)); 22357 }); 22358 } 22359 $(window).resize(() => { 22360 const $img = $(".photo-lightbox-photo-card-wrapper.slick-active .photo-lightbox-photo-card-image-wrapper"); 22361 setCardSizeByImg($img); 22362 });
22363})();; 22364(function () { 22365 const $socialShare = $('.social-share'); 22366 if (!$socialShare.length) { return; } 22367 22368 const $socialShareBtn = $socialShare.find('.social-share-btn'); 22369 const $socialShareDrawer = $socialShare.find('.social-share-drawer'); 22370 const socialShareFirstItem = $socialShare.find('.social-share-items .social-share-item').first().find('a')[0]; 22371 const socialShareLastItem = $socialShare.find('.social-share-items .social-share-item').last().find('a')[0]; 22372 22373 const toggleSocialShare = (forceClose) => { 22374 if (forceClose) { 22375 $socialShare.removeClass('open'); 22376 if (activeElementIsInsideSocialShare()) { 22377 $socialShareBtn.focus(); 22378 } 22379 } else { 22380 $socialShare.toggleClass('open'); 22381 } 22382 22383 //A117 accessibility: 22384 // 1.) mark aria-expanded based on the state of container 22385 // 2.) deal with the tab index for those using keyboard navigation 22386 const isOpen = $socialShare.hasClass('open'); 22387 isOpen ? $socialShareDrawer.attr('aria-expanded', true) : $socialShareDrawer.attr('aria-expanded', false); 22388 const $links = $socialShareDrawer.find('.social-share-item-link'); 22389 $links.each((i, link) => { 22390 isOpen ? $(link).removeAttr('tabindex') : $(link).attr('tabindex', -1); 22391 }); 22392 }; 22393 const activeElementIsInsideSocialShare = () => { 22394 return $(document.activeElement).closest('.social-share').hasClass('.social-share'); 22395 } 22396 //Toggle open the component when clicked: open class toggled 22397 $socialShareBtn.on('click', () => { 22398 toggleSocialShare(); 22399 }); 22400 //Tab focus management 22401 $socialShare.on('keyup', function (e) { 22402 if (e.shiftKey && e.which === 9 && document.activeElement === socialShareFirstItem) { 22403 toggleSocialShare(true); 22404 } 22405 if (!e.shiftKey && e.which === 9 && document.activeElement === socialShareLastItem) { 22406 toggleSocialShare(true); 22407 } 22408 if (e.which === 27) { toggleSocialShare(true); }//Esc 22409 }); 22410 //Click outside to close 22411 $('body').on('click', (e) => { 22412 if (!$socialShare.find(e.target).length) { toggleSocialShare(true); } 22413 }); 22414})();; 22415(() => { 22416 const $homepageBillboards = $(".homepage-billboard"); 22417 if (!$homepageBillboards.length) { 22418 return; 22419 } 22420 const MAX_IMAGE_HEIGHT = 550; 22421 22422 $homepageBillboards.each((index, hb) => { 22423 const $homepageBillboard = $(hb); 22424 const $homepageBillboardSlides = $homepageBillboard.find(".homepage-billboard-slide"); 22425 const $homepageBillboardNext = $homepageBillboard.find(".homepage-billboard-next"); 22426 const $homepageBillboardPrev = $homepageBillboard.find(".homepage-billboard-prev"); 22427 const homepageBillboardAutoPlay = $homepageBillboard.find(".homepage-billboard-data .contentAutoPlay").first().val().length > 0; 22428 const homepageBillboardSpeed = $homepageBillboard.find(".homepage-billboard-data .contentSpeed").first().val(); 22429 const homepageBillboardInfinite = $homepageBillboard.find(".homepage-billboard-data .contentInfinite").first().val().length > 0; 22430 const homepageBillboardPauseOnHover = $homepageBillboard.find(".homepage-billboard-data .contentPauseOnHover").first().val().length > 0; 22431 22432 $homepageBillboardSlides.focusin(activateFocusedSlide); 22433 $homepageBillboardSlides.hover(activateHoverSlide); 22434 $homepageBillboardSlides.on('keypress', keypressSlide); 22435 $homepageBillboardNext.on("click", activateNextSlide); 22436 $homepageBillboardPrev.on("click", activatePrevSlide); 22437 $homepageBillboardSlides.on("swipeleft", activateNextSlide); 22438 $homepageBillboardSlides.on("swiperight", activatePrevSlide); 22439 $(window).on("load", activateInitialSlide); 22440 $(window).on("resize", activateInitialSlide); 22441 22442 $homepageBillboard.mouseover(hompageBillboardMouseOver); 22443 $homepageBillboard.mouseout(hompageBillboardMouseOut); 22444 initializeSlideTimer($homepageBillboard, homepageBillboardAutoPlay, homepageBillboardS
22444peed, homepageBillboardInfinite, homepageBillboardPauseOnHover); 22445 }); 22446 22447 function isMobile() { 22448 const DESKTOP_WIDTH = 992; 22449 return $(window).width() < DESKTOP_WIDTH; 22450 } 22451 22452 function initializeSlideTimer($homepageBillboard, autoPlay, speed, infinite, pauseOnHover) { 22453 if (autoPlay) { 22454 let myInterval = setInterval(($homepageBillboard, infinite, pauseOnHover) => { 22455 if (992 <= $(window).outerWidth()) { 22456 return; 22457 } 22458 const hoverState = $homepageBillboard.attr("data-hover-state") === "true"; 22459 if (pauseOnHover && hoverState) { 22460 return; 22461 } 22462 const $activeSlide = $homepageBillboard.find(".homepage-billboard-active-slide").first(); 22463 const $slides = $homepageBillboard.find(".homepage-billboard-slide"); 22464 const activeSlideIndex = [].slice.call($slides).indexOf($activeSlide[0]); 22465 const isLastSlide = activeSlideIndex === $slides.length - 1; 22466 const timerIsActive = infinite ? true : !isLastSlide; 22467 if (timerIsActive) { 22468 const $nextButton = $homepageBillboard.find(".homepage-billboard-next").first(); 22469 $nextButton[0].click(); 22470 return; 22471 } 22472 stopTimer(); 22473 }, speed, $homepageBillboard, infinite, pauseOnHover); 22474 22475 const stopTimer = () => { 22476 clearInterval(myInterval); 22477 }; 22478 22479 } 22480 } 22481 22482 function hompageBillboardMouseOver() { 22483 const $homepageBillboard = $(this); 22484 $homepageBillboard.attr("data-hover-state", "true"); 22485 } 22486 22487 function hompageBillboardMouseOut() { 22488 const $homepageBillboard = $(this); 22489 $homepageBillboard.attr("data-hover-state", "false"); 22490 } 22491 22492 function activateFocusedSlide() { 22493 const $activeSlide = $(this); 22494 setActiveSlide($activeSlide); 22495 } 22496 22497 function activateHoverSlide() { 22498 if (992 <= $(window).outerWidth()) { 22499 const $activeSlide = $(this);
22500 setActiveSlide($activeSlide); 22501 } 22502 } 22503 22504 function activateInitialSlide() { 22505 const $homepageBillboards = $(".homepage-billboard"); 22506 22507 $homepageBillboards.each((index, hb) => { 22508 const $homepageBillboard = $(hb); 22509 const $activeSlide = $homepageBillboard.find(".homepage-billboard-slide").first(); 22510 setActiveSlide($activeSlide); 22511 }); 22512 } 22513 22514 function activateNextSlide() { 22515 const $target = $(this); 22516 const $homepageBillboard = $target.closest(".homepage-billboard"); 22517 const $activeSlide = $homepageBillboard.find(".homepage-billboard-active-slide").first(); 22518 const $nextSlide = $activeSlide.next(".homepage-billboard-slide").first(); 22519 if ($nextSlide.length) { 22520 setActiveSlide($nextSlide); 22521 } else { 22522 const $activeSlideParent = $activeSlide.parent(); 22523 const $firstSlide = $activeSlideParent.find(".homepage-billboard-slide").first(); 22524 setActiveSlide($firstSlide); 22525 } 22526 } 22527 22528 function activatePrevSlide() { 22529 const $target = $(this); 22530 const $homepageBillboard = $target.closest(".homepage-billboard"); 22531 const $activeSlide = $homepageBillboard.find(".homepage-billboard-active-slide").first(); 22532 const $prevSlide = $activeSlide.prev(".homepage-billboard-slide").first(); 22533 if ($prevSlide.length) {
22534 setActiveSlide($prevSlide); 22535 } else { 22536 const $activeSlideParent = $activeSlide.parent(); 22537 const $lastSlide = $activeSlideParent.find(".homepage-billboard-slide").last(); 22538 setActiveSlide($lastSlide); 22539 } 22540 } 22541 22542 function keypressSlide(e) { 22543 if (e.which === 13) { 22544 const $target = $(this); 22545 const $selectedSlide = $target.closest(".homepage-billboard-slide"); 22546 const $selectedSlideLink = $selectedSlide.find(".homepage-billboard-slide-link")[0]; 22547 $selectedSlideLink.click(); 22548 } 22549 } 22550 22551 function setActiveSlide($activeSlide) { 22552 //activate slide 22553 const $activeSlideParent = $activeSlide.parent(); 22554 const $slides = $activeSlideParent.find(".homepage-billboard-slide"); 22555 const activeSlideLink = $activeSlide.find('.homepage-billboard-slide-link').attr('href'); 22556 $slides.removeClass("homepage-billboard-active-slide"); 22557 $activeSlide.addClass("homepage-billboard-active-slide"); 22558 //activate image 22559 const $homepageBillboard = $activeSlide.closest(".homepage-billboard"); 22560 const $images = $homepageBillboard.find(".homepage-billboard-image"); 22561 const activeSlideIndex = [].slice.call($slides).indexOf($activeSlide[0]); 22562 const $activeImage = $($images.get(activeSlideIndex)); 22563 $images.removeClass("homepage-billboard-active-image"); 22564 $activeImage.addClass("homepage-billboard-active-image"); 22565 $activeImage.on('click', function () { 22566 if (!isMobile()) { return }; 22567 window.location.href = activeSlideLink; 22568 }); 22569 updateSliderHeights($homepageBillboard); 22570 } 22571 22572 function updateSliderHeights($homepageBillboard) { 22573 const $sliderImageSection = $homepageBillboard.find('.homepage-billboard-images'); 22574 const $sliderTextSection = $homepageBillboard.find('.homepage-billboard-slides'); 22575 const $activeImage = $sliderImageSection.find('.homepage-billboard-active-image'); 22576 const $activeText = $sliderTextSection.find('.homepage-billboard-active-slide').find('.homepage-billboard-slide-text'); 22577 22578 let imageHeight = 0; 22579 let textHeight = 0; 22580 22581 const activeImageHeight = $activeImage.height(); 22582 const activeTextHeight = $activeText.outerHeight(); 22583 22584 if (activeImageHeight !== imageHeight) { 22585 imageHeight = activeImageHeight <= MAX_IMAGE_HEIGHT ? activeImageHeight : MAX_IMAGE_HEIGHT; 22586 $sliderImageSection.css("height", imageHeight); 22587 } 22588 if (isMobile() && activeTextHeight !== textHeight) { 22589 textHeight = activeTextHeight; 22590 $sliderTextSection.css("height", textHeight); 22591 } else { 22592 $sliderTextSection.css("height", 'auto'); 22593 } 22594 } 22595 22596})();; 22597(() => { 22598 22599 $(document).ready(function () { 22600 22601 const $breadcrumb = $(".sub-category-breadcrumb-wrapper") 22602 if (!$breadcrumb.length) { 22603 return; 22604 } 22605 function addActiveClass() { 22606 const $breadcrumbDropdownItems = $breadcrumb.find(".breadcrumb-dropdown-item"); 22607 $breadcrumbDropdownItems.each((index, item) => { 22608 const $link = $(item).find("a"); 22609 if ($link.attr("href").toLocaleLowerCase() === window.location.pathname.toLocaleLowerCase()) { 22610 $(item).addClass("breadcrumb-dropdown-active-item") 22611 } 22612 }); 22613 } 22614 addActiveClass(); 22615 22616 const target = $('.main-header')[0]; 22617 const observer = new MutationObserver((mutationsList) => { 22618 mutationsList.forEach((mutation) => { 22619 if (mutation.type === 'attributes' && mutation.attributeName === 'class') { 22620 const classList = mutation.target.classList; 22621 if (classList.contains('min-nav')) { 22622 $breadcrumb.addClass('sticky'); 22623 } else { 22624 $breadcrumb.removeClass('sticky'); 22625 } 22626 } 22627 }); 22628 }); 22629 observer.observe(target, { attributes: true });
22630 }); 22631})();; 22632(function () { 22633 const breadcrumb = $('.faa-v2-breadcrumb'); 22634 const faaPageLink = breadcrumb.find('.faa-v2-breadcrumb-home'); 22635 22636 if (!faaPageLink.length) { 22637 return; 22638 } 22639 22640 const previousUrl = new URL(document.referrer); 22641 const aid = previousUrl.searchParams.get('aid'); 22642 const isFAAInHistory = previousUrl.pathname.includes(faaPageLink[0].pathname) && !aid; 22643 22644 if (isFAAInHistory) { 22645 faaPageLink.attr('href', document.referrer); 22646 } 22647})(); 22648; 22649$(window).on('load', function () { 22650 const COOKIE_ATTESTATION = 'cookieAttestation'; 22651 const $attestations = $('.attestation-wrapper'); 22652 22653 if (!$attestations.length) { 22654 return false; 22655 } 22656 22657 const cookieExpirationDays = $attestations.data('cookie-expiration-days'); 22658 let days = parseInt(cookieExpirationDays); 22659 22660 if (isNaN(days)) { 22661 days = 6 * 30; 22662 } 22663 22664 $(document.body).addClass('attestation-active'); 22665 $attestations.find('.attestation-button-cancel').on('click', function handleAttestationCancelClick() { 22666 const redirectUrl = $(this).data('target'); 22667 window.location.href = redirectUrl; 22668 }); 22669 $attestations.find('.attestation-button-accept').on('click', function handleAttestationAcceptClick() { 22670 $(document.body).removeClass('attestation-active'); 22671 $attestations.remove(); 22672 const attestationId = '' + $(this).data('attestation-id'); 22673 setCookie(COOKIE_ATTESTATION + attestationId, 'true', days); 22674 }); 22675 22676 function setCookie(name, value, expireDays) { 22677 const expirationDate = new Date(); 22678 expirationDate.setDate(expirationDate.getDate() + expireDays); 22679 const expiresUTC = expirationDate.toUTCString(); 22680 document.cookie = `${name}=${value}; expires=${expiresUTC}; path=/`; 22681 } 22682}) 22683; 22684$(window).on('load', function () { 22685 22686 22687 const $backdrop = $('[data-site-leaving-modal="backdrop"]') 22688 if (!$backdrop.length) { 22689 return; 22690 } 22691 22692 let externalLink = null; 22693 let whitelist = getWhitelist(); 22694 const $acceptButton = $('[data-site-leaving-modal="accept"]'); 22695 const $cancelButton = $('[data-site-leaving-modal="cancel"]'); 22696 22697 $(document).on('click', linkClickHandler); 22698 $backdrop.on('click', backdropClickHandler); 22699 $acceptButton.on('click', acceptClickHandler); 22700 $cancelButton.on('click', cancelClickHandler); 22701 22702 function getWhitelist() { 22703 const $whitelist = $('[data-site-leaving-modal-value="whitelist"]'); 22704 const domains = $whitelist && $whitelist.val() ? $whitelist.val().split(',') : []; 22705 return domains.reduce((domains, domain) => { 22706 try { 22707 const url = new URL(domain); 22708 domains.push(url); 22709 return domains 22710 } catch { 22711 return domains; 22712 } 22713 }, []); 22714 } 22715 function showModal(link, target) { 22716 externalLink = { link, target }; 22717 $('html').addClass('site-leaving-modal-open'); 22718 $backdrop.show().scrollTop(0).addClass('site-leaving-modal-show') 22719 } 22720 function hideModal() { 22721 externalLink = null; 22722 $('html').removeClass('site-leaving-modal-open'); 22723 $backdrop.removeClass('site-leaving-modal-show').hide(); 22724 } 22725 function compareUrls(url1, url2) { 22726 return ( 22727 url1.protocol === url2.protocol && 22728 url1.hostname === url2.hostname && 22729 url1.port === url2.port 22730 ); 22731 } 22732 function isExternalUrl(linkOrUrl) { 22733 const url = linkOrUrl instanceof URL ? linkOrUrl : new URL(linkOrUrl, document.location); 22734 return !compareUrls(url, document.location); 22735 } 22736 function isWhitelistedUrl(linkOrUrl) { 22737 const url = linkOrUrl instanceof URL ? linkOrUrl : new URL(linkOrUrl, document.location); 22738 const matchedUrl = whitelist.find(whitelistedUrl => compareUrls(url, whitelistedUrl)); 22739 return Boolean(matchedUrl); 22740 } 22741 function linkClickHandler(event) { 22742 const linkEl = event.target.closest('a'); 22743 if (!linkEl) { 22744 return; 22745 } 22746 22747 const link = linkEl.getAttribute('href'); 22748 if (isExternalUrl(link) && !isWhitelistedUrl(link)) { 22749 event.preventDefault(); 22750 showModal(link, linkEl.target); 22751 } 22752 } 22753 function backdropClickHandler(event) { 22754 if (event.target.matches('[data-site-leaving-modal="backdrop"]') || event.target.matches('[data-site-leaving-modal="dialog"]')) { 22755 hideModal(); 22756 } 22757 } 22758 function acceptClickHandler() { 22759 window.open(externalLink.link, externalLink.target); 22760 hideModal(); 22761 } 22762 function cancelClickHandler() { 22763 hideModal(); 22764 } 22765}); 22766; 22767(function () { 22768 const $calloutCarousels = $('.callout-carousel'); 22769 if (!$calloutCarousels.length) { 22770 return; 22771 } 22772 const gridClasses = ['.callout-carousel-heading-wrapper', '.callout-carousel-copy-wrapper', '.callout-carousel-cta-wrapper', 'callout-carousel-date-wrapper', 'callout-carousel-categories-wrapper']; 22773 22774 function initializeGridContainer($container) { 22775 const id = $container.find('.callouts-id').val(); 22776 const $slides = $(`#${id}`); 22777 const mobileFirst = $container.find('.callouts-mobile-first').val() === 'true'; 22778 const waitForAnimate = $container.find('.callouts-wait-for-animate').val() === 'true'; 22779 const useTransform = $container.find('.callouts-use-transform').val() === 'true'; 22780 const cssEase = $container.find('.callouts-css-ease').val(); 22781 const autoPlay = $container.find(".callouts-autoplay").val() === "true"; 22782 const infinite = $container.find(".callouts-infinite").val() === "true"; 22783 const pauseOnHover = $container.find(".callouts-pause-on-hover").val() === "true"; 22784 const slidesToShow = $container.find(".callouts-slides-to-show").val(); 22785 const slidesToShowArr = (slidesToShow || "").toString().split("|"); 22786 const breakPointSlides = slidesToShowArr.length === 4 ? slidesToShowArr : ['1', '1', '2', '3']; 22787 const speedBe = parseInt($container.find(".callouts-speed").val()); 22788 const speed = isNaN(speedBe) ? 300 : speedBe; 22789 const prev = $container.find(".slick-prev"); 22790 const next = $container.find(".slick-next"); 22791 const slidesToScroll = $container.find("#SlidesToScroll").val(); 22792 const slidesToScrollArr = (slidesToScroll || "").toString().split("|"); 22793 const calloutsMobileLayout = $container.find('.callouts-mobile-layout').val(); 22794 const calloutsMobileLayoutSlider = calloutsMobileLayout === "callout-mobile-slide"; 22795 const calloutsShowDots = $container.find('.callouts-dot-pagination').val() === "true"; 22796 22797 const breakpoints = [ 22798 { 22799 breakpoint: '(max-width: 766px) and (orientation: portrait)', 22800 settings: !calloutsMobileLayoutSlider ? "unslick" : { 22801 slidesToShow: toIntOrUndefined(breakPointSlides[0]), 22802 slidesToScroll: toIntOrUndefined(slidesToScrollArr[0]) 22803 } 22804 }, 22805 { 22806 breakpoint: '(max-width: 766px) and (orientation: landscape)', 22807 settings: !calloutsMobileLayoutSlider ? "unslick" : { 22808 slidesToShow: toIntOrUndefined(breakPointSlides[1]), 22809 slidesToScroll: toIntOrUndefined(slidesToScrollArr[1]) 22810 } 22811 }, 22812 { 22813 breakpoint: '(min-width: 767px) and (orientation: portrait)', 22814 settings: { 22815 slidesToShow: toIntOrUndefined(breakPointSlides[2]), 22816 slidesToScroll: toIntOrUndefined(slidesToScrollArr[2]) 22817 } 22818 }, 22819 { 22820 breakpoint: '(min-width: 767px) and (orientation: landscape)', 22821 settings: { 22822 slidesToShow: toIntOrUndefined(breakPointSlides[3]), 22823 slidesToScroll: toIntOrUndefined(slidesToScrollArr[3]) 22824 } 22825 } 22826 ]; 22827 22828 if ($slides.hasClass('slick-initialized')) { 22829 return; 22830 } 22831 $slides.slick({ 22832 dots: calloutsShowDots, 22833 mobileFirst: mobileFirst || true, 22834 slidesToShow: slidesToShow || 1, 22835 autoplay: autoPlay || false, 22836 speed: speed || 300, 22837 infinite: infinite || true, 22838 pauseOnHover: pauseOnHover || false, 22839 waitForAnimate: waitForAnimate || false, 22840 useTransform: useTransform || true, 22841 cssEase: cssEase || 'ease-out', 22842 prevArrow: prev ? prev : null, 22843 nextArrow: next ? next : null, 22844 responsive: breakpoints 22845 }); 22846 $slides.on('destroy', function (e, slick) { 22847 if (!calloutsMobileLayoutSlider) { 22848 $(window).on('resize', function () { 22849 const w = $(window).width(); 22850 if (!$slides.hasClass('slick-initialized') && w > 768) { 22851 initializeSlick(); 22852 } 22853 }); 22854 } 22855 }); 22856 22857 } 22858 22859 function toIntOrUndefined(num) { 22860 var result = parseInt(num); 22861 if (isNaN(result)) { 22862 return undefined; 22863 } 22864 return result; 22865 } 22866 22867 function syncGridHeights($container) {
22868 gridClasses.forEach(function (className) { 22869 let maxH = 0; 22870 const $items = $container.find(className) 22871 $items.each(function () { 22872 const $item = $(this); 22873 $item.css('height', ''); 22874 const h = $item.height(); 22875 maxH = h > maxH ? h : maxH; 22876 }); 22877 $container.find(className).height(maxH); 22878 }); 22879 } 22880 22881 function initializeSlick() { 22882 $calloutCarousels.each(function () { 22883 const $container = $(this); 22884 initializeGridContainer($container); 22885 syncGridHeights($container); 22886 22887 $(window).on( 22888 "resize", 22889 _.debounce(function () { 22890 syncGridHeights($container); 22891 }, 200) 22892 ); 22893 22894 // autoplay video if .kaltura-auto class is added 22895 $('.kaltura-auto').on('click', function () { 22896 this.href += '[autoPlay]=true[streamerType]=auto'; 22897 }); 22898 // stop currently playing video and remove autoplay when moving to new slide 22899 $(document.body).on('click', '.slick-lightbox .slick-next, .slick-lightbox .slick-prev', function () { 22900 $('.slick-slide iframe').not('.slick-active iframe').each(function () { 22901 var src = $(this).attr('src').replace('[autoPlay]=true[streamerType]=auto', ''); 22902 $(this).attr('src', src); 22903 }); 22904 }); 22905 // stop currently playing video and remove autoplay when sliding to new slide 22906 $(document.body).on('touchstart', '.slick-lightbox', function () { 22907 $('iframe').each(function () { 22908 var src = $(this).attr('src').replace('[autoPlay]=true[streamerType]=auto', ''); 22909 $(this).attr('src', src); 22910 }); 22911 }); 22912 }); 22913 } 22914 initializeSlick(); 22915})();; 22916(function () { 22917 const $quoteCollection = $('.quote-collection'); 22918 if (!$quoteCollection.length) { 22919 return; 22920 } 22921 22922 $quoteCollection.each(function (index, collection) { 22923 const $collection = $(collection); 22924 if (!$collection.hasClass('quote-collection-slider')) { 22925 return; 22926 } 22927 const $quotes = $collection.find('.quote-collection-quotes'); 22928 const $prev = $collection.find('.slick-prev'); 22929 const $next = $collection.find('.slick-next'); 22930 22931 $quotes.slick({ 22932 infinite: true, 22933 slidesToShow: 1, 22934 slidesToScroll: 1, 22935 prevArrow: $prev, 22936 nextArrow: $next, 22937 dots: true, 22938 autoplay: true, 22939 autoplaySpeed: 3000, 22940 speed: 500, 22941 }); 22942 22943 }); 22944})();; 22945// FAA V2 Content Managed Dropdown Label Script 22946$(function () { 22947 $('form[action^="/formbuilder"]').each(function () { 22948 const $form = $(this); 22949 22950 $form.find('select.has-content-managed-label').each(function () { 22951 const $select = $(this); 22952 const $firstOption = $select.find('option').first(); 22953 const $secondOption = $select.find('option').eq(1); 22954 22955 if ($firstOption.length === 0) { 22956 return; 22957 } 22958 if ($firstOption.val() === null || $firstOption.val().trim() === '') { 22959 $firstOption.remove(); 22960 if ($secondOption.length > 0) { 22961 $secondOption.val(''); 22962 const secondOptionText = $secondOption.text(); 22963 if ($select.attr('data-val-required') !== undefined && !secondOptionText.startsWith('*')) { 22964 $secondOption.text(`* ${secondOptionText}`); 22965 } 22966 } 22967 22968 } 22969 22970 }); 22971 }); 22972});; 22973(function ($) { 22974 22975 class CoreContentSlider { 22976 constructor(root) { 22977 this.$root = $(root); 22978 if (!this.$root.length || this.$root.data('ccs-init')) { 22979 return; 22980 } 22981 this.$root.data('ccs-init', true); 22982 22983 this.$track = this.$root.find('.ccs-track'); 22984 this.$live = this.$root.find('#ccs-live'); 22985 this.$counter = this.$root.find('.ccs-counter'); 22986 this.$counterCurrent = this.$root.find('.ccs-counter-current'); 22987 this.$controls = this.$root.find('.ccs-controls'); 22988 this.$prev = this.$controls.find('.ccs-prev'); 22989 this.$next = this.$controls.find('.ccs-next'); 22990 this.$toggle = this.$controls.find('.ccs-toggle'); 22991 22992 this.config = this.getConfig(); 22993 this.init(); 22994 } 22995 22996 getConfig() { 22997 const getVal = (sel, fb = '') => { 22998 const el = this.$root.find(sel)[0]; 22999 return el && typeof el.value !== 'undefined' ? el.value : fb; 23000 };
23001 const toBool = v => String(v).toLowerCase() === 'true'; 23002 const toInt = (v, fb) => { 23003 const n = parseInt(v, 10); 23004 return isNaN(n) ? fb : n; 23005 }; 23006 const msOrSec = v => { 23007 const n = parseInt(v, 10); 23008 if (isNaN(n)) { 23009 return 20000; 23010 } 23011 return n < 1000 ? n * 1000 : n; 23012 }; 23013 23014 let autoplay = toBool(getVal('#ccs-autoplay', 'False')); 23015 let animMs = toInt(getVal('#ccs-anim-ms', '800'), 800); 23016 23017 if (window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches) { 23018 autoplay = false; 23019 animMs = Math.min(animMs, 200); 23020 } 23021 23022 return { 23023 autoplay, 23024 autoplayMs: msOrSec(getVal('#ccs-autoplay-ms', '20000')), 23025 animMs, 23026 slideCount: toInt(getVal('#ccs-slidecount', '0'), 0) 23027 }; 23028 } 23029 23030 init() { 23031 const { slideCount } = this.config; 23032 23033 if (!slideCount || slideCount <= 1) { 23034 this.$controls.hide(); 23035 this.announce(1, slideCount || 1); 23036 return; 23037 } 23038 23039 this.initSlick(); 23040 this.bindEvents(); 23041 } 23042 23043 initSlick() { 23044 const { autoplay, autoplayMs, animMs } = this.config; 23045 23046 this.$track.on('init', (_e, slick) => { 23047 this.announce(1, slick.slideCount); 23048 }); 23049 23050 this.$track.slick({ 23051 useTransform: true, 23052 arrows: false, 23053 dots: false, 23054 autoplay, 23055 autoplaySpeed: autoplayMs, 23056 speed: animMs, 23057 cssEase: 'ease-in-out', 23058 adaptiveHeight: true, 23059 pauseOnHover: false, 23060 pauseOnFocus: false, 23061 accessibility: false, 23062 slidesToShow: 1, 23063 slidesToScroll: 1 23064 }); 23065 23066 this.$track.on('afterChange', (_e, slick, current) => { 23067 this.announce(current + 1, slick.slideCount); 23068 if (window.onSlideChange) { 23069 try { window.onSlideChange(current + 1); } catch { } 23070 } 23071 }); 23072 } 23073 23074 bindEvents() { 23075 const focusBtn = $btn => $btn.trigger('focus'); 23076 23077 this.$prev.on('click', () => { 23078 this.$track.slick('slickPrev'); 23079 focusBtn(this.$prev); 23080 }); 23081 23082 this.$next.on('click', () => { 23083 this.$track.slick('slickNext'); 23084 focusBtn(this.$next); 23085 }); 23086 23087 if (this.$toggle.length) { 23088 this.$toggle.on('click', () => this.toggleAutoplay()); 23089 } 23090 23091 this.$root.on('keydown', e => { 23092 if (e.key === 'ArrowLeft') { 23093 this.$track.slick('slickPrev'); 23094 } 23095 if (e.key === 'ArrowRight') { 23096 this.$track.slick('slickNext'); 23097 } 23098 }); 23099 } 23100 23101 announce(index, total) { 23102 const text = `Slide ${index} of ${total}`; 23103 if (this.$live.length) { 23104 this.$live.text(text); 23105 } 23106 23107 if (this.$counterCurrent.length) { 23108 this.$counterCurrent.text(index); 23109 } else if (this.$counter.length) { 23110 this.$counter.text(`${index} of ${total}`); 23111 } 23112 } 23113 23114 toggleAutoplay() { 23115 const state = this.$toggle.attr('data-state'); 23116 const playing = state === 'playing'; 23117 23118 this.$track.slick(playing ? 'slickPause' : 'slickPlay'); 23119 this.$toggle.attr({ 23120 'data-state': playing ? 'paused' : 'playing', 23121 'aria-label': playing ? 'Play autoplay' : 'Pause autoplay' 23122 }); 23123 this.$toggle.trigger('focus'); 23124 } 23125 } 23126 23127 $(function () { 23128 const $sliders = $('.core-content-slider'); 23129 if (!$sliders.length) { 23130 return; 23131 } 23132 $sliders.each((_, el) => new CoreContentSlider(el)); 23133 });
23134 23135})(jQuery); 23136; 23137(function ($) { 23138 // Configuration constants 23139 const CONFIG = { 23140 urls: { 23141 advisorsSuggestions: '/dotcom/api/searchadvisorssuggestionsv2/', 23142 locationsSuggestions: '/dotcom/api/getplaceautocomplete/', 23143 }, 23144 minChars: 3, 23145 debounceTimeout: 300, 23146 sessionIdleMs: 150000, // 2.5 minutes 23147 selectionDelayMs: 50, 23148 }; 23149 23150 const SESSION_KEY = 'places_session_token'; 23151 23152 const SELECTORS = { 23153 FORM: '#core-find-an-advisor-form', 23154 LOCATION_INPUT: '#core-find-an-advisor-location', 23155 NAME_INPUT: '#core-find-an-advisor-last-name', 23156 ERROR_TEXT: '.core-find-an-advisor__error-text', 23157 PAGE_URL: '#core-find-an-advisor-page-url', 23158 }; 23159 23160 const CLASSES = { 23161 AUTOCOMPLETE_LIST: 'core-find-an-advisor__autocomplete-list', 23162 AUTOCOMPLETE_ACTIVE: 'core-find-an-advisor__input--autocomplete-active', 23163 ERROR_VISIBLE: 'is-visible', 23164 HAS_ERROR: 'has-error', 23165 }; 23166 23167 class CoreFindAnAdvisor { 23168 constructor(root) { 23169 this.$root = $(root); 23170 if (!this.$root.length || this.$root.data('faa-init')) { 23171 return; 23172 } 23173 this.$root.data('faa-init', true); 23174 23175 this.$form = this.$root.find(SELECTORS.FORM); 23176 this.$locationInput = this.$root.find(SELECTORS.LOCATION_INPUT); 23177 this.$nameInput = this.$root.find(SELECTORS.NAME_INPUT); 23178 this.$errorText = this.$root.find(SELECTORS.ERROR_TEXT); 23179 this.$pageUrl = this.$root.find(SELECTORS.PAGE_URL); 23180 23181 this.idleTimer = null; 23182 this.locationAutocomplete = null; 23183 this.nameAutocomplete = null; 23184 this.justSelected = false; 23185 this.latestLocationRequestId = 0; 23186 this.latestNameRequestId = 0; 23187 23188 this.init(); 23189 } 23190 23191 // Session token management for Google Places API 23192 getToken() { 23193 let token = sessionStorage.getItem(SESSION_KEY); 23194 if (!token) { 23195 token = crypto.randomUUID(); 23196 sessionStorage.setItem(SESSION_KEY, token); 23197 } 23198 return token; 23199 } 23200 23201 startNewSession() { 23202 sessionStorage.setItem(SESSION_KEY, crypto.randomUUID()); 23203 this.resetIdleTimer(); 23204 } 23205 23206 endSession() { 23207 sessionStorage.removeItem(SESSION_KEY); 23208 clearTimeout(this.idleTimer); 23209 } 23210 23211 resetIdleTimer() { 23212 clearTimeout(this.idleTimer); 23213 this.idleTimer = setTimeout(() => this.endSession(), CONFIG.sessionIdleMs); 23214 } 23215 23216 // Fetch suggestions from API 23217 async fetchSuggestions(url, params) { 23218 try { 23219 const queryString = new URLSearchParams(params).toString(); 23220 const response = await fetch(`${url}?${queryString}`); 23221 23222 if (!response.ok) { 23223 throw new Error(`HTTP error! status: ${response.status}`); 23224 } 23225 23226 const data = await response.json(); 23227 return data || []; 23228 } catch (error) { 23229 console.error('Error fetching suggestions:', error); 23230 return []; 23231 } 23232 } 23233 23234 // Common mouseover handler for autocomplete lists 23235 createMouseoverHandler(autocompleteInstance) { 23236 return (e) => { 23237 const item = e.target.closest('[role="option"]'); 23238 if (!item) { 23239 return; 23240 } 23241 23242 const items = [...e.currentTarget.querySelectorAll('[role="option"]')]; 23243 const index = items.indexOf(item); 23244 autocompleteInstance.goTo(index); 23245 }; 23246 } 23247 23248 // Setup autocomplete for location input 23249 setupLocationAutocomplete() { 23250 if (!this.$locationInput.length || typeof autoComplete === 'undefined') { 23251 return; 23252 } 23253 23254 const inputElement = this.$locationInput[0]; 23255 let autocompleteSessionActive = false; 23256 const isInputFocused = () => document.activeElement === inputElement; 23257 23258 this.locationAutocomplete = new autoComplete({ 23259 selector: SELECTORS.LOCATION_INPUT, 23260 placeHolder: inputElement.placeholder, 23261 threshold: CONFIG.minChars, 23262 debounce: CONFIG.debounceTimeout, 23263 wrapper: false, 23264 data: { 23265 src: async () => { 23266 if (!autocompleteSessionActive) { 23267 autocompleteSessionActive = true; 23268 if (!sessionStorage.getItem(SESSION_KEY)) { 23269 this.startNewSession(); 23270 } 23271 } 23272 this.resetIdleTimer(); 23273 23274 const token = this.getToken(); 23275 const query = inputElement.value.trim(); 23276 const requestId = ++this.latestLocationRequestId; 23277 23278 const params = { 23279 input: query, 23280 languagecode: 'en', 23281 regioncode: 'us', 23282 sessiontoken: token, 23283 }; 23284 23285 const data = await this.fetchSuggestions(CONFIG.urls.locationsSuggestions, params); 23286 23287 if (requestId !== this.latestLocationRequestId || !autocompleteSessionActive || !isInputFocused()) { 23288 return []; 23289 } 23290 23291 return data || []; 23292 }, 23293 keys: ['Description'], 23294 cache: false, 23295 }, 23296 resultsList: { 23297 element: (list, data) => { 23298 list.classList.add(CLASSES.AUTOCOMPLETE_LIST, `${CLASSES.AUTOCOMPLETE_LIST}--location`); 23299 23300 if (data.results.length > 0) { 23301 this.$locationInput.addClass(CLASSES.AUTOCOMPLETE_ACTIVE); 23302 } else { 23303 this.$locationInput.removeClass(CLASSES.AUTOCOMPLETE_ACTIVE); 23304 } 23305 23306 list.addEventListener('mouseover', this.createMouseoverHandler(this.locationAutocomplete)); 23307 }, 23308 noResults: false, 23309 maxResults: 5, 23310 tabSelect: true, 23311 }, 23312 resultItem: { 23313 highlight: true, 23314 element: (item, data) => { 23315 const description = data.value.Description; 23316 item.innerHTML = description.replace(', USA', ''); 23317 }, 23318 }, 23319 events: { 23320 input: { 23321 focus: () => { 23322 if (this.locationAutocomplete.input.value.length >= CONFIG.minChars) { 23323 this.locationAutocomplete.start(); 23324 } 23325 }, 23326 blur: () => { 23327 autocompleteSessionActive = false; 23328 this.locationAutocomplete.close(); 23329 }, 23330 close: () => { 23331 autocompleteSessionActive = false; 23332 this.$locationInput.removeClass(CLASSES.AUTOCOMPLETE_ACTIVE); 23333 }, 23334 open: () => { 23335 this.$locationInput.addClass(CLASSES.AUTOCOMPLETE_ACTIVE); 23336 }, 23337 }, 23338 }, 23339 }); 23340 23341 this.locationAutocomplete.input.addEventListener('selection', (event) => { 23342 const item = event.detail.selection.value; 23343 const newValue = item.Description.replace(', USA', ''); 23344 const currentValue = event.target.value; 23345 23346 if (currentValue === newValue) { 23347 return; 23348 } 23349 23350 event.target.value = newValue; 23351 this.$locationInput.trigger('input'); 23352 23353 autocompleteSessionActive = false; 23354 this.endSession(); 23355 23356 this.justSelected = true; 23357 setTimeout(() => { 23358 this.justSelected = false; 23359 }, CONFIG.selectionDelayMs); 23360 }); 23361 23362 // Pre-select first item on results 23363 this.locationAutocomplete.input.addEventListener('results', () => { 23364 setTimeout(() => { 23365 if (this.locationAutocomplete.data.store?.length > 0) { 23366 this.locationAutocomplete.goTo(0); 23367 } 23368 }, 0); 23369 }); 23370 } 23371 23372 // Setup autocomplete for advisor name input 23373 setupNameAutocomplete() { 23374 if (!this.$nameInput.length || typeof autoComplete === 'undefined') { 23375 return; 23376 } 23377 23378 const inputElement = this.$nameInput[0]; 23379 let searchCommitted = false; 23380 const isInputFocused = () => document.activeElement === inputElement; 23381 23382 this.nameAutocomplete = new autoComplete({ 23383 selector: SELECTORS.NAME_INPUT,
23384 placeHolder: inputElement.placeholder, 23385 threshold: CONFIG.minChars, 23386 debounce: CONFIG.debounceTimeout, 23387 wrapper: false, 23388 data: { 23389 src: async () => { 23390 const query = inputElement.value.trim(); 23391 const requestId = ++this.latestNameRequestId; 23392 23393 const params = { name: query }; 23394 const data = await this.fetchSuggestions(CONFIG.urls.advisorsSuggestions, params); 23395 23396 if (requestId !== this.latestNameRequestId || searchCommitted || !isInputFocused()) { 23397 return []; 23398 } 23399 23400 return data || []; 23401 }, 23402 keys: ['Name'], 23403 cache: false, 23404 }, 23405 resultsList: { 23406 element: (list, data) => { 23407 list.classList.add(CLASSES.AUTOCOMPLETE_LIST, `${CLASSES.AUTOCOMPLETE_LIST}--advisor`); 23408 23409 if (data.results.length > 0) { 23410 this.$nameInput.addClass(CLASSES.AUTOCOMPLETE_ACTIVE); 23411 } else { 23412 this.$nameInput.removeClass(CLASSES.AUTOCOMPLETE_ACTIVE); 23413 } 23414 23415 list.addEventListener('mouseover', this.createMouseoverHandler(this.nameAutocomplete)); 23416 }, 23417 noResults: false, 23418 maxResults: 5, 23419 tabSelect: true, 23420 }, 23421 resultItem: { 23422 highlight: true, 23423 }, 23424 events: { 23425 input: { 23426 focus: () => { 23427 searchCommitted = false; 23428 if (this.nameAutocomplete.input.value.length >= CONFIG.minChars) { 23429 this.nameAutocomplete.start(); 23430 } 23431 }, 23432 blur: () => { 23433 this.nameAutocomplete.close(); 23434 }, 23435 close: () => { 23436 this.$nameInput.removeClass(CLASSES.AUTOCOMPLETE_ACTIVE); 23437 }, 23438 open: () => { 23439 this.$nameInput.addClass(CLASSES.AUTOCOMPLETE_ACTIVE); 23440 }, 23441 }, 23442 }, 23443 }); 23444 23445 this.nameAutocomplete.input.addEventListener('selection', (event) => { 23446 const item = event.detail.selection.value; 23447 const newValue = item.Name; 23448 const currentValue = event.target.value; 23449 23450 if (currentValue === newValue) { 23451 return; 23452 } 23453 23454 event.target.value = newValue; 23455 this.$nameInput.trigger('input'); 23456 23457 searchCommitted = true; 23458 23459 this.justSelected = true; 23460 setTimeout(() => { 23461 this.justSelected = false; 23462 }, CONFIG.selectionDelayMs); 23463 }); 23464 } 23465 23466 init() { 23467 if (!this.$form.length) { 23468 return; 23469 } 23470 23471 this.setupLocationAutocomplete(); 23472 this.setupNameAutocomplete(); 23473 this.bindEvents(); 23474 } 23475 23476 handleEnterKey(event) { 23477 if (event.key !== 'Enter' || this.justSelected) { 23478 return; 23479 } 23480 this.handleSubmit(); 23481 } 23482 23483 bindEvents() { 23484 this.$form.on('submit', (e) => { 23485 e.preventDefault(); 23486 this.handleSubmit(); 23487 }); 23488 23489 this.$locationInput.on('keydown', (e) => this.handleEnterKey(e)); 23490 this.$nameInput.on('keydown', (e) => this.handleEnterKey(e)); 23491 23492 this.$locationInput.on('input', () => this.clearErrors()); 23493 this.$nameInput.on('input', () => this.clearErrors()); 23494 } 23495 23496 handleSubmit() { 23497 this.clearErrors(); 23498 23499 const location = this.$locationInput.val().trim(); 23500 const name = this.$nameInput.val().trim(); 23501 23502 if (!location && !name) { 23503 this.showErrors(); 23504 return false; 23505 } 23506 23507 const params = new URLSearchParams(); 23508 if (location) { 23509 params.append('location', location); 23510 } 23511 if (name) { 23512 params.append('name', name); 23513 } 23514 23515 // End the session before redirecting 23516 this.endSession(); 23517 23518 const baseUrl = this.$pageUrl.val() || '/find-an-advisor'; 23519 window.location.href = baseUrl + '?' + params.toString(); 23520 } 23521 23522 showErrors() {
23523 this.$errorText.addClass(CLASSES.ERROR_VISIBLE); 23524 this.$locationInput.addClass(CLASSES.HAS_ERROR).attr('aria-invalid', 'true'); 23525 this.$nameInput.addClass(CLASSES.HAS_ERROR).attr('aria-invalid', 'true'); 23526 } 23527 23528 clearErrors() { 23529 this.$errorText.removeClass(CLASSES.ERROR_VISIBLE); 23530 this.$locationInput.removeClass(CLASSES.HAS_ERROR).attr('aria-invalid', 'false'); 23531 this.$nameInput.removeClass(CLASSES.HAS_ERROR).attr('aria-invalid', 'false'); 23532 } 23533 } 23534 23535 $(function () { 23536 const $forms = $('.core-find-an-advisor'); 23537 if (!$forms.length) { 23538 return; 23539 } 23540 $forms.each((_, el) => new CoreFindAnAdvisor(el)); 23541 }); 23542})(jQuery); 23543;
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.