1/** 2 * File navigation.js. 3 * 4 * Handles toggling the navigation menu for small screens and enables TAB key 5 * navigation support for dropdown menus. 6 */ 7( function() { 8 var container, button, menu, links, i, len; 9 10 container = document.getElementById( 'site-navigation' ); 11 if ( ! container ) { 12 return; 13 } 14 15 button = container.getElementsByTagName( 'button' )[0]; 16 if ( 'undefined' === typeof button ) { 17 return; 18 } 19 20 menu = container.getElementsByTagName( 'ul' )[0]; 21 22 // Hide menu toggle button if menu is empty and return early. 23 if ( 'undefined' === typeof menu ) { 24 button.style.display = 'none'; 25 return; 26 } 27 28 menu.setAttribute( 'aria-expanded', 'false' ); 29 if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { 30 menu.className += ' nav-menu'; 31 } 32 33 button.onclick = function() { 34 if ( -1 !== container.className.indexOf( 'toggled' ) ) { 35 container.className = container.className.replace( ' toggled', '' ); 36 button.setAttribute( 'aria-expanded', 'false' ); 37 menu.setAttribute( 'aria-expanded', 'false' ); 38 } else { 39 container.className += ' toggled'; 40 button.setAttribute( 'aria-expanded', 'true' ); 41 menu.setAttribute( 'aria-expanded', 'true' ); 42 } 43 }; 44 45 // Get all the link elements within the menu. 46 links = menu.getElementsByTagName( 'a' ); 47 48 // Each time a menu link is focused or blurred, toggle focus. 49 for ( i = 0, len = links.length; i < len; i++ ) { 50 links[i].addEventListener( 'focus', toggleFocus, true ); 51 links[i].addEventListener( 'blur', toggleFocus, true ); 52 } 53 54 /** 55 * Sets or removes .focus class on an element. 56 */ 57 function toggleFocus() { 58 var self = this; 59 60 // Move up through the ancestors of the current link until we hit .nav-menu. 61 while ( -1 === self.className.indexOf( 'nav-menu' ) ) { 62 63 // On li elements toggle the class .focus. 64 if ( 'li' === self.tagName.toLowerCase() ) { 65 if ( -1 !== self.className.indexOf( 'focus' ) ) { 66 self.className = self.className.replace( ' focus', '' ); 67 } else { 68 self.className += ' focus'; 69 } 70 } 71 72 self = self.parentElement; 73 } 74 } 75 76 /** 77 * Toggles `focus` class to allow submenu access on tablets. 78 */ 79 ( function( container ) { 80 var touchStartFn, i, 81 parentLink = container.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' ); 82 83 if ( 'ontouchstart' in window ) { 84 touchStartFn = function( e ) { 85 var menuItem = this.parentNode, i; 86 87 if ( ! menuItem.classList.contains( 'focus' ) ) { 88 e.preventDefault(); 89 for ( i = 0; i < menuItem.parentNode.children.length; ++i ) { 90 if ( menuItem === menuItem.parentNode.children[i] ) { 91 continue; 92 } 93 menuItem.parentNode.children[i].classList.remove( 'focus' ); 94 } 95 menuItem.classList.add( 'focus' ); 96 } else { 97 menuItem.classList.remove( 'focus' ); 98 } 99 }; 100 101 for ( i = 0; i < parentLink.length; ++i ) { 102 parentLink[i].addEventListener( 'touchstart', touchStartFn, false ); 103 } 104 } 105 }( container ) ); 106} )(); 107; 108/** 109 * File skip-link-focus-fix.js. 110 * 111 * Helps with accessibility for keyboard only users. 112 * 113 * Learn more: https://git.io/vWdr2 114 */ 115(function() { 116 var isIe = /(trident|msie)/i.test( navigator.userAgent ); 117 118 if ( isIe && document.getElementById && window.addEventListener ) { 119 window.addEventListener( 'hashchange', function() { 120 var id = location.hash.substring( 1 ), 121 element; 122 123 if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { 124 return; 125 } 126 127 element = document.getElementById( id ); 128 129 if ( element ) { 130 if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { 131 element.tabIndex = -1; 132 } 133 134 element.focus(); 135 } 136 }, false ); 137 } 138})(); 139; 140/* 141 _ _ _ _ 142 ___| (_) ___| | __ (_)___ 143/ __| | |/ __| |/ / | / __| 144\__ \ | | (__| < _ | \__ \ 145|___/_|_|\___|_|\_(_)/ |___/ 146 |__/ 147 148 Version: 1.6.0 149 Author: Ken Wheeler 150 Website: http://kenwheeler.github.io 151 Docs: http://kenwheeler.github.io/slick 152 Repo: http://github.com/kenwheeler/slick 153 Issues: http://github.com/kenwheeler/slick/issues 154 155 */ 156/* global window, document, define, jQuery, setInterval, clearInterval */ 157(function(factory) { 158 'use strict'; 159 if (typeof define === 'function' && define.amd) { 160 define(['jquery'], factory); 161 } else if (typeof exports !== 'undefined') { 162 module.exports = factory(require('jquery')); 163 } else { 164 factory(jQuery); 165 } 166 167}(function($) { 168 'use strict'; 169 var Slick = window.Slick || {}; 170 171 Slick = (function() { 172 173 var instanceUid = 0; 174 175 function Slick(element, settings) { 176 177 var _ = this, dataSettings; 178 179 _.defaults = { 180 accessibility: true, 181 adaptiveHeight: false, 182 appendArrows: $(element), 183 appendDots: $(element), 184 arrows: true, 185 asNavFor: null, 186 prevArrow: '<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>', 187 nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button">Next</button>', 188 autoplay: false, 189 autoplaySpeed: 3000, 190 centerMode: false, 191 centerPadding: '50px', 192 cssEase: 'ease', 193 customPaging: function(slider, i) { 194 return $('<button type="button" data-role="none" role="button" tabindex="0" />').text(i + 1); 195 }, 196 dots: false, 197 dotsClass: 'slick-dots', 198 draggable: true, 199 easing: 'linear', 200 edgeFriction: 0.35, 201 fade: false, 202 focusOnSelect: false, 203 infinite: true, 204 initialSlide: 0, 205 lazyLoad: 'ondemand', 206 mobileFirst: false, 207 pauseOnHover: true, 208 pauseOnFocus: true, 209 pauseOnDotsHover: false, 210 respondTo: 'window', 211 responsive: null, 212 rows: 1, 213 rtl: false, 214 slide: '', 215 slidesPerRow: 1, 216 slidesToShow: 1, 217 slidesToScroll: 1, 218 speed: 500, 219 swipe: true, 220 swipeToSlide: false, 221 touchMove: true, 222 touchThreshold: 5, 223 useCSS: true, 224 useTransform: true, 225 variableWidth: false, 226 vertical: false, 227 verticalSwiping: false, 228 waitForAnimate: true, 229 zIndex: 1000 230 }; 231 232 _.initials = { 233 animating: false, 234 dragging: false, 235 autoPlayTimer: null, 236 currentDirection: 0, 237 currentLeft: null, 238 currentSlide: 0, 239 direction: 1, 240 $dots: null, 241 listWidth: null, 242 listHeight: null, 243 loadIndex: 0, 244 $nextArrow: null, 245 $prevArrow: null, 246 slideCount: null, 247 slideWidth: null, 248 $slideTrack: null, 249 $slides: null, 250 sliding: false, 251 slideOffset: 0, 252 swipeLeft: null, 253 $list: null, 254 touchObject: {}, 255 transformsEnabled: false,
256 unslicked: false 257 }; 258 259 $.extend(_, _.initials); 260 261 _.activeBreakpoint = null; 262 _.animType = null; 263 _.animProp = null; 264 _.breakpoints = []; 265 _.breakpointSettings = []; 266 _.cssTransitions = false; 267 _.focussed = false; 268 _.interrupted = false; 269 _.hidden = 'hidden'; 270 _.paused = true; 271 _.positionProp = null; 272 _.respondTo = null; 273 _.rowCount = 1; 274 _.shouldClick = true; 275 _.$slider = $(element); 276 _.$slidesCache = null; 277 _.transformType = null; 278 _.transitionType = null; 279 _.visibilityChange = 'visibilitychange'; 280 _.windowWidth = 0; 281 _.windowTimer = null; 282 283 dataSettings = $(element).data('slick') || {}; 284 285 _.options = $.extend({}, _.defaults, settings, dataSettings); 286 287 _.currentSlide = _.options.initialSlide; 288 289 _.originalSettings = _.options; 290 291 if (typeof document.mozHidden !== 'undefined') { 292 _.hidden = 'mozHidden'; 293 _.visibilityChange = 'mozvisibilitychange'; 294 } else if (typeof document.webkitHidden !== 'undefined') { 295 _.hidden = 'webkitHidden'; 296 _.visibilityChange = 'webkitvisibilitychange'; 297 } 298 299 _.autoPlay = $.proxy(_.autoPlay, _); 300 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 301 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 302 _.changeSlide = $.proxy(_.changeSlide, _); 303 _.clickHandler = $.proxy(_.clickHandler, _); 304 _.selectHandler = $.proxy(_.selectHandler, _); 305 _.setPosition = $.proxy(_.setPosition, _); 306 _.swipeHandler = $.proxy(_.swipeHandler, _); 307 _.dragHandler = $.proxy(_.dragHandler, _); 308 _.keyHandler = $.proxy(_.keyHandler, _); 309 310 _.instanceUid = instanceUid++; 311 312 // A simple way to check for HTML strings 313 // Strict HTML recognition (must start with <) 314 // Extracted from jQuery v1.11 source 315 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 316 317 318 _.registerBreakpoints(); 319 _.init(true); 320 321 } 322 323 return Slick; 324 325 }()); 326 327 Slick.prototype.activateADA = function() { 328 var _ = this; 329 330 _.$slideTrack.find('.slick-active').attr({ 331 'aria-hidden': 'false' 332 }).find('a, input, button, select').attr({ 333 'tabindex': '0' 334 }); 335 336 }; 337 338 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 339 340 var _ = this; 341 342 if (typeof(index) === 'boolean') { 343 addBefore = index; 344 index = null; 345 } else if (index < 0 || (index >= _.slideCount)) { 346 return false; 347 } 348 349 _.unload(); 350 351 if (typeof(index) === 'number') { 352 if (index === 0 && _.$slides.length === 0) { 353 $(markup).appendTo(_.$slideTrack); 354 } else if (addBefore) { 355 $(markup).insertBefore(_.$slides.eq(index)); 356 } else { 357 $(markup).insertAfter(_.$slides.eq(index)); 358 } 359 } else { 360 if (addBefore === true) { 361 $(markup).prependTo(_.$slideTrack); 362 } else { 363 $(markup).appendTo(_.$slideTrack); 364 } 365 } 366 367 _.$slides = _.$slideTrack.children(this.options.slide); 368 369 _.$slideTrack.children(this.options.slide).detach(); 370 371 _.$slideTrack.append(_.$slides); 372 373 _.$slides.each(function(index, element) { 374 $(element).attr('data-slick-index', index); 375 }); 376 377 _.$slidesCache = _.$slides; 378 379 _.reinit(); 380 381 }; 382 383 Slick.prototype.animateHeight = function() { 384 var _ = this; 385 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 386 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 387 _.$list.animate({ 388 height: targetHeight 389 }, _.options.speed); 390 } 391 }; 392 393 Slick.prototype.animateSlide = function(targetLeft, callback) { 394 395 var animProps = {}, 396 _ = this; 397 398 _.animateHeight(); 399 400 if (_.options.rtl === true && _.options.vertical === false) { 401 targetLeft = -targetLeft; 402 } 403 if (_.transformsEnabled === false) { 404 if (_.options.vertical === false) { 405 _.$slideTrack.animate({ 406 left: targetLeft 407 }, _.options.speed, _.options.easing, callback); 408 } else { 409 _.$slideTrack.animate({ 410 top: targetLeft 411 }, _.options.speed, _.options.easing, callback); 412 } 413 414 } else { 415 416 if (_.cssTransitions === false) { 417 if (_.options.rtl === true) { 418 _.currentLeft = -(_.currentLeft); 419 } 420 $({ 421 animStart: _.currentLeft 422 }).animate({ 423 animStart: targetLeft 424 }, { 425 duration: _.options.speed, 426 easing: _.options.easing, 427 step: function(now) { 428 now = Math.ceil(now); 429 if (_.options.vertical === false) { 430 animProps[_.animType] = 'translate(' + 431 now + 'px, 0px)'; 432 _.$slideTrack.css(animProps); 433 } else { 434 animProps[_.animType] = 'translate(0px,' + 435 now + 'px)'; 436 _.$slideTrack.css(animProps); 437 } 438 }, 439 complete: function() { 440 if (callback) { 441 callback.call(); 442 } 443 } 444 }); 445 446 } else { 447 448 _.applyTransition();
449 targetLeft = Math.ceil(targetLeft); 450 451 if (_.options.vertical === false) { 452 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 453 } else { 454 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 455 } 456 _.$slideTrack.css(animProps); 457 458 if (callback) { 459 setTimeout(function() { 460 461 _.disableTransition(); 462 463 callback.call(); 464 }, _.options.speed); 465 } 466 467 } 468 469 } 470 471 }; 472 473 Slick.prototype.getNavTarget = function() { 474 475 var _ = this, 476 asNavFor = _.options.asNavFor; 477 478 if ( asNavFor && asNavFor !== null ) { 479 asNavFor = $(asNavFor).not(_.$slider); 480 } 481 482 return asNavFor; 483 484 }; 485 486 Slick.prototype.asNavFor = function(index) { 487 488 var _ = this, 489 asNavFor = _.getNavTarget(); 490 491 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 492 asNavFor.each(function() { 493 var target = $(this).slick('getSlick'); 494 if(!target.unslicked) { 495 target.slideHandler(index, true); 496 } 497 }); 498 } 499 500 }; 501 502 Slick.prototype.applyTransition = function(slide) { 503 504 var _ = this, 505 transition = {}; 506 507 if (_.options.fade === false) { 508 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 509 } else { 510 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 511 } 512 513 if (_.options.fade === false) { 514 _.$slideTrack.css(transition); 515 } else { 516 _.$slides.eq(slide).css(transition); 517 } 518 519 }; 520 521 Slick.prototype.autoPlay = function() { 522 523 var _ = this; 524 525 _.autoPlayClear(); 526 527 if ( _.slideCount > _.options.slidesToShow ) { 528 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 529 } 530 531 }; 532 533 Slick.prototype.autoPlayClear = function() { 534 535 var _ = this; 536 537 if (_.autoPlayTimer) { 538 clearInterval(_.autoPlayTimer); 539 } 540 541 }; 542 543 Slick.prototype.autoPlayIterator = function() { 544 545 var _ = this, 546 slideTo = _.currentSlide + _.options.slidesToScroll; 547 548 if ( !_.paused && !_.interrupted && !_.focussed ) { 549 550 if ( _.options.infinite === false ) { 551 552 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 553 _.direction = 0; 554 } 555 556 else if ( _.direction === 0 ) { 557 558 slideTo = _.currentSlide - _.options.slidesToScroll; 559 560 if ( _.currentSlide - 1 === 0 ) { 561 _.direction = 1; 562 } 563 564 } 565 566 } 567 568 _.slideHandler( slideTo ); 569 570 } 571 572 }; 573 574 Slick.prototype.buildArrows = function() { 575 576 var _ = this; 577 578 if (_.options.arrows === true ) { 579 580 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 581 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 582 583 if( _.slideCount > _.options.slidesToShow ) { 584 585 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 586 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 587 588 if (_.htmlExpr.test(_.options.prevArrow)) { 589 _.$prevArrow.prependTo(_.options.appendArrows); 590 } 591 592 if (_.htmlExpr.test(_.options.nextArrow)) { 593 _.$nextArrow.appendTo(_.options.appendArrows); 594 } 595 596 if (_.options.infinite !== true) { 597 _.$prevArrow 598 .addClass('slick-disabled') 599 .attr('aria-disabled', 'true'); 600 } 601 602 } else { 603 604 _.$prevArrow.add( _.$nextArrow ) 605 606 .addClass('slick-hidden') 607 .attr({ 608 'aria-disabled': 'true', 609 'tabindex': '-1' 610 }); 611 612 } 613 614 } 615 616 }; 617 618 Slick.prototype.buildDots = function() { 619 620 var _ = this, 621 i, dot; 622 623 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 624 625 _.$slider.addClass('slick-dotted'); 626 627 dot = $('<ul />').addClass(_.options.dotsClass); 628 629 for (i = 0; i <= _.getDotCount(); i += 1) { 630 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 631 } 632 633 _.$dots = dot.appendTo(_.options.appendDots); 634 635 _.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false'); 636 637 } 638 639 }; 640 641 Slick.prototype.buildOut = function() { 642 643 var _ = this; 644 645 _.$slides = 646 _.$slider 647 .children( _.options.slide + ':not(.slick-cloned)') 648 .addClass('slick-slide'); 649 650 _.slideCount = _.$slides.length; 651 652 _.$slides.each(function(index, element) { 653 $(element) 654 .attr('data-slick-index', index) 655 .data('originalStyling', $(element).attr('style') || ''); 656 }); 657 658 _.$slider.addClass('slick-slider'); 659 660 _.$slideTrack = (_.slideCount === 0) ? 661 $('<div class="slick-track"/>').appendTo(_.$slider) : 662 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 663 664 _.$list = _.$slideTrack.wrap( 665 '<div aria-live="polite" class="slick-list"/>').parent(); 666 _.$slideTrack.css('opacity', 0); 667 668 if (_.options.centerMode === true || _.options.swipeToSlide === true) {
669 _.options.slidesToScroll = 1; 670 } 671 672 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 673 674 _.setupInfinite(); 675 676 _.buildArrows(); 677 678 _.buildDots(); 679 680 _.updateDots(); 681 682 683 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 684 685 if (_.options.draggable === true) { 686 _.$list.addClass('draggable'); 687 } 688 689 }; 690 691 Slick.prototype.buildRows = function() { 692 693 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 694 695 newSlides = document.createDocumentFragment(); 696 originalSlides = _.$slider.children(); 697 698 if(_.options.rows > 1) { 699 700 slidesPerSection = _.options.slidesPerRow * _.options.rows; 701 numOfSlides = Math.ceil( 702 originalSlides.length / slidesPerSection 703 ); 704 705 for(a = 0; a < numOfSlides; a++){ 706 var slide = document.createElement('div'); 707 for(b = 0; b < _.options.rows; b++) { 708 var row = document.createElement('div'); 709 for(c = 0; c < _.options.slidesPerRow; c++) { 710 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 711 if (originalSlides.get(target)) { 712 row.appendChild(originalSlides.get(target)); 713 } 714 } 715 slide.appendChild(row); 716 } 717 newSlides.appendChild(slide); 718 } 719 720 _.$slider.empty().append(newSlides); 721 _.$slider.children().children().children() 722 .css({ 723 'width':(100 / _.options.slidesPerRow) + '%', 724 'display': 'inline-block' 725 }); 726 727 } 728 729 }; 730 731 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 732 733 var _ = this, 734 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 735 var sliderWidth = _.$slider.width(); 736 var windowWidth = window.innerWidth || $(window).width(); 737 738 if (_.respondTo === 'window') { 739 respondToWidth = windowWidth; 740 } else if (_.respondTo === 'slider') { 741 respondToWidth = sliderWidth; 742 } else if (_.respondTo === 'min') { 743 respondToWidth = Math.min(windowWidth, sliderWidth); 744 } 745 746 if ( _.options.responsive && 747 _.options.responsive.length && 748 _.options.responsive !== null) { 749 750 targetBreakpoint = null; 751 752 for (breakpoint in _.breakpoints) { 753 if (_.breakpoints.hasOwnProperty(breakpoint)) { 754 if (_.originalSettings.mobileFirst === false) { 755 if (respondToWidth < _.breakpoints[breakpoint]) { 756 targetBreakpoint = _.breakpoints[breakpoint]; 757 } 758 } else { 759 if (respondToWidth > _.breakpoints[breakpoint]) { 760 targetBreakpoint = _.breakpoints[breakpoint]; 761 } 762 } 763 } 764 } 765 766 if (targetBreakpoint !== null) { 767 if (_.activeBreakpoint !== null) { 768 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 769 _.activeBreakpoint = 770 targetBreakpoint; 771 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 772 _.unslick(targetBreakpoint); 773 } else { 774 _.options = $.extend({}, _.originalSettings, 775 _.breakpointSettings[ 776 targetBreakpoint]); 777 if (initial === true) { 778 _.currentSlide = _.options.initialSlide; 779 } 780 _.refresh(initial); 781 }
782 triggerBreakpoint = targetBreakpoint; 783 } 784 } else { 785 _.activeBreakpoint = targetBreakpoint; 786 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 787 _.unslick(targetBreakpoint); 788 } else { 789 _.options = $.extend({}, _.originalSettings, 790 _.breakpointSettings[ 791 targetBreakpoint]); 792 if (initial === true) { 793 _.currentSlide = _.options.initialSlide; 794 } 795 _.refresh(initial); 796 } 797 triggerBreakpoint = targetBreakpoint; 798 } 799 } else { 800 if (_.activeBreakpoint !== null) { 801 _.activeBreakpoint = null; 802 _.options = _.originalSettings; 803 if (initial === true) { 804 _.currentSlide = _.options.initialSlide; 805 } 806 _.refresh(initial); 807 triggerBreakpoint = targetBreakpoint; 808 } 809 } 810 811 // only trigger breakpoints during an actual break. not on initialize. 812 if( !initial && triggerBreakpoint !== false ) { 813 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 814 } 815 } 816 817 }; 818 819 Slick.prototype.changeSlide = function(event, dontAnimate) { 820 821 var _ = this, 822 $target = $(event.currentTarget), 823 indexOffset, slideOffset, unevenOffset; 824 825 // If target is a link, prevent default action. 826 if($target.is('a')) { 827 event.preventDefault(); 828 } 829 830 // If target is not the <li> element (ie: a child), find the <li>. 831 if(!$target.is('li')) { 832 $target = $target.closest('li'); 833 } 834 835 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 836 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 837 838 switch (event.data.message) { 839 840 case 'previous': 841 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 842 if (_.slideCount > _.options.slidesToShow) { 843 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 844 } 845 break; 846 847 case 'next': 848 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 849 if (_.slideCount > _.options.slidesToShow) { 850 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 851 } 852 break; 853 854 case 'index': 855 var index = event.data.index === 0 ? 0 : 856 event.data.index || $target.index() * _.options.slidesToScroll; 857 858 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 859 $target.children().trigger('focus'); 860 break; 861 862 default: 863 return; 864 } 865 866 }; 867 868 Slick.prototype.checkNavigable = function(index) { 869 870 var _ = this, 871 navigables, prevNavigable; 872 873 navigables = _.getNavigableIndexes(); 874 prevNavigable = 0; 875 if (index > navigables[navigables.length - 1]) { 876 index = navigables[navigables.length - 1]; 877 } else { 878 for (var n in navigables) { 879 if (index < navigables[n]) { 880 index = prevNavigable; 881 break; 882 } 883 prevNavigable = navigables[n]; 884 } 885 } 886 887 return index; 888 }; 889 890 Slick.prototype.cleanUpEvents = function() { 891 892 var _ = this; 893 894 if (_.options.dots && _.$dots !== null) { 895 896 $('li', _.$dots) 897 .off('click.slick', _.changeSlide) 898 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 899 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 900 901 } 902 903 _.$slider.off('focus.slick blur.slick'); 904 905 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 906 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 907 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 908 } 909 910 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 911 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 912 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
913 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 914 915 _.$list.off('click.slick', _.clickHandler); 916 917 $(document).off(_.visibilityChange, _.visibility); 918 919 _.cleanUpSlideEvents(); 920 921 if (_.options.accessibility === true) { 922 _.$list.off('keydown.slick', _.keyHandler); 923 } 924 925 if (_.options.focusOnSelect === true) { 926 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 927 } 928 929 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 930 931 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 932 933 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 934 935 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 936 $(document).off('ready.slick.slick-' + _.instanceUid, _.setPosition); 937 938 }; 939 940 Slick.prototype.cleanUpSlideEvents = function() { 941 942 var _ = this; 943 944 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 945 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 946 947 }; 948 949 Slick.prototype.cleanUpRows = function() { 950 951 var _ = this, originalSlides; 952 953 if(_.options.rows > 1) { 954 originalSlides = _.$slides.children().children(); 955 originalSlides.removeAttr('style'); 956 _.$slider.empty().append(originalSlides); 957 } 958 959 }; 960 961 Slick.prototype.clickHandler = function(event) { 962 963 var _ = this; 964 965 if (_.shouldClick === false) { 966 event.stopImmediatePropagation(); 967 event.stopPropagation(); 968 event.preventDefault(); 969 } 970 971 }; 972 973 Slick.prototype.destroy = function(refresh) { 974 975 var _ = this; 976 977 _.autoPlayClear(); 978 979 _.touchObject = {}; 980 981 _.cleanUpEvents(); 982 983 $('.slick-cloned', _.$slider).detach(); 984 985 if (_.$dots) { 986 _.$dots.remove(); 987 } 988 989 990 if ( _.$prevArrow && _.$prevArrow.length ) { 991 992 _.$prevArrow 993 .removeClass('slick-disabled slick-arrow slick-hidden') 994 .removeAttr('aria-hidden aria-disabled tabindex') 995 .css('display',''); 996 997 if ( _.htmlExpr.test( _.options.prevArrow )) { 998 _.$prevArrow.remove(); 999 } 1000 } 1001 1002 if ( _.$nextArrow && _.$nextArrow.length ) { 1003 1004 _.$nextArrow 1005 .removeClass('slick-disabled slick-arrow slick-hidden') 1006 .removeAttr('aria-hidden aria-disabled tabindex') 1007 .css('display',''); 1008 1009 if ( _.htmlExpr.test( _.options.nextArrow )) { 1010 _.$nextArrow.remove(); 1011 } 1012 1013 } 1014 1015 1016 if (_.$slides) { 1017 1018 _.$slides 1019 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 1020 .removeAttr('aria-hidden') 1021 .removeAttr('data-slick-index') 1022 .each(function(){ 1023 $(this).attr('style', $(this).data('originalStyling')); 1024 }); 1025 1026 _.$slideTrack.children(this.options.slide).detach(); 1027 1028 _.$slideTrack.detach(); 1029 1030 _.$list.detach(); 1031 1032 _.$slider.append(_.$slides); 1033 } 1034 1035 _.cleanUpRows(); 1036 1037 _.$slider.removeClass('slick-slider'); 1038 _.$slider.removeClass('slick-initialized'); 1039 _.$slider.removeClass('slick-dotted'); 1040 1041 _.unslicked = true; 1042 1043 if(!refresh) { 1044 _.$slider.trigger('destroy', [_]); 1045 } 1046 1047 }; 1048 1049 Slick.prototype.disableTransition = function(slide) { 1050 1051 var _ = this, 1052 transition = {}; 1053 1054 transition[_.transitionType] = ''; 1055 1056 if (_.options.fade === false) { 1057 _.$slideTrack.css(transition); 1058 } else { 1059 _.$slides.eq(slide).css(transition); 1060 } 1061 1062 }; 1063 1064 Slick.prototype.fadeSlide = function(slideIndex, callback) { 1065 1066 var _ = this; 1067 1068 if (_.cssTransitions === false) { 1069 1070 _.$slides.eq(slideIndex).css({ 1071 zIndex: _.options.zIndex 1072 }); 1073 1074 _.$slides.eq(slideIndex).animate({ 1075 opacity: 1 1076 }, _.options.speed, _.options.easing, callback); 1077 1078 } else { 1079 1080 _.applyTransition(slideIndex); 1081 1082 _.$slides.eq(slideIndex).css({ 1083 opacity: 1, 1084 zIndex: _.options.zIndex 1085 }); 1086 1087 if (callback) { 1088 setTimeout(function() { 1089 1090 _.disableTransition(slideIndex); 1091 1092 callback.call(); 1093 }, _.options.speed); 1094 } 1095 1096 } 1097 1098 }; 1099 1100 Slick.prototype.fadeSlideOut = function(slideIndex) { 1101 1102 var _ = this; 1103 1104 if (_.cssTransitions === false) { 1105 1106 _.$slides.eq(slideIndex).animate({ 1107 opacity: 0, 1108 zIndex: _.options.zIndex - 2 1109 }, _.options.speed, _.options.easing); 1110 1111 } else { 1112 1113 _.applyTransition(slideIndex); 1114 1115 _.$slides.eq(slideIndex).css({ 1116 opacity: 0, 1117 zIndex: _.options.zIndex - 2 1118 }); 1119 1120 } 1121 1122 }; 1123
1124 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 1125 1126 var _ = this; 1127 1128 if (filter !== null) { 1129 1130 _.$slidesCache = _.$slides; 1131 1132 _.unload(); 1133 1134 _.$slideTrack.children(this.options.slide).detach(); 1135 1136 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 1137 1138 _.reinit(); 1139 1140 } 1141 1142 }; 1143 1144 Slick.prototype.focusHandler = function() { 1145 1146 var _ = this; 1147 1148 _.$slider 1149 .off('focus.slick blur.slick') 1150 .on('focus.slick blur.slick', 1151 '*:not(.slick-arrow)', function(event) { 1152 1153 event.stopImmediatePropagation(); 1154 var $sf = $(this); 1155 1156 setTimeout(function() { 1157 1158 if( _.options.pauseOnFocus ) { 1159 _.focussed = $sf.is(':focus'); 1160 _.autoPlay(); 1161 } 1162 1163 }, 0); 1164 1165 }); 1166 }; 1167 1168 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 1169 1170 var _ = this; 1171 return _.currentSlide; 1172 1173 }; 1174 1175 Slick.prototype.getDotCount = function() { 1176 1177 var _ = this; 1178 1179 var breakPoint = 0; 1180 var counter = 0; 1181 var pagerQty = 0; 1182 1183 if (_.options.infinite === true) { 1184 while (breakPoint < _.slideCount) { 1185 ++pagerQty; 1186 breakPoint = counter + _.options.slidesToScroll; 1187 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1188 } 1189 } else if (_.options.centerMode === true) { 1190 pagerQty = _.slideCount; 1191 } else if(!_.options.asNavFor) { 1192 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 1193 }else { 1194 while (breakPoint < _.slideCount) { 1195 ++pagerQty; 1196 breakPoint = counter + _.options.slidesToScroll; 1197 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1198 } 1199 } 1200 1201 return pagerQty - 1; 1202 1203 }; 1204 1205 Slick.prototype.getLeft = function(slideIndex) { 1206 1207 var _ = this, 1208 targetLeft, 1209 verticalHeight, 1210 verticalOffset = 0, 1211 targetSlide; 1212 1213 _.slideOffset = 0; 1214 verticalHeight = _.$slides.first().outerHeight(true); 1215 1216 if (_.options.infinite === true) { 1217 if (_.slideCount > _.options.slidesToShow) { 1218 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 1219 verticalOffset = (verticalHeight * _.options.slidesToShow) * -1; 1220 } 1221 if (_.slideCount % _.options.slidesToScroll !== 0) { 1222 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 1223 if (slideIndex > _.slideCount) { 1224 _.slideOffset = ((_.options.slidesToShow - (sl
1224ideIndex - _.slideCount)) * _.slideWidth) * -1; 1225 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 1226 } else { 1227 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 1228 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 1229 } 1230 } 1231 } 1232 } else { 1233 if (slideIndex + _.options.slidesToShow > _.slideCount) { 1234 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 1235 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 1236 } 1237 } 1238 1239 if (_.slideCount <= _.options.slidesToShow) { 1240 _.slideOffset = 0; 1241 verticalOffset = 0; 1242 } 1243 1244 if (_.options.centerMode === true && _.options.infinite === true) { 1245 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 1246 } else if (_.options.centerMode === true) { 1247 _.slideOffset = 0; 1248 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 1249 } 1250 1251 if (_.options.vertical === false) { 1252 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 1253 } else { 1254 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 1255 } 1256 1257 if (_.options.variableWidth === true) { 1258
1259 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 1260 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 1261 } else { 1262 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 1263 } 1264 1265 if (_.options.rtl === true) { 1266 if (targetSlide[0]) { 1267 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 1268 } else { 1269 targetLeft = 0; 1270 } 1271 } else { 1272 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1273 } 1274 1275 if (_.options.centerMode === true) { 1276 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 1277 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 1278 } else { 1279 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 1280 } 1281 1282 if (_.options.rtl === true) { 1283 if (targetSlide[0]) { 1284 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 1285 } else { 1286 targetLeft = 0; 1287 } 1288 } else { 1289 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1290 } 1291 1292 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 1293 } 1294 } 1295 1296 return targetLeft; 1297 1298 }; 1299 1300 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 1301 1302 var _ = this; 1303 1304 return _.options[option]; 1305 1306 }; 1307 1308 Slick.prototype.getNavigableIndexes = function() { 1309 1310 var _ = this, 1311 breakPoint = 0, 1312 counter = 0, 1313 indexes = [], 1314 max; 1315 1316 if (_.options.infinite === false) { 1317 max = _.slideCount; 1318 } else { 1319 breakPoint = _.options.slidesToScroll * -1; 1320 counter = _.options.slidesToScroll * -1; 1321 max = _.slideCount * 2; 1322 } 1323 1324 while (breakPoint < max) { 1325 indexes.push(breakPoint); 1326 breakPoint = counter + _.options.slidesToScroll; 1327 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1328 } 1329 1330 return indexes; 1331 1332 }; 1333 1334 Slick.prototype.getSlick = function() { 1335 1336 return this; 1337 1338 }; 1339 1340 Slick.prototype.getSlideCount = function() { 1341 1342 var _ = this, 1343 slidesTraversed, swipedSlide, centerOffset; 1344 1345 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 1346 1347 if (_.options.swipeToSlide === true) { 1348 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 1349 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 1350 swipedSlide = slide; 1351 return false; 1352 } 1353 }); 1354 1355 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 1356 1357 return slidesTraversed; 1358 1359 } else { 1360 return _.options.slidesToScroll; 1361 } 1362 1363 }; 1364 1365 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 1366 1367 var _ = this; 1368 1369 _.changeSlide({ 1370 data: { 1371 message: 'index', 1372 index: parseInt(slide) 1373 } 1374 }, dontAnimate); 1375 1376 }; 1377 1378 Slick.prototype.init = function(creation) { 1379 1380 var _ = this; 1381 1382 if (!$(_.$slider).hasClass('slick-initialized')) { 1383 1384 $(_.$slider).addClass('slick-initialized'); 1385 1386 _.buildRows(); 1387 _.buildOut(); 1388 _.setProps(); 1389 _.startLoad(); 1390 _.loadSlider(); 1391 _.initializeEvents(); 1392 _.updateArrows(); 1393 _.updateDots(); 1394 _.checkResponsive(true); 1395 _.focusHandler(); 1396 1397 } 1398 1399 if (creation) { 1400 _.$slider.trigger('init', [_]); 1401 } 1402 1403 if (_.options.accessibility === true) { 1404 _.initADA(); 1405 } 1406 1407 if ( _.options.autoplay ) { 1408 1409 _.paused = false;
1410 _.autoPlay(); 1411 1412 } 1413 1414 }; 1415 1416 Slick.prototype.initADA = function() { 1417 var _ = this; 1418 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 1419 'aria-hidden': 'true', 1420 'tabindex': '-1' 1421 }).find('a, input, button, select').attr({ 1422 'tabindex': '-1' 1423 }); 1424 1425 _.$slideTrack.attr('role', 'listbox'); 1426 1427 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 1428 $(this).attr({ 1429 'role': 'option', 1430 'aria-describedby': 'slick-slide' + _.instanceUid + i + '' 1431 }); 1432 }); 1433 1434 if (_.$dots !== null) { 1435 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 1436 $(this).attr({ 1437 'role': 'presentation', 1438 'aria-selected': 'false', 1439 'aria-controls': 'navigation' + _.instanceUid + i + '', 1440 'id': 'slick-slide' + _.instanceUid + i + '' 1441 }); 1442 }) 1443 .first().attr('aria-selected', 'true').end() 1444 .find('button').attr('role', 'button').end() 1445 .closest('div').attr('role', 'toolbar'); 1446 } 1447 _.activateADA(); 1448 1449 }; 1450 1451 Slick.prototype.initArrowEvents = function() { 1452 1453 var _ = this; 1454 1455 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1456 _.$prevArrow 1457 .off('click.slick') 1458 .on('click.slick', { 1459 message: 'previous' 1460 }, _.changeSlide); 1461 _.$nextArrow 1462 .off('click.slick') 1463 .on('click.slick', { 1464 message: 'next' 1465 }, _.changeSlide); 1466 } 1467 1468 }; 1469 1470 Slick.prototype.initDotEvents = function() { 1471 1472 var _ = this; 1473 1474 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1475 $('li', _.$dots).on('click.slick', { 1476 message: 'index' 1477 }, _.changeSlide); 1478 } 1479 1480 if ( _.options.dots === true && _.options.pauseOnDotsHover === true ) { 1481 1482 $('li', _.$dots) 1483 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 1484 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 1485 1486 } 1487 1488 }; 1489 1490 Slick.prototype.initSlideEvents = function() { 1491 1492 var _ = this; 1493 1494 if ( _.options.pauseOnHover ) { 1495 1496 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 1497 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 1498 1499 } 1500 1501 }; 1502 1503 Slick.prototype.initializeEvents = function() { 1504 1505 var _ = this; 1506 1507 _.initArrowEvents(); 1508 1509 _.initDotEvents(); 1510 _.initSlideEvents(); 1511 1512 _.$list.on('touchstart.slick mousedown.slick', { 1513 action: 'start' 1514 }, _.swipeHandler); 1515 _.$list.on('touchmove.slick mousemove.slick', { 1516 action: 'move' 1517 }, _.swipeHandler); 1518 _.$list.on('touchend.slick mouseup.slick', { 1519 action: 'end' 1520 }, _.swipeHandler);
1521 _.$list.on('touchcancel.slick mouseleave.slick', { 1522 action: 'end' 1523 }, _.swipeHandler); 1524 1525 _.$list.on('click.slick', _.clickHandler); 1526 1527 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 1528 1529 if (_.options.accessibility === true) { 1530 _.$list.on('keydown.slick', _.keyHandler); 1531 } 1532 1533 if (_.options.focusOnSelect === true) { 1534 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1535 } 1536 1537 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 1538 1539 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 1540 1541 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 1542 1543 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 1544 $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition); 1545 1546 }; 1547 1548 Slick.prototype.initUI = function() { 1549 1550 var _ = this; 1551 1552 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1553 1554 _.$prevArrow.show(); 1555 _.$nextArrow.show(); 1556 1557 } 1558 1559 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1560 1561 _.$dots.show(); 1562 1563 } 1564 1565 }; 1566 1567 Slick.prototype.keyHandler = function(event) { 1568 1569 var _ = this; 1570 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 1571 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 1572 if (event.keyCode === 37 && _.options.accessibility === true) { 1573 _.changeSlide({ 1574 data: { 1575 message: _.options.rtl === true ? 'next' : 'previous' 1576 } 1577 }); 1578 } else if (event.keyCode === 39 && _.options.accessibility === true) { 1579 _.changeSlide({ 1580 data: { 1581 message: _.options.rtl === true ? 'previous' : 'next' 1582 } 1583 }); 1584 } 1585 } 1586 1587 }; 1588 1589 Slick.prototype.lazyLoad = function() { 1590 1591 var _ = this, 1592 loadRange, cloneRange, rangeStart, rangeEnd; 1593 1594 function loadImages(imagesScope) { 1595 1596 $('img[data-lazy]', imagesScope).each(function() { 1597 1598 var image = $(this), 1599 imageSource = $(this).attr('data-lazy'), 1600 imageToLoad = document.createElement('img'); 1601 1602 imageToLoad.onload = function() { 1603 1604 image 1605 .animate({ opacity: 0 }, 100, function() { 1606 image 1607 .attr('src', imageSource) 1608 .animate({ opacity: 1 }, 200, function() { 1609 image 1610 .removeAttr('data-lazy') 1611 .removeClass('slick-loading'); 1612 }); 1613 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 1614 }); 1615 1616 }; 1617 1618 imageToLoad.onerror = function() { 1619 1620 image 1621 .removeAttr( 'data-lazy' ) 1622 .removeClass( 'slick-loading' ) 1623 .addClass( 'slick-lazyload-error' ); 1624 1625 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 1626 1627 }; 1628 1629 imageToLoad.src = imageSource; 1630 1631 }); 1632 1633 } 1634 1635 if (_.options.centerMode === true) { 1636 if (_.options.infinite === true) { 1637 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 1638 rangeEnd = rangeStart + _.options.slidesToShow + 2; 1639 } else { 1640 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 1641 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 1642 } 1643 } else { 1644 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 1645 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 1646 if (_.options.fade === true) { 1647 if (rangeStart > 0) rangeStart--; 1648 if (rangeEnd <= _.slideCount) rangeEnd++; 1649 } 1650 } 1651 1652 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 1653 loadImages(loadRange); 1654 1655 if (_.slideCount <= _.options.slidesToShow) { 1656 cloneRange = _.$slider.find('.slick-slide'); 1657 loadImages(cloneRange); 1658 } else 1659 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 1660 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 1661 loadImages(cloneRange); 1662 } else if (_.currentSlide === 0) { 1663 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 1664 loadImages(cloneRange); 1665 } 1666 1667 }; 1668 1669 Slick.prototype.loadSlider = function() { 1670 1671 var _ = this; 1672 1673 _.setPosition(); 1674 1675 _.$slideTrack.css({ 1676 opacity: 1 1677 }); 1678 1679 _.$slider.removeClass('slick-loading'); 1680 1681 _.initUI(); 1682 1683 if (_.options.lazyLoad === 'progressive') { 1684 _.progressiveLazyLoad(); 1685 } 1686 1687 }; 1688 1689 Slick.prototype.next = Slick.prototype.slickNext = function() { 1690 1691 var _ = this; 1692 1693 _.changeSlide({ 1694 data: { 1695 message: 'next' 1696 } 1697 }); 1698 1699 }; 1700 1701 Slick.prototype.orientationChange = function() { 1702 1703 var _ = this; 1704 1705 _.checkResponsive(); 1706 _.setPosition(); 1707 1708 }; 1709 1710 Slick.prototype.pause = Slick.prototype.slickPause = function() { 1711 1712 var _ = this; 1713 1714 _.autoPlayClear(); 1715 _.paused = true; 1716 1717 }; 1718 1719 Slick.prototype.play = Slick.prototype.slickPlay = function() { 1720 1721 var _ = this; 1722 1723 _.autoPlay();
1724 _.options.autoplay = true; 1725 _.paused = false; 1726 _.focussed = false; 1727 _.interrupted = false; 1728 1729 }; 1730 1731 Slick.prototype.postSlide = function(index) { 1732 1733 var _ = this; 1734 1735 if( !_.unslicked ) { 1736 1737 _.$slider.trigger('afterChange', [_, index]); 1738 1739 _.animating = false; 1740 1741 _.setPosition(); 1742 1743 _.swipeLeft = null; 1744 1745 if ( _.options.autoplay ) { 1746 _.autoPlay(); 1747 } 1748 1749 if (_.options.accessibility === true) { 1750 _.initADA(); 1751 } 1752 1753 } 1754 1755 }; 1756 1757 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 1758 1759 var _ = this; 1760 1761 _.changeSlide({ 1762 data: { 1763 message: 'previous' 1764 } 1765 }); 1766 1767 }; 1768 1769 Slick.prototype.preventDefault = function(event) { 1770 1771 event.preventDefault(); 1772 1773 }; 1774 1775 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 1776 1777 tryCount = tryCount || 1; 1778 1779 var _ = this, 1780 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 1781 image, 1782 imageSource, 1783 imageToLoad; 1784 1785 if ( $imgsToLoad.length ) { 1786 1787 image = $imgsToLoad.first(); 1788 imageSource = image.attr('data-lazy'); 1789 imageToLoad = document.createElement('img'); 1790 1791 imageToLoad.onload = function() { 1792 1793 image 1794 .attr( 'src', imageSource ) 1795 .removeAttr('data-lazy') 1796 .removeClass('slick-loading'); 1797 1798 if ( _.options.adaptiveHeight === true ) { 1799 _.setPosition(); 1800 } 1801 1802 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 1803 _.progressiveLazyLoad(); 1804 1805 }; 1806 1807 imageToLoad.onerror = function() { 1808 1809 if ( tryCount < 3 ) { 1810 1811 /** 1812 * try to load the image 3 times, 1813 * leave a slight delay so we don't get 1814 * servers blocking the request. 1815 */ 1816 setTimeout( function() { 1817 _.progressiveLazyLoad( tryCount + 1 ); 1818 }, 500 ); 1819 1820 } else { 1821 1822 image 1823 .removeAttr( 'data-lazy' ) 1824 .removeClass( 'slick-loading' ) 1825 .addClass( 'slick-lazyload-error' ); 1826 1827 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 1828 1829 _.progressiveLazyLoad(); 1830 1831 } 1832 1833 }; 1834 1835 imageToLoad.src = imageSource; 1836 1837 } else { 1838 1839 _.$slider.trigger('allImagesLoaded', [ _ ]); 1840 1841 } 1842 1843 }; 1844 1845 Slick.prototype.refresh = function( initializing ) { 1846 1847 var _ = this, currentSlide, lastVisibleIndex; 1848 1849 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 1850 1851 // in non-infinite sliders, we don't want to go past the 1852 // last visible index. 1853 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 1854 _.currentSlide = lastVisibleIndex; 1855 } 1856 1857 // if less slides than to show, go to start. 1858 if ( _.slideCount <= _.options.slidesToShow ) { 1859 _.currentSlide = 0; 1860 1861 } 1862 1863 currentSlide = _.currentSlide; 1864 1865 _.destroy(true); 1866 1867 $.extend(_, _.initials, { currentSlide: currentSlide }); 1868 1869 _.init(); 1870 1871 if( !initializing ) { 1872 1873 _.changeSlide({ 1874 data: { 1875 message: 'index', 1876 index: currentSlide 1877 } 1878 }, false); 1879 1880 } 1881 1882 }; 1883 1884 Slick.prototype.registerBreakpoints = function() { 1885 1886 var _ = this, breakpoint, currentBreakpoint, l, 1887 responsiveSettings = _.options.responsive || null; 1888 1889 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 1890 1891 _.respondTo = _.options.respondTo || 'window'; 1892 1893 for ( breakpoint in responsiveSettings ) { 1894 1895 l = _.breakpoints.length-1; 1896 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 1897 1898 if (responsiveSettings.hasOwnProperty(breakpoint)) { 1899 1900 // loop through the breakpoints and cut out any existing 1901 // ones with the same breakpoint number, we don't want dupes. 1902 while( l >= 0 ) { 1903 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 1904 _.breakpoints.splice(l,1); 1905 } 1906 l--; 1907 } 1908 1909 _.breakpoints.push(currentBreakpoint); 1910 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 1911 1912 } 1913 1914 } 1915 1916 _.breakpoints.sort(function(a, b) { 1917 return ( _.options.mobileFirst ) ? a-b : b-a; 1918 }); 1919 1920 } 1921 1922 }; 1923 1924 Slick.prototype.reinit = function() { 1925 1926 var _ = this; 1927 1928 _.$slides = 1929 _.$slideTrack 1930 .children(_.options.slide) 1931 .addClass('slick-slide'); 1932 1933 _.slideCount = _.$slides.length; 1934 1935 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 1936 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 1937 } 1938 1939 if (_.slideCount <= _.options.slidesToShow) { 1940 _.currentSlide = 0; 1941 } 1942 1943 _.registerBreakpoints(); 1944 1945 _.setProps(); 1946 _.setupInfinite(); 1947 _.buildArrows(); 1948 _.updateArrows(); 1949 _.initArrowEvents(); 1950 _.buildDots(); 1951 _.updateDots(); 1952 _.initDotEvents(); 1953 _.cleanUpSlideEvents(); 1954 _.initSlideEvents(); 1955 1956 _.checkResponsive(false, true); 1957 1958 if (_.options.focusOnSelect === true) { 1959 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1960 } 1961 1962 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 1963 1964 _.setPosition(); 1965 _.focusHandler(); 1966 1967 _.paused = !_.options.autoplay; 1968 _.autoPlay(); 1969 1970 _.$slider.trigger('reInit', [_]); 1971 1972 }; 1973 1974 Slick.prototype.resize = function() { 1975 1976 var _ = this; 1977 1978 if ($(window).width() !== _.windowWidth) { 1979 clearTimeout(_.windowDelay); 1980 _.windowDelay = window.setTimeout(function() { 1981 _.windowWidth = $(window).width(); 1982 _.checkResponsive();
1983 if( !_.unslicked ) { _.setPosition(); } 1984 }, 50); 1985 } 1986 }; 1987 1988 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 1989 1990 var _ = this; 1991 1992 if (typeof(index) === 'boolean') { 1993 removeBefore = index; 1994 index = removeBefore === true ? 0 : _.slideCount - 1; 1995 } else { 1996 index = removeBefore === true ? --index : index; 1997 } 1998 1999 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 2000 return false; 2001 } 2002 2003 _.unload(); 2004 2005 if (removeAll === true) { 2006 _.$slideTrack.children().remove(); 2007 } else { 2008 _.$slideTrack.children(this.options.slide).eq(index).remove(); 2009 } 2010 2011 _.$slides = _.$slideTrack.children(this.options.slide); 2012 2013 _.$slideTrack.children(this.options.slide).detach(); 2014 2015 _.$slideTrack.append(_.$slides); 2016 2017 _.$slidesCache = _.$slides; 2018 2019 _.reinit(); 2020 2021 }; 2022 2023 Slick.prototype.setCSS = function(position) { 2024 2025 var _ = this, 2026 positionProps = {}, 2027 x, y; 2028 2029 if (_.options.rtl === true) { 2030 position = -position; 2031 } 2032 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 2033 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 2034 2035 positionProps[_.positionProp] = position; 2036 2037 if (_.transformsEnabled === false) { 2038 _.$slideTrack.css(positionProps); 2039 } else { 2040 positionProps = {}; 2041 if (_.cssTransitions === false) { 2042 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 2043 _.$slideTrack.css(positionProps); 2044 } else { 2045 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 2046 _.$slideTrack.css(positionProps); 2047 } 2048 } 2049 2050 }; 2051 2052 Slick.prototype.setDimensions = function() { 2053 2054 var _ = this; 2055 2056 if (_.options.vertical === false) { 2057 if (_.options.centerMode === true) { 2058 _.$list.css({ 2059 padding: ('0px ' + _.options.centerPadding) 2060 }); 2061 } 2062 } else { 2063 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 2064 if (_.options.centerMode === true) { 2065 _.$list.css({ 2066 padding: (_.options.centerPadding + ' 0px') 2067 }); 2068 } 2069 } 2070 2071 _.listWidth = _.$list.width(); 2072 _.listHeight = _.$list.height(); 2073 2074 2075 if (_.options.vertical === false && _.options.variableWidth === false) { 2076 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 2077 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 2078 2079 } else if (_.options.variableWidth === true) { 2080 _.$slideTrack.width(5000 * _.slideCount); 2081 } else { 2082 _.slideWidth = Math.ceil(_.listWidth); 2083 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 2084 } 2085 2086 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 2087 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 2088 2089 }; 2090 2091 Slick.prototype.setFade = function() { 2092 2093 var _ = this, 2094 targetLeft; 2095 2096 _.$slides.each(function(index, element) { 2097 targetLeft = (_.slideWidth * index) * -1; 2098 if (_.options.rtl === true) { 2099 $(element).css({ 2100 position: 'relative', 2101 right: targetLeft, 2102 top: 0, 2103 zIndex: _.options.zIndex - 2, 2104 opacity: 0 2105 }); 2106 } else { 2107 $(element).css({ 2108 position: 'relative', 2109 left: targetLeft, 2110 top: 0, 2111 zIndex: _.options.zIndex - 2, 2112 opacity: 0 2113 }); 2114 } 2115 }); 2116 2117 _.$slides.eq(_.currentSlide).css({ 2118 zIndex: _.options.zIndex - 1, 2119 opacity: 1 2120 }); 2121 2122 }; 2123 2124 Slick.prototype.setHeight = function() { 2125 2126 var _ = this; 2127 2128 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 2129 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 2130 _.$list.css('height', targetHeight); 2131 } 2132 2133 }; 2134 2135 Slick.prototype.setOption = 2136 Slick.prototype.slickSetOption = function() { 2137 2138 /** 2139 * accepts arguments in format of: 2140 * 2141 * - for changing a single option's value: 2142 * .slick("setOption", option, value, refresh ) 2143 * 2144 * - for changing a set of responsive options: 2145 * .slick("setOption", 'responsive', [{}, ...], refresh ) 2146 * 2147 * - for updating multiple values at once (not responsive) 2148 * .slick("setOption", { 'option': value, ... }, refresh ) 2149 */ 2150 2151 var _ = this, l, item, option, value, refresh = false, t
2151ype; 2152 2153 if( $.type( arguments[0] ) === 'object' ) { 2154 2155 option = arguments[0]; 2156 refresh = arguments[1]; 2157 type = 'multiple'; 2158 2159 } else if ( $.type( arguments[0] ) === 'string' ) { 2160 2161 option = arguments[0]; 2162 value = arguments[1]; 2163 refresh = arguments[2]; 2164 2165 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 2166 2167 type = 'responsive'; 2168 2169 } else if ( typeof arguments[1] !== 'undefined' ) { 2170 2171 type = 'single'; 2172 2173 } 2174 2175 } 2176 2177 if ( type === 'single' ) { 2178 2179 _.options[option] = value; 2180 2181 2182 } else if ( type === 'multiple' ) { 2183 2184 $.each( option , function( opt, val ) { 2185 2186 _.options[opt] = val; 2187 2188 }); 2189 2190 2191 } else if ( type === 'responsive' ) { 2192 2193 for ( item in value ) { 2194 2195 if( $.type( _.options.responsive ) !== 'array' ) { 2196 2197 _.options.responsive = [ value[item] ]; 2198 2199 } else { 2200 2201 l = _.options.responsive.length-1; 2202 2203 // loop through the responsive object and splice out duplicates. 2204 while( l >= 0 ) { 2205 2206 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 2207 2208 _.options.responsive.splice(l,1); 2209 2210 } 2211 2212 l--; 2213 2214 } 2215 2216 _.options.responsive.push( value[item] ); 2217 2218 } 2219 2220 } 2221 2222 } 2223 2224 if ( refresh ) { 2225 2226 _.unload(); 2227 _.reinit(); 2228 2229 } 2230 2231 }; 2232 2233 Slick.prototype.setPosition = function() { 2234 2235 var _ = this; 2236 2237 _.setDimensions(); 2238 2239 _.setHeight(); 2240 2241 if (_.options.fade === false) { 2242 _.setCSS(_.getLeft(_.currentSlide)); 2243 } else { 2244 _.setFade(); 2245 } 2246 2247 _.$slider.trigger('setPosition', [_]); 2248 2249 }; 2250 2251 Slick.prototype.setProps = function() { 2252 2253 var _ = this, 2254 bodyStyle = document.body.style; 2255 2256 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 2257 2258 if (_.positionProp === 'top') { 2259 _.$slider.addClass('slick-vertical'); 2260 } else { 2261 _.$slider.removeClass('slick-vertical'); 2262 } 2263 2264 if (bodyStyle.WebkitTransition !== undefined || 2265 bodyStyle.MozTransition !== undefined || 2266 bodyStyle.msTransition !== undefined) { 2267 if (_.options.useCSS === true) { 2268 _.cssTransitions = true; 2269 } 2270 } 2271 2272 if ( _.options.fade ) { 2273 if ( typeof _.options.zIndex === 'number' ) { 2274 if( _.options.zIndex < 3 ) { 2275 _.options.zIndex = 3; 2276 } 2277 } else { 2278 _.options.zIndex = _.defaults.zIndex; 2279 } 2280 } 2281 2282 if (bodyStyle.OTransform !== undefined) { 2283 _.animType = 'OTransform'; 2284 _.transformType = '-o-transform'; 2285 _.transitionType = 'OTransition'; 2286 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
2287 } 2288 if (bodyStyle.MozTransform !== undefined) { 2289 _.animType = 'MozTransform'; 2290 _.transformType = '-moz-transform'; 2291 _.transitionType = 'MozTransition'; 2292 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 2293 } 2294 if (bodyStyle.webkitTransform !== undefined) { 2295 _.animType = 'webkitTransform'; 2296 _.transformType = '-webkit-transform'; 2297 _.transitionType = 'webkitTransition'; 2298 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 2299 } 2300 if (bodyStyle.msTransform !== undefined) { 2301 _.animType = 'msTransform'; 2302 _.transformType = '-ms-transform'; 2303 _.transitionType = 'msTransition'; 2304 if (bodyStyle.msTransform === undefined) _.animType = false; 2305 } 2306 if (bodyStyle.transform !== undefined && _.animType !== false) { 2307 _.animType = 'transform'; 2308 _.transformType = 'transform'; 2309 _.transitionType = 'transition'; 2310 } 2311 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 2312 }; 2313 2314 2315 Slick.prototype.setSlideClasses = function(index) { 2316 2317 var _ = this, 2318 centerOffset, allSlides, indexOffset, remainder; 2319 2320 allSlides = _.$slider 2321 .find('.slick-slide') 2322 .removeClass('slick-active slick-center slick-current') 2323 .attr('aria-hidden', 'true'); 2324 2325 _.$slides 2326 .eq(index) 2327 .addClass('slick-current'); 2328 2329 if (_.options.centerMode === true) { 2330 2331 centerOffset = Math.floor(_.options.slidesToShow / 2); 2332 2333 if (_.options.infinite === true) { 2334 2335 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 2336 2337 _.$slides 2338 .slice(index - centerOffset, index + centerOffset + 1) 2339 .addClass('slick-active') 2340 .attr('aria-hidden', 'false'); 2341 2342 } else { 2343 2344 indexOffset = _.options.slidesToShow + index; 2345 allSlides 2346 .slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2) 2347 .addClass('slick-active') 2348 .attr('aria-hidden', 'false'); 2349 2350 } 2351 2352 if (index === 0) { 2353 2354 allSlides 2355 .eq(allSlides.length - 1 - _.options.slidesToShow) 2356 .addClass('slick-center'); 2357 2358 } else if (index === _.slideCount - 1) { 2359 2360 allSlides 2361 .eq(_.options.slidesToShow) 2362 .addClass('slick-center'); 2363 2364 } 2365 2366 } 2367 2368 _.$slides 2369 .eq(index) 2370 .addClass('slick-center'); 2371 2372 } else { 2373 2374 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 2375 2376 _.$slides 2377 .slice(index, index + _.options.slidesToShow) 2378 .addClass('slick-active') 2379 .attr('aria-hidden', 'false'); 2380 2381 } else if (allSlides.length <= _.options.slidesToShow) { 2382 2383 allSlides 2384 .addClass('slick-active') 2385 .attr('aria-hidden', 'false'); 2386 2387 } else { 2388 2389 remainder = _.slideCount % _.options.slidesToShow; 2390 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 2391 2392 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 2393 2394 allSlides 2395 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 2396 .addClass('slick-active') 2397 .attr('aria-hidden', 'false'); 2398 2399 } else { 2400 2401 allSlides 2402 .slice(indexOffset, indexOffset + _.options.slidesToShow) 2403 .addClass('slick-active') 2404 .attr('aria-hidden', 'false'); 2405 2406 } 2407 2408 } 2409 2410 } 2411 2412 if (_.options.lazyLoad === 'ondemand') { 2413 _.lazyLoad(); 2414 } 2415 2416 }; 2417 2418 Slick.prototype.setupInfinite = function() { 2419 2420 var _ = this, 2421 i, slideIndex, infiniteCount; 2422 2423 if (_.options.fade === true) {
2424 _.options.centerMode = false; 2425 } 2426 2427 if (_.options.infinite === true && _.options.fade === false) { 2428 2429 slideIndex = null; 2430 2431 if (_.slideCount > _.options.slidesToShow) { 2432 2433 if (_.options.centerMode === true) { 2434 infiniteCount = _.options.slidesToShow + 1; 2435 } else { 2436 infiniteCount = _.options.slidesToShow; 2437 } 2438 2439 for (i = _.slideCount; i > (_.slideCount - 2440 infiniteCount); i -= 1) { 2441 slideIndex = i - 1; 2442 $(_.$slides[slideIndex]).clone(true).attr('id', '') 2443 .attr('data-slick-index', slideIndex - _.slideCount) 2444 .prependTo(_.$slideTrack).addClass('slick-cloned'); 2445 } 2446 for (i = 0; i < infiniteCount; i += 1) { 2447 slideIndex = i; 2448 $(_.$slides[slideIndex]).clone(true).attr('id', '') 2449 .attr('data-slick-index', slideIndex + _.slideCount) 2450 .appendTo(_.$slideTrack).addClass('slick-cloned'); 2451 } 2452 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 2453 $(this).attr('id', ''); 2454 }); 2455 2456 } 2457 2458 } 2459 2460 }; 2461 2462 Slick.prototype.interrupt = function( toggle ) { 2463 2464 var _ = this; 2465 2466 if( !toggle ) { 2467 _.autoPlay(); 2468 } 2469 _.interrupted = toggle; 2470 2471 }; 2472 2473 Slick.prototype.selectHandler = function(event) { 2474 2475 var _ = this; 2476 2477 var targetElement = 2478 $(event.target).is('.slick-slide') ? 2479 $(event.target) : 2480 $(event.target).parents('.slick-slide'); 2481 2482 var index = parseInt(targetElement.attr('data-slick-index')); 2483 2484 if (!index) index = 0; 2485 2486 if (_.slideCount <= _.options.slidesToShow) { 2487 2488 _.setSlideClasses(index); 2489 _.asNavFor(index); 2490 return; 2491 2492 } 2493 2494 _.slideHandler(index); 2495 2496 }; 2497 2498 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 2499 2500 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 2501 _ = this, navTarget; 2502 2503 sync = sync || false; 2504 2505 if (_.animating === true && _.options.waitForAnimate === true) { 2506 return; 2507 } 2508 2509 if (_.options.fade === true && _.currentSlide === index) { 2510 return; 2511 } 2512 2513 if (_.slideCount <= _.options.slidesToShow) { 2514 return; 2515 } 2516 2517 if (sync === false) { 2518 _.asNavFor(index); 2519 } 2520 2521 targetSlide = index; 2522 targetLeft = _.getLeft(targetSlide); 2523 slideLeft = _.getLeft(_.currentSlide); 2524 2525 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 2526 2527 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 2528 if (_.options.fade === false) { 2529 targetSlide = _.currentSlide; 2530 if (dontAnimate !== true) { 2531 _.animateSlide(slideLeft, function() { 2532 _.postSlide(targetSlide); 2533 }); 2534 } else { 2535 _.postSlide(targetSlide); 2536 } 2537 } 2538 return; 2539 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 2540 if (_.options.fade === false) { 2541 targetSlide = _.currentSlide; 2542 if (dontAnimate !== true) { 2543 _.animateSlide(slideLeft, function() { 2544 _.postSlide(targetSlide); 2545 }); 2546 } else { 2547 _.postSlide(targetSlide); 2548 } 2549 } 2550 return; 2551 } 2552 2553 if ( _.options.autoplay ) { 2554 clearInterval(_.autoPlayTimer); 2555 } 2556 2557 if (targetSlide < 0) { 2558 if (_.slideCount % _.options.slidesToScroll !== 0) { 2559 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 2560 } else { 2561 animSlide = _.slideCount + targetSlide; 2562 } 2563 }
2563 else if (targetSlide >= _.slideCount) { 2564 if (_.slideCount % _.options.slidesToScroll !== 0) { 2565 animSlide = 0; 2566 } else { 2567 animSlide = targetSlide - _.slideCount; 2568 } 2569 } else { 2570 animSlide = targetSlide; 2571 } 2572 2573 _.animating = true; 2574 2575 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 2576 2577 oldSlide = _.currentSlide; 2578 _.currentSlide = animSlide; 2579 2580 _.setSlideClasses(_.currentSlide); 2581 2582 if ( _.options.asNavFor ) { 2583 2584 navTarget = _.getNavTarget(); 2585 navTarget = navTarget.slick('getSlick'); 2586 2587 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 2588 navTarget.setSlideClasses(_.currentSlide); 2589 } 2590 2591 } 2592 2593 _.updateDots(); 2594 _.updateArrows(); 2595 2596 if (_.options.fade === true) { 2597 if (dontAnimate !== true) { 2598 2599 _.fadeSlideOut(oldSlide); 2600 2601 _.fadeSlide(animSlide, function() { 2602 _.postSlide(animSlide); 2603 }); 2604 2605 } else { 2606 _.postSlide(animSlide); 2607 } 2608 _.animateHeight(); 2609 return; 2610 } 2611 2612 if (dontAnimate !== true) { 2613 _.animateSlide(targetLeft, function() { 2614 _.postSlide(animSlide); 2615 }); 2616 } else { 2617 _.postSlide(animSlide); 2618 } 2619 2620 }; 2621 2622 Slick.prototype.startLoad = function() { 2623 2624 var _ = this; 2625 2626 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 2627 2628 _.$prevArrow.hide(); 2629 _.$nextArrow.hide(); 2630 2631 } 2632 2633 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 2634 2635 _.$dots.hide(); 2636 2637 } 2638 2639 _.$slider.addClass('slick-loading'); 2640 2641 }; 2642 2643 Slick.prototype.swipeDirection = function() { 2644 2645 var xDist, yDist, r, swipeAngle, _ = this; 2646 2647 xDist = _.touchObject.startX - _.touchObject.curX; 2648 yDist = _.touchObject.startY - _.touchObject.curY; 2649 r = Math.atan2(yDist, xDist); 2650 2651 swipeAngle = Math.round(r * 180 / Math.PI); 2652 if (swipeAngle < 0) { 2653 swipeAngle = 360 - Math.abs(swipeAngle); 2654 } 2655 2656 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 2657 return (_.options.rtl === false ? 'left' : 'right'); 2658 } 2659 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 2660 return (_.options.rtl === false ? 'left' : 'right'); 2661 } 2662 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 2663 return (_.options.rtl === false ? 'right' : 'left'); 2664 } 2665 if (_.options.verticalSwiping === true) { 2666 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 2667 return 'down'; 2668 } else { 2669 return 'up'; 2670 } 2671 } 2672 2673 return 'vertical'; 2674 2675 }; 2676 2677 Slick.prototype.swipeEnd = function(event) { 2678 2679 var _ = this, 2680 slideCount, 2681 direction; 2682 2683 _.dragging = false; 2684 _.interrupted = false; 2685 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 2686 2687 if ( _.touchObject.curX === undefined ) { 2688 return false; 2689 } 2690 2691 if ( _.touchObject.edgeHit === true ) { 2692 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 2693 } 2694 2695 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 2696 2697 direction = _.swipeDirection(); 2698 2699 switch ( direction ) { 2700 2701 case 'left': 2702 case 'down': 2703 2704 slideCount = 2705 _.options.swipeToSlide ? 2706 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 2707 _.currentSlide + _.getSlideCount(); 2708 2709 _.currentDirection = 0; 2710 2711 break; 2712 2713 case 'right': 2714 case 'up': 2715 2716 slideCount = 2717 _.options.swipeToSlide ? 2718 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 2719 _.currentSlide - _.getSlideCount(); 2720 2721 _.currentDirection = 1; 2722 2723 break; 2724 2725 default: 2726 2727 2728 } 2729 2730 if( direction != 'vertical' ) { 2731 2732 _.slideHandler( slideCount ); 2733 _.touchObject = {}; 2734 _.$slider.trigger('swipe', [_, direction ]); 2735 2736 } 2737 2738 } else { 2739 2740 if ( _.touchObject.startX !== _.touchObject.curX ) { 2741 2742 _.slideHandler( _.currentSlide ); 2743 _.touchObject = {}; 2744 2745 } 2746 2747 } 2748 2749 }; 2750 2751 Slick.prototype.swipeHandler = function(event) { 2752 2753 var _ = this; 2754 2755 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 2756 return; 2757 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 2758 return; 2759 } 2760 2761 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 2762 event.originalEvent.touches.length : 1; 2763 2764 _.touchObject.minSwipe = _.listWidth / _.options 2765 .touchThreshold; 2766 2767 if (_.options.verticalSwiping === true) { 2768 _.touchObject.minSwipe = _.listHeight / _.options 2769 .touchThreshold; 2770 } 2771 2772 switch (event.data.action) { 2773 2774 case 'start': 2775 _.swipeStart(event); 2776 break; 2777 2778 case 'move': 2779 _.swipeMove(event); 2780 break; 2781 2782 case 'end': 2783 _.swipeEnd(event); 2784 break; 2785 2786 } 2787 2788 }; 2789 2790 Slick.prototype.swipeMove = function(event) { 2791 2792 var _ = this, 2793 edgeWasHit = false, 2794 curLeft, swipeDirection, swipeLength, positionOffset, touches; 2795 2796 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 2797 2798 if (!_.dragging || touches && touches.length !== 1) { 2799 return false;
2800 } 2801 2802 curLeft = _.getLeft(_.currentSlide); 2803 2804 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 2805 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 2806 2807 _.touchObject.swipeLength = Math.round(Math.sqrt( 2808 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 2809 2810 if (_.options.verticalSwiping === true) { 2811 _.touchObject.swipeLength = Math.round(Math.sqrt( 2812 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 2813 } 2814 2815 swipeDirection = _.swipeDirection(); 2816 2817 if (swipeDirection === 'vertical') { 2818 return; 2819 } 2820 2821 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 2822 event.preventDefault(); 2823 } 2824 2825 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 2826 if (_.options.verticalSwiping === true) { 2827 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 2828 } 2829 2830 2831 swipeLength = _.touchObject.swipeLength; 2832 2833 _.touchObject.edgeHit = false; 2834 2835 if (_.options.infinite === false) { 2836 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 2837 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 2838 _.touchObject.edgeHit = true; 2839 } 2840 } 2841 2842 if (_.options.vertical === false) { 2843 _.swipeLeft = curLeft + swipeLength * positionOffset; 2844 } else { 2845 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 2846 } 2847 if (_.options.verticalSwiping === true) { 2848 _.swipeLeft = curLeft + swipeLength * positionOffset; 2849 } 2850 2851 if (_.options.fade === true || _.options.touchMove === false) { 2852 return false; 2853 } 2854 2855 if (_.animating === true) { 2856 _.swipeLeft = null; 2857 return false; 2858 } 2859 2860 _.setCSS(_.swipeLeft); 2861 2862 }; 2863 2864 Slick.prototype.swipeStart = function(event) { 2865 2866 var _ = this, 2867 touches; 2868 2869 _.interrupted = true; 2870 2871 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 2872 _.touchObject = {}; 2873 return false; 2874 } 2875 2876 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 2877 touches = event.originalEvent.touches[0]; 2878 } 2879 2880 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 2881 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 2882 2883 _.dragging = true; 2884 2885 }; 2886 2887 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 2888 2889 var _ = this; 2890 2891 if (_.$slidesCache !== null) { 2892 2893 _.unload(); 2894 2895 _.$slideTrack.children(this.options.slide).detach(); 2896 2897 _.$slidesCache.appendTo(_.$slideTrack); 2898 2899 _.reinit(); 2900 2901 } 2902 2903 }; 2904 2905 Slick.prototype.unload = function() { 2906 2907 var _ = this; 2908 2909 $('.slick-cloned', _.$slider).remove(); 2910 2911 if (_.$dots) { 2912 _.$dots.remove(); 2913 } 2914 2915 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 2916 _.$prevArrow.remove(); 2917 } 2918 2919 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 2920 _.$nextArrow.remove(); 2921 } 2922 2923 _.$slides 2924 .removeClass('slick-slide slick-active slick-visible slick-current') 2925 .attr('aria-hidden', 'true') 2926 .css('width', ''); 2927 2928 }; 2929 2930 Slick.prototype.unslick = function(fromBreakpoint) { 2931 2932 var _ = this; 2933 _.$slider.trigger('unslick', [_, fromBreakpoint]); 2934 _.destroy(); 2935 2936 }; 2937 2938 Slick.prototype.updateArrows = function() { 2939 2940 var _ = this, 2941 centerOffset; 2942 2943 centerOffset = Math.floor(_.options.slidesToShow / 2); 2944 2945 if ( _.options.arrows === true && 2946 _.slideCount > _.options.slidesToShow && 2947 !_.options.infinite ) { 2948 2949 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2950 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2951 2952 if (_.currentSlide === 0) { 2953 2954 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2955 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2956 2957 } else if (_.currentSlide >
2957= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 2958 2959 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2960 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2961 2962 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 2963 2964 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2965 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2966 2967 } 2968 2969 } 2970 2971 }; 2972 2973 Slick.prototype.updateDots = function() { 2974 2975 var _ = this; 2976 2977 if (_.$dots !== null) { 2978 2979 _.$dots 2980 .find('li') 2981 .removeClass('slick-active') 2982 .attr('aria-hidden', 'true'); 2983 2984 _.$dots 2985 .find('li') 2986 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 2987 .addClass('slick-active') 2988 .attr('aria-hidden', 'false'); 2989 2990 } 2991 2992 }; 2993 2994 Slick.prototype.visibility = function() { 2995 2996 var _ = this; 2997 2998 if ( _.options.autoplay ) { 2999 3000 if ( document[_.hidden] ) { 3001 3002 _.interrupted = true; 3003 3004 } else { 3005 3006 _.interrupted = false; 3007 3008 } 3009 3010 } 3011 3012 }; 3013 3014 $.fn.slick = function() { 3015 var _ = this, 3016 opt = arguments[0], 3017 args = Array.prototype.slice.call(arguments, 1), 3018 l = _.length, 3019 i, 3020 ret; 3021 for (i = 0; i < l; i++) { 3022 if (typeof opt == 'object' || typeof opt == 'undefined') 3023 _[i].slick = new Slick(_[i], opt); 3024 else 3025 ret = _[i].slick[opt].apply(_[i].slick, args); 3026 if (typeof ret != 'undefined') return ret; 3027 } 3028 return _; 3029 }; 3030 3031})); 3032; 3033/*! 3034 * Theia Sticky Sidebar v1.5.0 3035 * https://github.com/WeCodePixels/theia-sticky-sidebar 3036 * 3037 * Glues your website's sidebars, making them permanently visible while scrolling. 3038 * 3039 * Copyright 2013-2016 WeCodePixels and other contributors 3040 * Released under the MIT license 3041 */ 3042 3043(function ($) { 3044 $.fn.theiaStickySidebar = function (options) { 3045 var defaults = { 3046 'containerSelector': '', 3047 'additionalMarginTop': 0, 3048 'additionalMarginBottom': 0, 3049 'updateSidebarHeight': true, 3050 'minWidth': 0, 3051 'disableOnResponsiveLayouts': true, 3052 'sidebarBehavior': 'modern' 3053 }; 3054 options = $.extend(defaults, options); 3055 3056 // Validate options 3057 options.additionalMarginTop = parseInt(options.additionalMarginTop) || 0; 3058 options.additionalMarginBottom = parseInt(options.additionalMarginBottom) || 0; 3059 3060 tryInitOrHookIntoEvents(options, this); 3061 3062 // Try doing init, otherwise hook into window.resize and document.scroll and try again then. 3063 function tryInitOrHookIntoEvents(options, $that) { 3064 var success = tryInit(options, $that); 3065 3066 if (!success) {
3067 console.log('TSS: Body width smaller than options.minWidth. Init is delayed.'); 3068 3069 $(document).scroll(function (options, $that) { 3070 return function (evt) { 3071 var success = tryInit(options, $that); 3072 3073 if (success) { 3074 $(this).unbind(evt); 3075 } 3076 }; 3077 }(options, $that)); 3078 $(window).resize(function (options, $that) { 3079 return function (evt) { 3080 var success = tryInit(options, $that); 3081 3082 if (success) { 3083 $(this).unbind(evt); 3084 } 3085 }; 3086 }(options, $that)) 3087 } 3088 } 3089 3090 // Try doing init if proper conditions are met. 3091 function tryInit(options, $that) { 3092 if (options.initialized === true) { 3093 return true; 3094 } 3095 3096 if ($('body').width() < options.minWidth) { 3097 return false; 3098 } 3099 3100 init(options, $that); 3101 3102 return true; 3103 } 3104 3105 // Init the sticky sidebar(s). 3106 function init(options, $that) { 3107 options.initialized = true; 3108 3109 // Add CSS 3110 $('head').append($('<style>.theiaStickySidebar:after {content: ""; display: table; clear: both;}</style>')); 3111 3112 $that.each(function () { 3113 var o = {}; 3114 3115 o.sidebar = $(this); 3116 3117 // Save options 3118 o.options = options || {}; 3119 3120 // Get container 3121 o.container = $(o.options.containerSelector); 3122 if (o.container.length == 0) { 3123 o.container = o.sidebar.parent(); 3124 } 3125 3126 // Create sticky sidebar 3127 o.sidebar.parents().css('-webkit-transform', 'none'); // Fix for WebKit bug - https://code.google.com/p/chromium/issues/detail?id=20574 3128 o.sidebar.css({ 3129 'position': 'relative', 3130 'overflow': 'visible', 3131 'margin-bottom': '20px', 3132 3133 // The "box-sizing" must be set to "content-box" because we set a fixed height to this element when the sticky
3133sidebar has a fixed position. 3134 '-webkit-box-sizing': 'border-box', 3135 '-moz-box-sizing': 'border-box', 3136 'box-sizing': 'border-box' 3137 }); 3138 3139 // Get the sticky sidebar element. If none has been found, then create one. 3140 o.stickySidebar = o.sidebar.find('.theiaStickySidebar'); 3141 if (o.stickySidebar.length == 0) { 3142 // Remove <script> tags, otherwise they will be run again when added to the stickySidebar. 3143 // var javaScriptMIMETypes = /(?:text|application)\/(?:x-)?(?:javascript|ecmascript)/i; 3144 // o.sidebar.find('script').filter(function(index, script) { 3145 // return script.type.length === 0 || script.type.match(javaScriptMIMETypes); 3146 // }).remove(); 3147 3148 o.stickySidebar = $('<div>').addClass('theiaStickySidebar').append(o.sidebar.children()); 3149 o.sidebar.append(o.stickySidebar); 3150 } 3151 3152 // Get existing top and bottom margins and paddings 3153 o.marginBottom = parseInt(o.sidebar.css('margin-bottom')); 3154 o.paddingTop = parseInt(o.sidebar.css('padding-top')); 3155 o.paddingBottom = parseInt(o.sidebar.css('padding-bottom')); 3156
3157 // Add a temporary padding rule to check for collapsable margins. 3158 var collapsedTopHeight = o.stickySidebar.offset().top; 3159 var collapsedBottomHeight = o.stickySidebar.outerHeight(); 3160 o.stickySidebar.css('padding-top', 1); 3161 o.stickySidebar.css('padding-bottom', 1); 3162 collapsedTopHeight -= o.stickySidebar.offset().top; 3163 collapsedBottomHeight = o.stickySidebar.outerHeight() - collapsedBottomHeight - collapsedTopHeight; 3164 if (collapsedTopHeight == 0) { 3165 o.stickySidebar.css('padding-top', 0); 3166 o.stickySidebarPaddingTop = 0; 3167 } 3168 else { 3169 o.stickySidebarPaddingTop = 1; 3170 } 3171 3172 if (collapsedBottomHeight == 0) { 3173 o.stickySidebar.css('padding-bottom', 0); 3174 o.stickySidebarPaddingBottom = 0; 3175 } 3176 else { 3177 o.stickySidebarPaddingBottom = 1; 3178 } 3179 3180 // We use this to know whether the user is scrolling up or down. 3181 o.previousScrollTop = null; 3182 3183 // Scroll top (value) when the sidebar has fixed position. 3184 o.fixedScrollTop = 0; 3185 3186 // Set sidebar to default values. 3187 resetSidebar(); 3188 3189 o.onScroll = function (o) { 3190 // Stop if the sidebar isn't visible. 3191 if (!o.stickySidebar.is(":visible")) { 3192 return; 3193 } 3194 3195 // Stop if the window is too small. 3196 if ($('body').width() < o.options.minWidth) { 3197 resetSidebar(); 3198 return; 3199 } 3200 3201 // Stop if the sidebar width is larger than the container width (e.g. the theme is responsive and the sidebar is now below the content) 3202 if (o.options.disableOnResponsiveLayouts) { 3203 var sidebarWidth = o.sidebar.outerWidth(o.sidebar.css('float') == 'none'); 3204 3205 if (sidebarWidth + 50 > o.container.width()) { 3206 resetSidebar(); 3207 return; 3208 } 3209 } 3210 3211 var scrollTop = $(document).scrollTop(); 3212 var position = 'static'; 3213 3214 // If the user has scrolled down enough for the sidebar to be clipped at the top, then we can consider changing its position. 3215 if (scrollTop >= o.sidebar.offset().top + (o.paddingTop - o.options.additionalMarginTop)) { 3216 // The top and bottom offsets, used in various calculations. 3217 var offsetTop = o.paddingTop + options.additionalMarginTop; 3218 var offsetBottom = o.paddingBottom + o.marginBottom + options.additionalMarginBottom; 3219 3220 // All top and bottom positions are relative to the window, not to the parent elemnts. 3221 var containerTop = o.sidebar.offset().top; 3222 var containerBottom = o.sidebar.offset().top + getClearedHeight(o.container); 3223 3224 // The top and bottom offsets relative to the window screen top (zero) and bottom (window height). 3225 var windowOffsetTop = 0 + options.additionalMarginTop; 3226 var windowOffsetBottom; 3227 3228 var sidebarSmallerThanWindow = (o.stickySidebar.outerHeight() + offsetTop + offsetBottom) < $(window).height(); 3229 if (sidebarSmallerThanWindow) { 3230 windowOffsetBottom = windowOffsetTop + o.stickySidebar.outerHeight(); 3231 } 3232 else { 3233 windowOffsetBottom = $(window).height() - o.marginBottom - o.paddingBottom - options.additionalMarginBottom; 3234 } 3235 3236 var staticLimitTop = containerTop - scrollTop + o.paddingTop; 3237 var staticLimitBottom = containerBottom - scrollTop - o.paddingBottom - o.marginBottom; 3238 3239 var top = o.stickySidebar.offset().top - scrollTop; 3240 var scrollTopDiff = o.previousScrollTop - scrollTop; 3241 3242 // If the sidebar position is fixed, then it won't move up or down by itself. So, we manually adjust the top coordinate. 3243 if (o.stickySidebar.css('position') == 'fixed') { 3244 if (o.options.sidebarBehavior == 'modern') { 3245 top += scrollTopDiff; 3246 } 3247 } 3248 3249 if (o.options.sidebarBehavior == 'stick-to-top') { 3250 top = options.additionalMarginTop; 3251 } 3252 3253 if (o.options.sidebarBehavior == 'stick-to-bottom') { 3254 top = windowOffsetBottom - o.stickySidebar.outerHeight(); 3255 } 3256 3257 if (scrollTopDiff > 0) { // If the user is scrolling up. 3258 top = Math.min(top, windowOffsetTop); 3259 } 3260 else { // If the user is scrolling down. 3261 top = Math.max(top, windowOffsetBottom - o.stickySidebar.outerHeight()); 3262 } 3263 3264 top = Math.max(top, staticLimitTop); 3265 3266 top = Math.min(top, staticLimitBottom - o.stickySidebar.outerHeight()); 3267 3268 // If the sidebar is the same height as the container, we won't use fixed positioning. 3269 var sidebarSameHeightAsContainer = o.container.height() == o.stickySidebar.outerHeight(); 3270 3271 if (!sidebarSameHeightAsContainer && top == windowOffsetTop) { 3272 position = 'fixed'; 3273 } 3274 else if (!sidebarSameHeightAsContainer && top == windowOffsetBottom - o.stickySidebar.outerHeight()) { 3275 position = 'fixed'; 3276 } 3277 else if (scrollTop + top - o.sidebar.offset().top - o.paddingTop <= options.additionalMarginTop) { 3278 // Stuck to the top of the page. No special behavior. 3279 position = 'static'; 3280 } 3281 else { 3282 // Stuck to the bottom of the page. 3283 position = 'absolute'; 3284 } 3285 } 3286 3287 /*
3288 * Performance notice: It's OK to set these CSS values at each resize/scroll, even if they don't change. 3289 * It's way slower to first check if the values have changed. 3290 */ 3291 if (position == 'fixed') { 3292 o.stickySidebar.css({ 3293 'position': 'fixed', 3294 'width': getWidthForObject(o.stickySidebar) + 'px', 3295 'transform': 'translateY(' + top + 'px)', 3296 'left': (o.sidebar.offset().left + parseInt(o.sidebar.css('padding-left'))) + 'px', 3297 'top': '0px' 3298 }); 3299 } 3300 else if (position == 'absolute') { 3301 var css = {}; 3302 3303 if (o.stickySidebar.css('position') != 'absolute') { 3304 css.position = 'absolute'; 3305 css.transform = 'translateY(' + (scrollTop + top - o.sidebar.offset().top - o.stickySidebarPaddingTop - o.stickySidebarPaddingBottom) + 'px)'; 3306 css.top = '0px'; 3307 } 3308 3309 css.width = getWidthForObject(o.stickySidebar) + 'px'; 3310 css.left = ''; 3311 3312 o.stickySidebar.css(css); 3313 } 3314 else if (position == 'static') { 3315 resetSidebar(); 3316 } 3317 3318 if (position != 'static') { 3319 if (o.options.updateSidebarHeight == true) { 3320 o.sidebar.css({ 3321 'min-height': o.stickySidebar.outerHeight() + o.stickySidebar.offset().top - o.sidebar.offset().top + o.paddingBottom 3322 }); 3323 } 3324 } 3325 3326 o.previousScrollTop = scrollTop; 3327 }; 3328 3329 // Initialize the sidebar's position. 3330 o.onScroll(o); 3331 3332 // Recalculate the sidebar's position on every scroll and resize. 3333 $(document).scroll(function (o) { 3334 return function () { 3335 o.onScroll(o); 3336 }; 3337 }(o)); 3338 $(window).resize(function (o) { 3339 return function () { 3340 o.stickySidebar.css({'position': 'static'}); 3341 o.onScroll(o); 3342 }; 3343 }(o)); 3344 3345 // Reset the sidebar to its default state 3346 function resetSidebar() { 3347 o.fixedScrollTop = 0; 3348 o.sidebar.css({ 3349 'min-height': '1px' 3350 }); 3351 o.stickySidebar.css({ 3352 'position': 'static', 3353 'width': '', 3354 'transform': 'none' 3355 }); 3356 } 3357 3358 // Get the height of a div as if its floated children were cleared. Note that this function fails if the floats are more than one level deep. 3359 function getClearedHeight(e) { 3360 var height = e.height(); 3361 3362 e.children().each(function () { 3363 height = Math.max(height, $(this).height()); 3364 }); 3365 3366 return height; 3367 } 3368 }); 3369 } 3370 3371 function getWidthForObject(object) { 3372 var width; 3373 3374 try { 3375 width = object[0].getBoundingClientRect().width; 3376 } 3377 catch(err) { 3378 } 3379 3380 if (typeof width === "undefined") { 3381 width = object.width(); 3382 } 3383 3384 return width; 3385 } 3386 } 3387})(jQuery); 3388; 3389jQuery(function($) { 3390 'use strict'; 3391 3392 var $window = $(window), 3393 $body = $('body'), 3394 $navBar = $('.navbar'), 3395 clickEvent = 'ontouchstart' in window ? 'touchstart' : 'click'; 3396 3397 function searchForm() { 3398 $(".header-search button.header-search__click").on("click", function() { 3399 $(".header-search__wrapper").fadeToggle(); 3400 $(".header-search > .header-search__click").fadeToggle('fast'); 3401 $(".header-search__wrapper input.search-field").focus(); 3402 }); 3403
3404 //esc key close search field 3405 $(document).on("keyup", function(e) { 3406 if (e.keyCode == 27) { // escape key maps to keycode `27` 3407 $(".header-search__wrapper").fadeOut(300); 3408 $(".header-search > .header-search__click").fadeIn() 3409 } 3410 }); 3411 } 3412 3413 //sticky Header 3414 function stickyHeader() { 3415 $(window).scroll(function() { 3416 if ($("div").hasClass("header-content")) { 3417 3418 if ($(window).scrollTop() > 0) { 3419 $(".site-header").css("margin-top", $(".header-content").height()); 3420 $(".site-header").addClass("sticky-header"); 3421 3422 if ($("body").hasClass("admin-bar")) { 3423 $(".header-content").css("position", "fixed"); 3424 $(".header-content").css("top", $window.width() < 783 ? "46px" : "32px"); 3425 } else { 3426 $(".header-content").css("position", "fixed"); 3427 $(".header-content").css("top", "0"); 3428 } 3429 } else { 3430 $(".site-header").removeClass("sticky-header"); 3431 $(".site-header").css("margin-top", "0"); 3432 $(".header-content").css("position", "relative"); 3433 $(".header-content").css("top", "0"); 3434 } 3435 3436 if ($(window).width() < 601 && $("body").hasClass("admin-bar")) { 3437 if ($(window).scrollTop() > 46) { 3438 $(".header-content").css("position", "fixed"); 3439 $(".header-content").css("top", "0"); 3440 } else { 3441 $(".site-header").css("margin-top", "0"); 3442 $(".header-content").css("position", "relative"); 3443 $(".header-content").css("top", "0"); 3444 } 3445 } 3446 3447 } 3448 }) 3449 } 3450 3451 //Slider Gallery 3452 function slickGallery() { 3453 3454 $('.grid-gallery').slick({ 3455 focusOnSelect: true, 3456 swipeToSlide: true, 3457 adaptiveHeight: true, 3458 'nextArrow': '<i class="fa fa-angle-right slick-next"></i>', 3459 'prevArrow': '<i class="fa fa-angle-left slick-prev"></i>' 3460 }); 3461 $('.grid-gallery').slick('slickGoTo', 1); 3462 3463 $('.featured-posts .featured-post__content').slick({ 3464 lazyLoad: 'ondemand', 3465 dots: false, 3466 infinite: true, 3467 speed: 600, 3468 slidesToShow: 2, 3469 slidesToScroll: 1, 3470 autoplay: false, 3471 autoplaySpeed: 4000, 3472 centerMode: false, 3473 variableWidth: false, 3474 rtl: $body.hasClass('rtl') ? true : false, 3475 nextArrow: '<button type="button" class="slick-next slick-nav"><i class="fa fa-angle-right"></i></button>', 3476 prevArrow: '<button type="button" class="slick-prev slick-nav"><i class="fa fa-angle-left"></i></button>', 3477 responsive: [ 3478 { 3479 breakpoint: 960, 3480 settings: { 3481 slidesToShow: 1, 3482 slidesToScroll: 1, 3483 dots: true 3484 } 3485 }, 3486 { 3487 breakpoint: 480, 3488 settings: { 3489 slidesToShow: 1, 3490 slidesToScroll: 1, 3491 dots: true, 3492 arrows: false, 3493 } 3494 }, 3495 ] 3496 }); // slick 3497 } 3498 3499 /** 3500 * Refresh slick layout when infinite scroll finishes. 3501 */ 3502 function infiniteScrollRefresh() { 3503 $('.grid-gallery').not('.slick-initialized').slick({ 3504 'nextArrow': '<i class="fa fa-angle-right slick-next"></i>', 3505 'prevArrow': '<i class="fa fa-angle-left slick-prev"></i>' 3506 }); 3507 } 3508 3509 function toggleMobileMenu() { 3510 var $body = $('body'), 3511 mobileClass = 'mobile-menu-open', 3512 clickEvent = 'ontouchstart' in window ? 'touchstart' : 'click', 3513 transitionEnd = 'transitionend webkitTransitionEnd otransitionend MSTransitionEnd'; 3514 3515 // Click to show mobile menu. 3516 $('.menu-toggle').on(clickEvent, function(event) { 3517 event.preventDefault(); 3518 event.stopPropagation(); // Do not trigger click event on '.wrapper' below. 3519 if ($body.hasClass(mobileClass)) { 3520 return; 3521 } 3522 $body.addClass(mobileClass); 3523 }); 3524 3525 // When mobile menu is open, click on page content will close it. 3526 $('.site') 3527 .on(clickEvent, function(event) { 3528 if (!$body.hasClass(mobileClass)) { 3529 return; 3530 } 3531 event.preventDefault(); 3532 $body.removeClass(mobileClass).addClass('animating'); 3533 }) 3534 .on(transitionEnd, function() { 3535 $body.removeClass('animating'); 3536 }); 3537 } 3538 3539 /** 3540 * Add toggle dropdown icon for mobile menu. 3541 * @param $container 3542 */ 3543 function initMobileNavigation($container) { 3544 // Add dropdown toggle that displays child menu items. 3545 var $dropdownToggle = $('<span class="dropdown-toggle fa fa-angle-down"></span>'); 3546 3547 $container.find('.menu-item-has-children > a').after($dropdownToggle); 3548 3549 // Toggle buttons and sub menu items with active children menu items. 3550 $container.find('.current-menu-ancestor > .sub-menu').show(); 3551 $container.find('.current-menu-ancestor > .dropdown-toggle').addClass('toggled-on'); 3552 $container.on(clickEvent, '.dropdown-toggle', function(e) { 3553 e.preventDefault(); 3554 $(this).toggleClass('toggled-on'); 3555 $(this).next('ul').toggle(); 3556 }); 3557 } 3558 3559 /** 3560 * Scroll to top 3561 */ 3562 function scrollToTop() { 3563 var $window = $(window), 3564 $button = $('.scroll-to-top'); 3565 $window.scroll(function() { 3566 $button[$window.scrollTop() > 100 ? 'removeClass' : 'addClass']('hidden'); 3567 }); 3568 $button.on('click', function(e) { 3569 e.preventDefault(); 3570 $('body, html').animate({ 3571 scrollTop: 0 3572 }, 500); 3573 }); 3574 } 3575 3576 /** 3577 * Sticky Sidebar 3578 */ 3579 function stickySidebar() { 3580 3581 var offset = 0; 3582 3583 $('.add_sticky_sidebar').theiaStickySidebar({ 3584 additionalMarginTop: offset 3585 }); 3586 3587 } 3588 3589 // Rearrange projects after infinite scroll finishes loading posts. 3590 $(document.body).on('post-load', infiniteScrollRefresh); 3591 3592 stickyHeader(); 3593 scrollToTop(); 3594 searchForm(); 3595 $(window).on( 'load', slickGallery ); 3596 toggleMobileMenu(); 3597 initMobileNavigation($('.mobile-menu')); 3598 stickySidebar(); 3599}); 3600; 3601!function(){"use strict";var e,t={noop:function(){}
3601,texturize:function(e){return(e=(e=(e=(e+="").replace(/'/g,"’").replace(/'/g,"’")).replace(/"/g,"”").replace(/"/g,"”").replace(/"/g,"”").replace(/[\u201D]/g,"”")).replace(/([\w]+)=&#[\d]+;(.+?)&#[\d]+;/g,'$1="$2"')).trim()},applyReplacements:function(e,t){if(e)return t?e.replace(/{(\d+)}/g,function(e,r){return void 0!==t[r]?t[r]:e}):e},getBackgroundImage:function(e){var t=document.createElement("canvas"),r=t.getContext&&t.getContext("2d");if(e){r.filter="blur(20px) ",r.drawImage(e,0,0);var o=t.toDataURL("image/png");return t=null,o}}},r=function(){function e(e,t){return Element.prototype.matches?e.matches(t):Element.prototype.msMatchesSelector?e.msMatchesSelector(t):void 0}function r(e,t,r,o){if(!e)return o();e.jpCarouselCancelFade&&e.jpCarouselCancelFade(),e.classList.remove("jp-carousel-fade"),e.style.removeProperty("display"),e.style.opacity=t,e.style.pointerEvents="none",e.offsetWidth,e.classList.add("jp-carousel-fade"),e.style.opacity=r;var a=1e3*parseFloat(getComputedStyle(e).transitionDuration)||0,i=setTimeout(function(){e.jpCarouselCancelFade=null,e.style.removeProperty("pointer-events"),o()},a+50);e.jpCarouselCancelFade=function(){clearTimeout(i),e.jpCarouselCancelFade=null}}return{closest:function(t,r){if(t.closest)return t.closest(r);var o=t;do{if(e(o,r))return o;o=o.parentElement||o.parentNode}while(null!==o&&1===o.nodeType);return null},matches:e,hide:function(e){e&&(e.style.display="none")},show:function(e){e&&(e.style.display="block")},fadeIn:function(e,o){r(e,0,1,o=o||t.noop)},fadeOut:function(e,o){o=o||t.noop,r(e,1,0,function(){e&&(e.style.display="none"),o()})},scrollToElement:function(e,t,r){if(!e||!t)return r?r():void 0;var o=t.querySelector(".jp-carousel-info-extra");o&&(o.style.minHeight=window.innerHeight-64+"px");var a=!0,i=Date.now(),n=t.scrollTop,l=Math.max(0,e.offsetTop-Math.max(0,window.innerHeight-function(e){var t=e.querySelector(".jp-carousel-info-footer"),r=e.querySelector(".jp-carousel-info-extra"),o=e.querySelector(".jp-carousel-info-content-wrapper");if(t&&r&&o){var a=window.getComputedStyle(r),i=parseInt(a.paddingTop,10)+parseInt(a.paddingBottom,10);return i=isNaN(i)?0:i,o.offsetHeight+t.offsetHeight+i}return 0}(t)))-t.scrollTop;function s(){a=!1}l=Math.min(l,t.scrollHeight-window.innerHeight),t.addEventListener("wheel",s),function e(){var c,u=Date.now(),d=(c=(u-i)/300)<.5?2*c*c:1-Math.pow(-2*c+2,2)/2,p=(d=d>1?1:d)*l;if(t.scrollTop=n+p,u<=i+300&&a)return requestAnimationFrame(e);r&&r(),o&&(o.style.minHeight=""),a=!1,t.removeEventListener("wheel",s)}()},getJSONAttribute:function(e,t){if(e&&e.hasAttribute(t))try{return JSON.parse(e.getAttribute(t))}catch{return}},convertToPlainText:function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML},stripHTML:function(e){var t=document.createElement("div");return t.innerHTML=e.replace(/<[^>]*>?/gm,""),t.textContent},emitEvent:function(e,t,r){var o;try{o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r||null})}catch{(o=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,r||null)}e.dispatchEvent(o)},isTouch:function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch}}}();function o(){var o,a,i,n,l="",s=!1,c="div.gallery, div.tiled-gallery, ul.wp-block-gallery, ul.blocks-gallery-grid, figure.wp-block-gallery.has-nested-images, div.wp-block-jetpack-tiled-gallery, a.single-image-gallery",u=".gallery-item, .tiled-gallery-item, .blocks-gallery-item, .tiled-gallery__item",d=u+", .wp-block-image",p={},m="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.stat?wpcom.carousel.stat:t.noop,g="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.pageview?wpcom.carousel.pageview:t.noop;function h(t){if(!s)switch(t.which){case 38:t.preventDefault(),p.overlay.scrollTop-=100;break;case 40:t.preventDefault(),p.overlay.scrollTop+=100;break;case 39:t.preventDefault(),e.slideNext();break;case 37:case 8:t.preventDefault(),e.slidePrev();break;case 27:t.preventDefault(),x()}}function f(){s=!0}function v(){s=!1}function y(e){e.role="button",e.tabIndex=0,e.ariaLabel=jetpackCarouselStrings.image_label}function w(){p.overlay||(p.overlay=document.querySelector(".jp-carousel-overlay"),p.container=p.overlay.querySelector(".jp-carousel-wrap"),p.gallery=p.container.querySelector(".jp-carousel"),p.info=p.overlay.querySelector(".jp-carousel-info"),p.caption=p.info.querySelector(".jp-carousel-caption"),p.commentField=p.overlay.querySelector("#jp-carousel-comment-form-comment-field"),p.emailField=p.overlay.querySelector("#jp-carousel-comment-form-email-field"),p.authorField=p.overlay.querySelector("#jp-carousel-comment-form-author-field"),p.urlField=p.overlay.querySelector("#jp-carousel-comment-form-url-field"),window.innerWidth<=760&&Math.round(window.innerWidth/760*110)<40&&r.isTouch(),[p.commentField,p.emailField,p.authorField,p.urlField].forEac
3601h(function(e){e&&(e.addEventListener("focus",f),e.addEventListener("blur",v))}),p.overlay.addEventListener("click",function(e){var t,o,a=e.target,i=!!r.closest(a,".jp-carousel-close-hint"),n=!!window.matchMedia("(max-device-width: 760px)").matches;a===p.overlay?n||x():i?x():a.classList.contains("jp-carousel-image-download")?m("download_original_click"):a.classList.contains("jp-carousel-comment-login")?(t=p.currentSlide,o=t?t.attrs.attachmentId:"0",window.location.href=jetpackCarouselStrings.login_url+"%23jp-carousel-"+o):r.closest(a,"#jp-carousel-comment-form-container")?function(e){var t=e.target,o=r.getJSONAttribute(p.container,"data-carousel-extra")||{},a=p.currentSlide.attrs.attachmentId,i=document.querySelector("#jp-carousel-comment-form-submit-and-info-wrapper"),n=document.querySelector("#jp-carousel-comment-form-spinner"),l=document.querySelector("#jp-carousel-comment-form-button-submit"),s=document.querySelector("#jp-carousel-comment-form");if(p.commentField&&p.commentField.getAttribute("id")===t.getAttribute("id"))f(),r.show(i);else if(r.matches(t,'input[type="submit"]')){e.preventDefault(),e.stopPropagation(),r.show(n),s.classList.add("jp-carousel-is-disabled");var c={action:"post_attachment_comment",nonce:jetpackCarouselStrings.nonce,blog_id:o.blog_id,id:a,comment:p.commentField.value};if(!c.comment.length)return void j(jetpackCarouselStrings.no_comment_text,!1);if(1!==Number(jetpackCarouselStrings.is_logged_in)&&(c.email=p.emailField.value,c.author=p.authorField.value,c.url=p.urlField.value,1===Number(jetpackCarouselStrings.require_name_email))){if(!c.email.length||!c.email.match("@"))return void j(jetpackCarouselStrings.no_comment_email,!1);if(!c.author.length)return void j(jetpackCarouselStrings.no_comment_author,!1)}var u=new XMLHttpRequest;u.open("POST",jetpackCarouselStrings.ajaxurl,!0),u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),u.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE&&this.status>=200&&this.status<300){var e;try{e=JSON.parse(this.response)}catch{return void j(jetpackCarouselStrings.comment_post_error,!1)}"approved"===e.comment_status?j(jetpackCarouselStrings.comment_approved,!0):"unapproved"===e.comment_status?j(jetpackCarouselStrings.comment_unapproved,!0):j(jetpackCarouselStrings.comment_post_error,!1),H(),q(a),l.value=jetpackCarouselStrings.post_comment,r.hide(n),s.classList.remove("jp-carousel-is-disabled")}else j(jetpackCarouselStrings.comment_post_error,!1)};var d=[];for(var m in c)if(m){var g=encodeURIComponent(m)+"="+encodeURIComponent(c[m]);d.push(g.replace(/%20/g,"+"))}var h=d.join("&");u.send(h)}}(e):(r.closest(a,".jp-carousel-photo-icons-container")||a.classList.contains("jp-carousel-photo-title"))&&function(e){e.preventDefault();var t=e.target,o=p.info.querySelector(".jp-carousel-info-extra"),a=p.info.querySelector(".jp-carousel-image-meta"),i=p.info.querySelector(".jp-carousel-comments-wrapper"),n=p.info.querySelector(".jp-carousel-icon-info"),l=p.info.querySelector(".jp-carousel-icon-comments");function s(){l&&l.classList.remove("jp-carousel-selected"),n.classList.toggle("jp-carousel-selected"),i&&i.classList.remove("jp-carousel-show"),a&&(a.classList.toggle("jp-carousel-show"),a.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}function c(){n&&n.classList.remove("jp-carousel-selected"),l.classList.toggle("jp-carousel-selected"),a&&a.classList.remove("jp-carousel-show"),i&&(i.classList.toggle("jp-carousel-show"),i.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}(r.closest(t,".jp-carousel-icon-info")||t.classList.contains("jp-carousel-photo-title"))&&(a&&a.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,s):(s(),r.scrollToElement(p.info,p.overlay))),r.closest(t,".jp-carousel-icon-comments")&&(i&&i.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,c):(c(),r.scrollToElement(p.info,p.overlay)))}(e)}),window.addEventListener("keydown",h),p.overlay.addEventListener("jp_carousel.afterOpen",function(){v(),p.slides.length<=1||(p.slides.length<=5?r.show(p.info.querySelector(".jp-swiper-pagination")):r.show(p.info.querySelector(".jp-carousel-pagination")))}),p.overlay.addEventListener("jp_carousel.beforeClose",function(){f(),document.documentElement.style.removeProperty("height"),e&&e.enable(),r.hide(p.info.querySelector(".jp-swiper-pagination")),r.hide(p.info.querySelector(".jp-carousel-pagination"))}),p.overlay.addEventListener("jp_carousel.afterClose",function(){window.history.pushState?history.pushState("",document.title,window.location.pathname+window.location.search):window.location.href="",l="",p.isOpen=!1}),p.overlay.addEventListener("touchstart",function(e){e.touches.length>1&&e.preventDefault()}))}function j(e,t){var o=p.overlay.querySelector("#jp-carousel-comment-post-results"),a="jp-carousel-comment-post-"+(t?"success":"error");o.innerHTML='<span class="'+a+'">'+e+"</span>",r.hide(p.overlay.querySelector("#jp-carousel-comment-form-spinner")),p.overlay.querySelector("#jp-carousel-comment-form").classList.remove("jp-carousel-is-disabled"),r.show(o)}function b(){var e=document.querySelectorAll("a img[data-attachment-id]");Array.prototype.forEach.call(e,function(e){var t=e.parentElement,o=t.parentElement;if(!o.classList.contains("gallery-icon")&&!r.closest(o,u)&&t.hasAttribute("href")){var a=!1;t.getAttribute("href").split("?")[0]===e.getAttribute("data-orig-file").split("?")[0]&&1===Number(jetpackCarouselStrings.single_image_gallery_media_file)&&(a=!0),t.getAttribute("href")===e.getAttribute("data-permalink")&&(a=!0),a&&(y(e),t.classList.add("single-image-gallery"),t.setAttribute("data-carousel-extra",JSON.stringify({blog_id:Number(jetpackCarouselStrings.blog_id)})))}})}function S(t,r){p.isOpen?(L(r),e.slideTo(r+1)):M(t,{startIndex:r})}function L(e){(!e||e<0||e>p.slides.length)&&(e=0),p.currentSlide=p.slides[e];var o,a,i=p.currentSlide,n=i.attrs.attachmentId;A(p.slides[e]),function(e){var t=[],r=p.slides.length;if(r>1){var o=e>0?e-1:r-1;t.push(o);var a=e<r-1?e+1:0;t.push(a)}t.forEach(function(e){var t=p.slides[e];t&&(A(t),1!==Number(jetpackCarouselStrings.display_background_image)||t.backgroundImage||_(t))})}(e),1!==Number(jetpackCarouselStrings.display_background_image)||p.slides[e].backgroundImage||_(p.slides[e]),r.hide(p.caption),function(e){var t,o,a,i,n,l,s;if(i=p.overlay.querySelector(".jp-carousel-photo-caption"),n=p.overlay.querySelector(".jp-carousel-caption"),l=p.overlay.querySelector(".jp-carousel-photo-title"),s=p.overlay.querySelector(".jp-carousel-photo-description"),r.hide(i),r.hide(n),r.hide(l),r.hide(s),t=E(e.caption)||"",o=E(e.title)||"",a=E(e.desc)||"",(t||o||a)&&(t&&(i.innerHTML=t,n.innerHTML=t,r.show(i),r.show(n)),r.stripHTML(t)===r.stripHTML(o)&&(o=""),r.stripHTML(t)===r.stripHTML(a)&&(a=""),r.stripHTML(o)===r.stripHTML(a)&&(a=""),a&&(s.innerHTML=a,r.show(s),o||t||(i.textContent=r.stripHTML(a),r.show(i))),o)){var c=r.stripHTML(o);l.textContent=c,t||(i.textContent=c,n.textContent=c,r.show(i)),r.show(l)}}
3601({caption:i.attrs.caption,title:i.attrs.title,desc:i.attrs.desc}),function(e){if(!e||1!==Number(jetpackCarouselStrings.display_exif))return!1;var t=p.info.querySelector(".jp-carousel-image-meta");if(!t)return!1;var r="";for(var o in e){var a=e[o],i=jetpackCarouselStrings.meta_data||[];if(0!==parseFloat(a)&&a.length&&-1!==i.indexOf(o)){switch(o){case"focal_length":a+="mm";break;case"shutter_speed":a=C(a);break;case"aperture":a="f/"+a}r+="<li><h5>"+jetpackCarouselStrings[o]+"</h5>"+a+"</li>"}}var n=t.querySelector("ul.jp-carousel-image-exif");if(""!==r){if(!n){(n=document.createElement("ul")).className="jp-carousel-image-exif";var l=t.querySelector(".jp-carousel-title-and-caption");l&&l.nextSibling?t.insertBefore(n,l.nextSibling):t.insertBefore(n,t.firstChild)}n.innerHTML=r,n.style.removeProperty("display")}else n&&n.parentNode.removeChild(n)}(p.slides[e].attrs.imageMeta),function(e){if(!e)return!1;var r,o=[e.attrs.origWidth,e.attrs.origHeight],a=document.createElement("a");a.href=e.attrs.src.replace(/\?.+$/,""),r=null!==a.hostname.match(/^i[\d]{1}\.wp\.com$/i)?a.href:e.attrs.origFile.replace(/\?.+$/,"");var i=p.info.querySelector(".jp-carousel-download-text"),n=p.info.querySelector(".jp-carousel-image-download");i.innerHTML=t.applyReplacements(jetpackCarouselStrings.download_original,o),n.setAttribute("href",r),n.style.removeProperty("display")}(i),1===Number(jetpackCarouselStrings.display_comments)&&(o=p.slides[e].attrs.commentsOpened,a=p.info.querySelector("#jp-carousel-comment-form-container"),1===parseInt(o,10)?r.fadeIn(a):r.fadeOut(a),q(n),r.hide(p.info.querySelector("#jp-carousel-comment-post-results")));var s=p.info.querySelector(".jp-carousel-pagination");if(s&&p.slides.length>5){var c=e+1;s.innerHTML="<span>"+c+" / "+p.slides.length+"</span>"}jetpackCarouselStrings.stats&&p.isOpen&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?"+jetpackCarouselStrings.stats+"&post="+encodeURIComponent(n)+"&rand="+Math.random()),p.isOpen&&g(n),l="#jp-carousel-"+n,window.location.hash=l}function x(){document.body.style.overflow=a,document.documentElement.style.overflow=i,H(),f(),r.emitEvent(p.overlay,"jp_carousel.beforeClose"),window.scrollTo(window.scrollX||window.pageXOffset||0,n||0),p.isOpen=!1,e.destroy(),p.slides=[],p.currentSlide=void 0,p.gallery.innerHTML="",r.fadeOut(p.overlay,function(){r.emitEvent(p.overlay,"jp_carousel.afterClose")})}function k(e){if("object"!=typeof e&&(e={}),void 0===e.origFile)return"";if(void 0===e.origWidth||void 0===e.maxWidth)return e.origFile;if(!e.largeFile)return e.origFile;var t=document.createElement("a");t.href=e.largeFile;var r=/^i[0-2]\.wp\.com$/i.test(t.hostname),o=function(e,t,r){var o,a=r?e.replace(/.*=([\d]+%2C[\d]+).*$/,"$1"):e.replace(/.*-([\d]+x[\d]+)\..+$/,"$1");return"9999"===(o=a!==e?r?a.split("%2C"):a.split("x"):[t,0])[0]&&(o[0]="0"),"9999"===o[1]&&(o[1]="0"),o}(e.largeFile,e.origWidth,r),a=parseInt(o[0],10),i=parseInt(o[1],10);if(e.origMaxWidth=e.maxWidth,e.origMaxHeight=e.maxHeight,void 0!==window.devicePixelRatio&&window.devicePixelRatio>1&&(e.maxWidth=e.maxWidth*window.devicePixelRatio,e.maxHeight=e.maxHeight*window.devicePixelRatio),a>=e.maxWidth||i>=e.maxHeight)return e.largeFile;if(r){if(-1===e.largeFile.lastIndexOf("?"))return e.largeFile;var n=function(e){var t;try{t=new URL(e)}catch(t){return e}var r=["quality","ssl","filter","brightness","contrast","colorize","smooth"],o=Array.from(t.searchParams.entries());return t.search="",o.forEach(([e,o])=>{r.includes(e)&&t.searchParams.append(e,o)}),t}(e.largeFile);return(e.origWidth>e.maxWidth||e.origHeight>e.maxHeight)&&(e.origMaxWidth=2*e.maxWidth,e.origMaxHeight=2*e.maxHeight,n.searchParams.set("fit",e.origMaxWidth+","+e.origMaxHeight)),n.toString()}return e.origFile}function C(e){return e>=1?Math.round(10*e)/10+"s":"1/"+Math.round(1/e)+"s"}function E(e){return!e.match(" ")&&e.match("_")?"":e}function q(e,t){var a=void 0===t,i=p.info.querySelector(".jp-carousel-icon-comments .jp-carousel-has-comments-indicator");if(i.classList.remove("jp-carousel-show"),clearInterval(o),e){(!t||t<1)&&(t=0);var n=p.info.querySelector(".jp-carousel-comments"),l=p.info.querySelector("#jp-carousel-comments-loading");r.show(l),a&&(r.hide(n),n.innerHTML="");var s=new XMLHttpRequest,c=jetpackCarouselStrings.ajaxurl+"?action=get_attachment_comments&nonce="+jetpackCarouselStrings.nonce+"&id="+e+"&offset="+t;s.open("GET",c),s.setRequestHeader("X-Requested-With","XMLHttpRequest");var u=function(){r.fadeIn(n),r.fadeOut(l)};s.onload=function(){if(p.currentSlide&&p.currentSlide.attrs.attachmentId===e){var c,d=s.status>=200&&s.status<300;try{c=JSON.parse(s.responseText)}catch{}if(!d||!c||!Array.isArray(c))return u();a&&(n.innerHTML="");for(var m=0;m<c.length;m++){var g=c[m],h=document.createElement("div");h.classList.add("jp-carousel-comment"),h.setAttribute("id","jp-carousel-comment-"+g.id),h.innerHTML='<div class="comment-gravatar">'+g.gravatar_markup+'</div><div class="comment-content"><div class="comment-author">'+g.author_markup+'</div><div class="comment-date">'+g.date_gmt+"</div>"+g.content+"</div>",n.appendChild(h),clearInterval(o),o=setInterval(function(){p.container.scrollTop+150>window.innerHeight&&(q(e,t+10),clearInterval(o))},300)}c.length>0&&(r.show(n),i.innerText=c.length,i.classList.add("jp-carousel-show")),r.hide(l)}},s.onerror=u,s.send()}}function A(e){var t=e.attrs,r=e.el.querySelector("img");if(!r.hasAttribute("data-loaded"))if(r.setAttribute("itemprop","image"),r.setAttribute("data-loaded",1),t.previewImage&&t.previewImage!==t.src){r.src=t.previewImage,r.style.filter="blur(8px)";var o=new window.Image;o.addEventListener("load",function(){r.src=t.src,r.style.filter=""},{once:!0}),o.addEventListener("error",function(){r.style.filter=""},{once:!0}),o.src=t.src}else r.src=t.src}function _(e){var t=e.attrs.originalElement;if(t)if(t.complete&&0!==t.naturalHeight)T(e,t);else{var r=function(){t.removeEventListener("error",o),T(e,t)},o=function(){t.removeEventListener("load",r)};t.addEventListener("load",r,{once:!0}),t.addEventListener("error",o,{once:!0})}}
3601function T(e,r){var o=t.getBackgroundImage(r);o&&(e.backgroundImage=o,e.el.style.backgroundImage="url("+o+")",e.el.style.backgroundSize="cover",e.el.style.backgroundPosition="center")}function H(){p.commentField&&(p.commentField.value="")}function I(e,o){p.slides=[];var a={width:window.innerWidth,height:window.innerHeight-64};0!==o&&null!==e[o].getAttribute("data-gallery-src")&&((new Image).src=e[o].getAttribute("data-gallery-src")),Array.prototype.forEach.call(e,function(e,o){var i=r.closest(e,"a"),n=e.getAttribute("data-orig-file")||e.getAttribute("src-orig"),l=e.getAttribute("data-attachment-id")||e.getAttribute("data-id")||"0",s=document.querySelector('img[data-attachment-id="'+l+'"] + figcaption');s=s?s.innerHTML:e.getAttribute("data-image-caption");var c={originalElement:e,attachmentId:l,commentsOpened:e.getAttribute("data-comments-opened")||"0",imageMeta:r.getJSONAttribute(e,"data-image-meta")||{},title:e.getAttribute("data-image-title")||"",desc:e.getAttribute("data-image-description")||"",largeFile:e.getAttribute("data-large-file")||"",origFile:n||"",thumbSize:{width:e.naturalWidth,height:e.naturalHeight},caption:s||"",permalink:i&&i.getAttribute("href"),src:n||e.getAttribute("src")||""},u=r.closest(e,".tiled-gallery-item"),d=u&&u.querySelector(".tiled-gallery-caption"),m=d&&d.innerHTML;m&&(c.caption=m);var g=function(e){var t=e.getAttribute("data-orig-size")||"";if(t){var r=t.split(",");return{width:parseInt(r[0],10),height:parseInt(r[1],10)}}return{width:e.getAttribute("data-original-width")||e.getAttribute("width")||void 0,height:e.getAttribute("data-original-height")||e.getAttribute("height")||void 0}}(e);if(c.origWidth=g.width||c.thumbSize.width,c.origHeight=g.height||c.thumbSize.height,"undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.generateImgSrc?c.src=wpcom.carousel.generateImgSrc(e,a):c.src=k({origFile:c.src,origWidth:c.origWidth,origHeight:c.origHeight,maxWidth:a.width,maxHeight:a.height,largeFile:c.largeFile}),e.setAttribute("data-gallery-src",c.src),"0"!==c.attachmentId){c.title=t.texturize(c.title),c.desc=t.texturize(c.desc),c.caption=t.texturize(c.caption);var h=new Image,f=document.createElement("div");f.classList.add("swiper-slide"),f.setAttribute("itemprop","associatedMedia"),f.setAttribute("itemscope",""),f.setAttribute("itemtype","https://schema.org/ImageObject");var v=document.createElement("div");v.classList.add("swiper-zoom-container"),p.gallery.appendChild(f),f.appendChild(v),v.appendChild(h),f.setAttribute("data-attachment-id",c.attachmentId),f.setAttribute("data-permalink",c.permalink),f.setAttribute("data-orig-file",c.origFile),c.previewImage=e.currentSrc||e.getAttribute("src")||"";var y={el:f,attrs:c,index:o};p.slides.push(y)}})}function M(e,t){if(!window.JetpackSwiper){var o=document.querySelector("#jp-carousel-loading-overlay");r.show(o);var a=document.createElement("script");return a.id="jetpack-carousel-swiper-js",a.src=window.jetpackSwiperLibraryPath.url,a.async=!0,a.onload=function(){r.hide(o),F(e,t)},a.onerror=function(){r.hide(o)},void document.head.appendChild(a)}F(e,t)}function F(t,o){var l,s={imgSelector:".gallery-item [data-attachment-id], .tiled-gallery-item [data-attachment-id], img[data-attachment-id], img[data-id]",startIndex:0},c=r.getJSONAttribute(t,"data-carousel-extra");if(!c)return;const u=t.querySelectorAll(s.imgSelector);if(u.length&&(w(),!p.isOpen)){for(var d in p.isOpen=!0,a=getComputedStyle(document.body).overflow,document.body.style.overflow="hidden",i=getComputedStyle(document.documentElement).overflow,document.documentElement.style.overflow="hidden",n=window.scrollY||window.pageYOffset||0,p.container.setAttribute("data-carousel-extra",JSON.stringify(c)),m(["open","view_image"]),o||{})s[d]=o[d];-1===s.startIndex&&(s.startIndex=0),r.emitEvent(p.overlay,"jp_carousel.beforeOpen"),p.gallery.innerHTML="",p.overlay.style.opacity=1,p.overlay.style.display="block",I(u,s.startIndex),(e=new window.JetpackSwiper(".jp-carousel-swiper-container",{centeredSlides:!0,zoom:!0,loop:p.slides.length>1,enabled:p.slides.length>1,pagination:{el:".jp-swiper-pagination",clickable:!0},navigation:{nextEl:".jp-swiper-button-next",prevEl:".jp-swiper-button-prev"},initialSlide:s.startIndex,on:{init:function(){L(s.startIndex)}},preventClicks:!1,preventClicksPropagation:!1,preventInteractionOnTransition:!r.isTouch(),threshold:5})).on("slideChange",function(e){p.isOpen&&(L(e.realIndex),p.overlay.classList.remove("jp-carousel-hide-control
3601s"))}),e.on("zoomChange",function(e,t){t>1&&p.overlay.classList.add("jp-carousel-hide-controls"),1===t&&p.overlay.classList.remove("jp-carousel-hide-controls")}),e.on("doubleTap",function(e){if(clearTimeout(l),1===e.zoom.scale)var t=setTimeout(function(){p.overlay.classList.remove("jp-carousel-hide-controls"),clearTimeout(t)},150)}),e.on("tap",function(){e.zoom.scale>1&&(l=setTimeout(function(){p.overlay.classList.toggle("jp-carousel-hide-controls")},150))}),r.fadeIn(p.overlay,function(){r.emitEvent(p.overlay,"jp_carousel.afterOpen")})}}function O(e){if("click"!==e.type){if("keydown"===e.type){const t=document.activeElement.parentElement,r=t&&t.classList.contains("tiled-gallery__item");" "!==e.key&&"Enter"!==e.key||!r||R(e)}}else R(e)}function N(e){return(e||"").split("?")[0].replace(/\/$/,"")}function W(e){"A"===e.tagName&&(e=e.querySelector("img")||e);var t=e.parentElement,o=t?t.parentElement:null,a=null;if(o&&o.classList.contains("wp-block-image")?a=t.getAttribute("href"):t&&t.classList.contains("wp-block-image")&&t.querySelector(":scope > a")&&(a=t.querySelector(":scope > a").getAttribute("href")),a){var i=N(a),n=N(e.getAttribute("data-orig-file")),l=N(e.getAttribute("data-permalink"));if(i!==n&&i!==l)return!1}return!(t&&t.classList.contains("gallery-caption")||r.matches(t,"figcaption"))}function R(e){if(window.CSS&&window.CSS.supports&&window.CSS.supports("display","grid")){var t,o=e.target,a=r.closest(o,c);if(a){if(!(t=a)||!t.getAttribute("data-carousel-extra"))return;if(!W(o))return;document.documentElement.style.height="auto",e.preventDefault(),e.stopPropagation();var i=r.closest(o,d),n=Array.prototype.indexOf.call(a.querySelectorAll(d),i);M(a,{startIndex:n})}}}document.body.addEventListener("click",O),document.body.addEventListener("keydown",O),document.querySelectorAll(u+"img").forEach(function(e){W(e)&&y(e)}),1===Number(jetpackCarouselStrings.single_image_gallery)&&(b(),document.body.addEventListener("is.post-load",function(){b()})),window.addEventListener("hashchange",function(){var e=/jp-carousel-(\d+)/;if(window.location.hash&&e.test(window.location.hash)){if(window.location.hash!==l||!p.isOpen)if(window.location.hash&&p.gallery&&!p.isOpen&&history.back)history.back();else{l=window.location.hash;for(var t=window.location.hash.match(e),r=parseInt(t[1],10),o=document.querySelectorAll(c),a=0;a<o.length;a++){for(var i,n=o[a],s=n.querySelectorAll("img"),u=0;u<s.length;u++)if(parseInt(s[u].getAttribute("data-attachment-id"),10)===r||parseInt(s[u].getAttribute("data-id"),10)===r){i=u;break}if(void 0!==i){S(n,i);break}}}}else p.isOpen&&x()}),window.location.hash&&r.emitEvent(window,"hashchange")}"loading"!==document.readyState?o():document.addEventListener("DOMContentLoaded",o)}();;
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.