vendor: 29,043 bytes, lines 1-1098
1/** 2 * 2015-2021 Bonpresta 3 * 4 * Products Banner on Home Page with Carousel 5 * 6 * NOTICE OF LICENSE 7 * 8 * This source file is subject to the General Public License (GPL 2.0) 9 * that is bundled with this package in the file LICENSE.txt. 10 * It is also available through the world-wide-web at this URL: 11 * http://opensource.org/licenses/GPL-2.0 12 * 13 * DISCLAIMER 14 * 15 * Do not edit or add to this file if you wish to upgrade the module to newer 16 * versions in the future. 17 * 18 * @author Bonpresta 19 * @copyright 2015-2021 Bonpresta 20 * @license http://opensource.org/licenses/GPL-2.0 General Public License (GPL 2.0) 21 */ 22 23(function (factory) { 24 'use strict'; 25 if (typeof define === 'function' && define.amd) { 26 define(['jquery'], factory); 27 } else if (typeof exports !== 'undefined') { 28 module.exports = factory(require('jquery')); 29 } else { 30 factory(jQuery); 31 } 32})(function ($) { 33 'use strict'; 34 var Slick = window.Slick || {}; 35 36 Slick = (function () { 37 var instanceUid = 0; 38 39 function Slick(element, settings) { 40 var _ = this, 41 dataSettings; 42 43 _.defaults = { 44 accessibility: true, 45 adaptiveHeight: false, 46 appendArrows: $(element), 47 appendDots: $(element), 48 arrows: true, 49 asNavFor: null, 50 prevArrow: 51 '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 52 nextArrow: 53 '<button class="slick-next" aria-label="Next" type="button">Next</button>', 54 autoplay: false, 55 autoplaySpeed: 3000, 56 centerMode: false, 57 centerPadding: '50px', 58 cssEase: 'ease', 59 customPaging: function (slider, i) { 60 return $('<button type="button" />').text(i + 1); 61 }, 62 dots: false, 63 dotsClass: 'slick-dots', 64 draggable: true, 65 easing: 'linear', 66 edgeFriction: 0.35, 67 fade: false, 68 focusOnSelect: false, 69 focusOnChange: false, 70 infinite: true, 71 initialSlide: 0, 72 lazyLoad: 'ondemand', 73 mobileFirst: false, 74 pauseOnHover: true, 75 pauseOnFocus: true, 76 pauseOnDotsHover: false, 77 respondTo: 'window', 78 responsive: null, 79 rows: 1, 80 rtl: false, 81 slide: '', 82 slidesPerRow: 1, 83 slidesToShow: 1, 84 slidesToScroll: 1, 85 speed: 500, 86 swipe: true, 87 swipeToSlide: false, 88 touchMove: true, 89 touchThreshold: 5, 90 useCSS: true, 91 useTransform: true, 92 variableWidth: false, 93 vertical: false, 94 verticalSwiping: false, 95 waitForAnimate: true, 96 zIndex: 1000 97 }; 98 99 _.initials = { 100 animating: false, 101 dragging: false, 102 autoPlayTimer: null, 103 currentDirection: 0, 104 currentLeft: null, 105 currentSlide: 0, 106 direction: 1, 107 $dots: null, 108 listWidth: null, 109 listHeight: null, 110 loadIndex: 0, 111 $nextArrow: null, 112 $prevArrow: null, 113 scrolling: false, 114 slideCount: null, 115 slideWidth: null, 116 $slideTrack: null, 117 $slides: null, 118 sliding: false, 119 slideOffset: 0, 120 swipeLeft: null, 121 swiping: false, 122 $list: null, 123 touchObject: {}, 124 transformsEnabled: false, 125 unslicked: false 126 }; 127 128 $.extend(_, _.initials); 129 130 _.activeBreakpoint = null; 131 _.animType = null; 132 _.animProp = null; 133 _.breakpoints = []; 134 _.breakpointSettings = []; 135 _.cssTransitions = false; 136 _.focussed = false; 137 _.interrupted = false; 138 _.hidden = 'hidden'; 139 _.paused = true; 140 _.positionProp = null; 141 _.respondTo = null; 142 _.rowCount = 1; 143 _.shouldClick = true; 144 _.$slider = $(element); 145 _.$slidesCache = null; 146 _.transformType = null; 147 _.transitionType = null; 148 _.visibilityChange = 'visibilitychange'; 149 _.windowWidth = 0; 150 _.windowTimer = null; 151 152 dataSettings = $(element).data('slick') || {}; 153 154 _.options = $.extend({}, _.defaults, settings, dataSettings); 155 156 _.currentSlide = _.options.initialSlide; 157 158 _.originalSettings = _.options; 159 160 if (typeof document.mozHidden !== 'undefined') { 161 _.hidden = 'mozHidden'; 162 _.visibilityChange = 'mozvisibilitychange'; 163 } else if (typeof document.webkitHidden !== 'undefined') { 164 _.hidden = 'webkitHidden'; 165 _.visibilityChange = 'webkitvisibilitychange'; 166 } 167 168 _.autoPlay = $.proxy(_.autoPlay, _); 169 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 170 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 171 _.changeSlide = $.proxy(_.changeSlide, _); 172 _.clickHandler = $.proxy(_.clickHandler, _); 173 _.selectHandler = $.proxy(_.selectHandler, _); 174 _.setPosition = $.proxy(_.setPosition, _); 175 _.swipeHandler = $.proxy(_.swipeHandler, _); 176 _.dragHandler = $.proxy(_.dragHandler, _); 177 _.keyHandler = $.proxy(_.keyHandler, _); 178 179 _.instanceUid = instanceUid++; 180 181 // A simple way to check for HTML strings 182 // Strict HTML recognition (must start with <) 183 // Extracted from jQuery v1.11 source 184 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 185 186 _.registerBreakpoints(); 187 _.init(true); 188 } 189 190 return Slick; 191 })(); 192 193 Slick.prototype.activateADA = function () { 194 var _ = this; 195 196 _.$slideTrack 197 .find('.slick-active') 198 .attr({ 199 'aria-hidden': 'false' 200 }) 201 .find('a, input, button, select') 202 .attr({ 203 tabindex: '0' 204 }); 205 }; 206 207 Slick.prototype.addSlide = Slick.prototype.slickAdd = function ( 208 markup, 209 index, 210 addBefore 211 ) { 212 var _ = this; 213 214 if (typeof index === 'boolean') { 215 addBefore = index; 216 index = null; 217 } else if (index < 0 || index >= _.slideCount) { 218 return false; 219 } 220 221 _.unload(); 222 223 if (typeof index === 'number') { 224 if (index === 0 && _.$slides.length === 0) { 225 $(markup).appendTo(_.$slideTrack); 226 } else if (addBefore) { 227 $(markup).insertBefore(_.$slides.eq(index)); 228 } else { 229 $(markup).insertAfter(_.$slides.eq(index)); 230 } 231 } else { 232 if (addBefore === true) { 233 $(markup).prependTo(_.$slideTrack); 234 } else { 235 $(markup).appendTo(_.$slideTrack); 236 } 237 } 238 239 _.$slides = _.$slideTrack.children(this.options.slide); 240 241 _.$slideTrack.children(this.options.slide).detach(); 242 243 _.$slideTrack.append(_.$slides); 244 245 _.$slides.each(function (index, element) { 246 $(element).attr('data-slick-index', index); 247 }); 248 249 _.$slidesCache = _.$slides; 250 251 _.reinit(); 252 }; 253 254 Slick.prototype.animateHeight = function () { 255 var _ = this; 256 if ( 257 _.options.slidesToShow === 1 && 258 _.options.adaptiveHeight === true && 259 _.options.vertical === false 260 ) { 261 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 262 _.$list.animate( 263 { 264 height: targetHeight 265 }, 266 _.options.speed 267 ); 268 } 269 }; 270 271 Slick.prototype.animateSlide = function (targetLeft, callback) { 272 var animProps = {}, 273 _ = this; 274 275 _.animateHeight(); 276 277 if (_.options.rtl === true && _.options.vertical === false) { 278 targetLeft = -targetLeft; 279 } 280 if (_.transformsEnabled === false) { 281 if (_.options.vertical === false) { 282 _.$slideTrack.animate( 283 { 284 left: targetLeft 285 }, 286 _.options.speed, 287 _.options.easing, 288 callback 289 ); 290 } else { 291 _.$slideTrack.animate( 292 { 293 top: targetLeft 294 }, 295 _.options.speed, 296 _.options.easing, 297 callback 298 ); 299 } 300 } else { 301 if (_.cssTransitions === false) { 302 if (_.options.rtl === true) { 303 _.currentLeft = -_.currentLeft; 304 } 305 $({ 306 animStart: _.currentLeft 307 }).animate( 308 { 309 animStart: targetLeft 310 }, 311 { 312 duration: _.options.speed, 313 easing: _.options.easing, 314 step: function (now) { 315 now = Math.ceil(now); 316 if (_.options.vertical === false) { 317 animProps[_.animType] = 'translate(' + now + 'px, 0px)'; 318 _.$slideTrack.css(animProps); 319 } else { 320 animProps[_.animType] = 'translate(0px,' + now + 'px)'; 321 _.$slideTrack.css(animProps); 322 } 323 }, 324 complete: function () { 325 if (callback) { 326 callback.call(); 327 } 328 } 329 } 330 ); 331 } else { 332 _.applyTransition(); 333 targetLeft = Math.ceil(targetLeft); 334 335 if (_.options.vertical === false) { 336 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 337 } else { 338 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 339 } 340 _.$slideTrack.css(animProps); 341 342 if (callback) { 343 setTimeout(function () { 344 _.disableTransition(); 345 346 callback.call(); 347 }, _.options.speed); 348 } 349 } 350 } 351 }; 352 353 Slick.prototype.getNavTarget = function () { 354 var _ = this, 355 asNavFor = _.options.asNavFor; 356 357 if (asNavFor && asNavFor !== null) { 358 asNavFor = $(asNavFor).not(_.$slider); 359 } 360 361 return asNavFor; 362 }; 363 364 Slick.prototype.asNavFor = function (index) { 365 var _ = this, 366 asNavFor = _.getNavTarget(); 367 368 if (asNavFor !== null && typeof asNavFor === 'object') { 369 asNavFor.each(function () { 370 var target = $(this).slick('getSlick'); 371 if (!target.unslicked) { 372 target.slideHandler(index, true); 373 } 374 }); 375 } 376 }; 377 378 Slick.prototype.applyTransition = function (slide) { 379 var _ = this, 380 transition = {}; 381 382 if (_.options.fade === false) { 383 transition[_.transitionType] = 384 _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 385 } else { 386 transition[_.transitionType] = 387 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 388 } 389 390 if (_.options.fade === false) { 391 _.$slideTrack.css(transition); 392 } else { 393 _.$slides.eq(slide).css(transition); 394 } 395 }; 396 397 Slick.prototype.autoPlay = function () { 398 var _ = this; 399 400 _.autoPlayClear(); 401 402 if (_.slideCount > _.options.slidesToShow) { 403 _.autoPlayTimer = setInterval( 404 _.autoPlayIterator, 405 _.options.autoplaySpeed 406 ); 407 } 408 }; 409 410 Slick.prototype.autoPlayClear = function () { 411 var _ = this; 412 413 if (_.autoPlayTimer) { 414 clearInterval(_.autoPlayTimer); 415 } 416 }; 417 418 Slick.prototype.autoPlayIterator = function () { 419 var _ = this, 420 slideTo = _.currentSlide + _.options.slidesToScroll; 421 422 if (!_.paused && !_.interrupted && !_.focussed) { 423 if (_.options.infinite === false) { 424 if (_.direction === 1 && _.currentSlide + 1 === _.slideCount - 1) { 425 _.direction = 0; 426 } else if (_.direction === 0) { 427 slideTo = _.currentSlide - _.options.slidesToScroll; 428 429 if (_.currentSlide - 1 === 0) { 430 _.direction = 1; 431 } 432 } 433 } 434 435 _.slideHandler(slideTo); 436 } 437 }; 438 439 Slick.prototype.buildArrows = function () { 440 var _ = this; 441 442 if (_.options.arrows === true) { 443 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 444 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 445 446 if (_.slideCount > _.options.slidesToShow) { 447 _.$prevArrow 448 .removeClass('slick-hidden') 449 .removeAttr('aria-hidden tabindex'); 450 _.$nextArrow 451 .removeClass('slick-hidden') 452 .removeAttr('aria-hidden tabindex'); 453 454 if (_.htmlExpr.test(_.options.prevArrow)) { 455 _.$prevArrow.prependTo(_.options.appendArrows); 456 } 457 458 if (_.htmlExpr.test(_.options.nextArrow)) { 459 _.$nextArrow.appendTo(_.options.appendArrows); 460 } 461 462 if (_.options.infinite !== true) { 463 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 464 } 465 } else { 466 _.$prevArrow 467 .add(_.$nextArrow) 468 469 .addClass('slick-hidden') 470 .attr({ 471 'aria-disabled': 'true', 472 tabindex: '-1' 473 }); 474 } 475 } 476 }; 477 478 Slick.prototype.buildDots = function () { 479 var _ = this, 480 i, 481 dot; 482 483 if (_.options.dots === true) { 484 _.$slider.addClass('slick-dotted'); 485 486 dot = $('<ul />').addClass(_.options.dotsClass); 487 488 for (i = 0; i <= _.getDotCount(); i += 1) { 489 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 490 } 491 492 _.$dots = dot.appendTo(_.options.appendDots); 493 494 _.$dots.find('li').first().addClass('slick-active'); 495 } 496 }; 497 498 Slick.prototype.buildOut = function () { 499 var _ = this; 500 501 _.$slides = _.$slider 502 .children(_.options.slide + ':not(.slick-cloned)') 503 .addClass('slick-slide'); 504 505 _.slideCount = _.$slides.length; 506 507 _.$slides.each(function (index, element) { 508 $(element) 509 .attr('data-slick-index', index) 510 .data('originalStyling', $(element).attr('style') || ''); 511 }); 512 513 _.$slider.addClass('slick-slider'); 514 515 _.$slideTrack = 516 _.slideCount === 0 517 ? $('<div class="slick-track"/>').appendTo(_.$slider) 518 : _.$slides.wrapAll('<div class="slick-track"/>').parent(); 519 520 _.$list = _.$slideTrack.wrap('<div class="slick-list"/>').parent(); 521 _.$slideTrack.css('opacity', 0); 522 523 if (_.options.centerMode === true || _.options.swipeToSlide === true) { 524 _.options.slidesToScroll = 1; 525 } 526 527 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 528 529 _.setupInfinite(); 530 531 _.buildArrows(); 532 533 _.buildDots(); 534 535 _.updateDots(); 536 537 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 538 539 if (_.options.draggable === true) { 540 _.$list.addClass('draggable'); 541 } 542 }; 543 544 Slick.prototype.buildRows = function () { 545 var _ = this, 546 a, 547 b, 548 c, 549 newSlides, 550 numOfSlides, 551 originalSlides, 552 slidesPerSection; 553 554 newSlides = document.createDocumentFragment(); 555 originalSlides = _.$slider.children(); 556 557 if (_.options.rows > 1) { 558 slidesPerSection = _.options.slidesPerRow * _.options.rows; 559 numOfSlides = Math.ceil(originalSlides.length / slidesPerSection); 560 561 for (a = 0; a < numOfSlides; a++) { 562 var slide = document.createElement('div'); 563 for (b = 0; b < _.options.rows; b++) { 564 var row = document.createElement('div'); 565 for (c = 0; c < _.options.slidesPerRow; c++) { 566 var target = 567 a * slidesPerSection + (b * _.options.slidesPerRow + c); 568 if (originalSlides.get(target)) { 569 row.appendChild(originalSlides.get(target)); 570 } 571 } 572 slide.appendChild(row); 573 } 574 newSlides.appendChild(slide); 575 } 576 577 _.$slider.empty().append(newSlides); 578 _.$slider 579 .children() 580 .children() 581 .children() 582 .css({ 583 width: 100 / _.options.slidesPerRow + '%', 584 display: 'inline-block' 585 }); 586 } 587 }; 588 589 Slick.prototype.checkResponsive = function (initial, forceUpdate) { 590 var _ = this, 591 breakpoint, 592 targetBreakpoint, 593 respondToWidth, 594 triggerBreakpoint = false; 595 var sliderWidth = _.$slider.width(); 596 var windowWidth = window.innerWidth || $(window).width(); 597 598 if (_.respondTo === 'window') { 599 respondToWidth = windowWidth; 600 } else if (_.respondTo === 'slider') { 601 respondToWidth = sliderWidth; 602 } else if (_.respondTo === 'min') { 603 respondToWidth = Math.min(windowWidth, sliderWidth); 604 } 605 606 if ( 607 _.options.responsive && 608 _.options.responsive.length && 609 _.options.responsive !== null 610 ) { 611 targetBreakpoint = null; 612 613 for (breakpoint in _.breakpoints) { 614 if (_.breakpoints.hasOwnProperty(breakpoint)) { 615 if (_.originalSettings.mobileFirst === false) { 616 if (respondToWidth < _.breakpoints[breakpoint]) { 617 targetBreakpoint = _.breakpoints[breakpoint]; 618 } 619 } else { 620 if (respondToWidth > _.breakpoints[breakpoint]) { 621 targetBreakpoint = _.breakpoints[breakpoint]; 622 } 623 } 624 } 625 } 626 627 if (targetBreakpoint !== null) { 628 if (_.activeBreakpoint !== null) { 629 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 630 _.activeBreakpoint = targetBreakpoint; 631 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 632 _.unslick(targetBreakpoint); 633 } else { 634 _.options = $.extend( 635 {}, 636 _.originalSettings, 637 _.breakpointSettings[targetBreakpoint] 638 ); 639 if (initial === true) { 640 _.currentSlide = _.options.initialSlide; 641 } 642 _.refresh(initial); 643 } 644 triggerBreakpoint = targetBreakpoint; 645 } 646 } else { 647 _.activeBreakpoint = targetBreakpoint; 648 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 649 _.unslick(targetBreakpoint); 650 } else { 651 _.options = $.extend( 652 {}, 653 _.originalSettings, 654 _.breakpointSettings[targetBreakpoint] 655 ); 656 if (initial === true) { 657 _.currentSlide = _.options.initialSlide; 658 } 659 _.refresh(initial); 660 } 661 triggerBreakpoint = targetBreakpoint; 662 } 663 } else { 664 if (_.activeBreakpoint !== null) { 665 _.activeBreakpoint = null; 666 _.options = _.originalSettings; 667 if (initial === true) { 668 _.currentSlide = _.options.initialSlide; 669 } 670 _.refresh(initial); 671 triggerBreakpoint = targetBreakpoint; 672 } 673 } 674 675 // only trigger breakpoints during an actual break. not on initialize. 676 if (!initial && triggerBreakpoint !== false) { 677 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 678 } 679 } 680 }; 681 682 Slick.prototype.changeSlide = function (event, dontAnimate) { 683 var _ = this, 684 $target = $(event.currentTarget), 685 indexOffset, 686 slideOffset, 687 unevenOffset; 688 689 // If target is a link, prevent default action. 690 if ($target.is('a')) { 691 event.preventDefault(); 692 } 693 694 // If target is not the <li> element (ie: a child), find the <li>. 695 if (!$target.is('li')) { 696 $target = $target.closest('li'); 697 } 698 699 unevenOffset = _.slideCount % _.options.slidesToScroll !== 0; 700 indexOffset = unevenOffset 701 ? 0 702 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 703 704 switch (event.data.message) { 705 case 'previous': 706 slideOffset = 707 indexOffset === 0 708 ? _.options.slidesToScroll 709 : _.options.slidesToShow - indexOffset; 710 if (_.slideCount > _.options.slidesToShow) { 711 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 712 } 713 break; 714 715 case 'next': 716 slideOffset = 717 indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 718 if (_.slideCount > _.options.slidesToShow) { 719 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 720 } 721 break; 722 723 case 'index': 724 var index = 725 event.data.index === 0 726 ? 0 727 : event.data.index || $target.index() * _.options.slidesToScroll; 728 729 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 730 $target.children().trigger('focus'); 731 break; 732 733 default: 734 return; 735 } 736 }; 737 738 Slick.prototype.checkNavigable = function (index) { 739 var _ = this, 740 navigables, 741 prevNavigable; 742 743 navigables = _.getNavigableIndexes(); 744 prevNavigable = 0; 745 if (index > navigables[navigables.length - 1]) { 746 index = navigables[navigables.length - 1]; 747 } else { 748 for (var n in navigables) { 749 if (index < navigables[n]) { 750 index = prevNavigable; 751 break; 752 } 753 prevNavigable = navigables[n]; 754 } 755 } 756 757 return index; 758 }; 759 760 Slick.prototype.cleanUpEvents = function () { 761 var _ = this; 762 763 if (_.options.dots && _.$dots !== null) { 764 $('li', _.$dots) 765 .off('click.slick', _.changeSlide) 766 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 767 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 768 769 if (_.options.accessibility === true) { 770 _.$dots.off('keydown.slick', _.keyHandler); 771 } 772 } 773 774 _.$slider.off('focus.slick blur.slick'); 775 776 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 777 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 778 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 779 780 if (_.options.accessibility === true) { 781 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 782 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 783 } 784 } 785 786 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 787 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 788 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler); 789 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 790 791 _.$list.off('click.slick', _.clickHandler); 792 793 $(document).off(_.visibilityChange, _.visibility); 794 795 _.cleanUpSlideEvents(); 796 797 if (_.options.accessibility === true) { 798 _.$list.off('keydown.slick', _.keyHandler); 799 } 800 801 if (_.options.focusOnSelect === true) { 802 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 803 } 804 805 $(window).off( 806 'orientationchange.slick.slick-' + _.instanceUid, 807 _.orientationChange 808 ); 809 810 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 811 812 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 813 814 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 815 }; 816 817 Slick.prototype.cleanUpSlideEvents = function () { 818 var _ = this; 819 820 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 821 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 822 }; 823 824 Slick.prototype.cleanUpRows = function () { 825 var _ = this, 826 originalSlides; 827 828 if (_.options.rows > 1) { 829 originalSlides = _.$slides.children().children(); 830 originalSlides.removeAttr('style'); 831 _.$slider.empty().append(originalSlides); 832 } 833 }; 834 835 Slick.prototype.clickHandler = function (event) { 836 var _ = this; 837 838 if (_.shouldClick === false) { 839 event.stopImmediatePropagation(); 840 event.stopPropagation(); 841 event.preventDefault(); 842 } 843 }; 844 845 Slick.prototype.destroy = function (refresh) { 846 var _ = this; 847 848 _.autoPlayClear(); 849 850 _.touchObject = {}; 851 852 _.cleanUpEvents(); 853 854 $('.slick-cloned', _.$slider).detach(); 855 856 if (_.$dots) { 857 _.$dots.remove(); 858 } 859 860 if (_.$prevArrow && _.$prevArrow.length) { 861 _.$prevArrow 862 .removeClass('slick-disabled slick-arrow slick-hidden') 863 .removeAttr('aria-hidden aria-disabled tabindex') 864 .css('display', ''); 865 866 if (_.htmlExpr.test(_.options.prevArrow)) { 867 _.$prevArrow.remove(); 868 } 869 } 870 871 if (_.$nextArrow && _.$nextArrow.length) { 872 _.$nextArrow 873 .removeClass('slick-disabled slick-arrow slick-hidden') 874 .removeAttr('aria-hidden aria-disabled tabindex') 875 .css('display', ''); 876 877 if (_.htmlExpr.test(_.options.nextArrow)) { 878 _.$nextArrow.remove(); 879 } 880 } 881 882 if (_.$slides) { 883 _.$slides 884 .removeClass( 885 'slick-slide slick-active slick-center slick-visible slick-current' 886 ) 887 .removeAttr('aria-hidden') 888 .removeAttr('data-slick-index') 889 .each(function () { 890 $(this).attr('style', $(this).data('originalStyling')); 891 }); 892 893 _.$slideTrack.children(this.options.slide).detach(); 894 895 _.$slideTrack.detach(); 896 897 _.$list.detach(); 898 899 _.$slider.append(_.$slides); 900 } 901 902 _.cleanUpRows(); 903 904 _.$slider.removeClass('slick-slider'); 905 _.$slider.removeClass('slick-initialized'); 906 _.$slider.removeClass('slick-dotted'); 907 908 _.unslicked = true; 909 910 if (!refresh) { 911 _.$slider.trigger('destroy', [_]); 912 } 913 }; 914 915 Slick.prototype.disableTransition = function (slide) { 916 var _ = this, 917 transition = {}; 918 919 transition[_.transitionType] = ''; 920 921 if (_.options.fade === false) { 922 _.$slideTrack.css(transition); 923 } else { 924 _.$slides.eq(slide).css(transition); 925 } 926 }; 927 928 Slick.prototype.fadeSlide = function (slideIndex, callback) { 929 var _ = this; 930 931 if (_.cssTransitions === false) { 932 _.$slides.eq(slideIndex).css({ 933 zIndex: _.options.zIndex 934 }); 935 936 _.$slides.eq(slideIndex).animate( 937 { 938 opacity: 1 939 }, 940 _.options.speed, 941 _.options.easing, 942 callback 943 ); 944 } else { 945 _.applyTransition(slideIndex); 946 947 _.$slides.eq(slideIndex).css({ 948 opacity: 1, 949 zIndex: _.options.zIndex 950 }); 951 952 if (callback) { 953 setTimeout(function () { 954 _.disableTransition(slideIndex); 955 956 callback.call(); 957 }, _.options.speed); 958 } 959 } 960 }; 961 962 Slick.prototype.fadeSlideOut = function (slideIndex) { 963 var _ = this; 964 965 if (_.cssTransitions === false) { 966 _.$slides.eq(slideIndex).animate( 967 { 968 opacity: 0, 969 zIndex: _.options.zIndex - 2 970 }, 971 _.options.speed, 972 _.options.easing 973 ); 974 } else { 975 _.applyTransition(slideIndex); 976 977 _.$slides.eq(slideIndex).css({ 978 opacity: 0, 979 zIndex: _.options.zIndex - 2 980 }); 981 } 982 }; 983 984 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function ( 985 filter 986 ) { 987 var _ = this; 988 989 if (filter !== null) { 990 _.$slidesCache = _.$slides; 991 992 _.unload(); 993 994 _.$slideTrack.children(this.options.slide).detach(); 995 996 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 997 998 _.reinit(); 999 } 1000 }; 1001 1002 Slick.prototype.focusHandler = function () { 1003 var _ = this; 1004 1005 _.$slider 1006 .off('focus.slick blur.slick') 1007 .on('focus.slick blur.slick', '*', function (event) { 1008 event.stopImmediatePropagation(); 1009 var $sf = $(this); 1010 1011 setTimeout(function () { 1012 if (_.options.pauseOnFocus) { 1013 _.focussed = $sf.is(':focus'); 1014 _.autoPlay(); 1015 } 1016 }, 0); 1017 }); 1018 }; 1019 1020 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function () { 1021 var _ = this; 1022 return _.currentSlide; 1023 }; 1024 1025 Slick.prototype.getDotCount = function () { 1026 var _ = this; 1027 1028 var breakPoint = 0; 1029 var counter = 0; 1030 var pagerQty = 0; 1031 1032 if (_.options.infinite === true) { 1033 if (_.slideCount <= _.options.slidesToShow) { 1034 ++pagerQty; 1035 } else { 1036 while (breakPoint < _.slideCount) { 1037 ++pagerQty; 1038 breakPoint = counter + _.options.slidesToScroll; 1039 counter += 1040 _.options.slidesToScroll <= _.options.slidesToShow 1041 ? _.options.slidesToScroll 1042 : _.options.slidesToShow; 1043 } 1044 } 1045 } else if (_.options.centerMode === true) { 1046 pagerQty = _.slideCount; 1047 } else if (!_.options.asNavFor) { 1048 pagerQty = 1049 1 + 1050 Math.ceil( 1051 (_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll 1052 ); 1053 } else { 1054 while (breakPoint < _.slideCount) { 1055 ++pagerQty; 1056 breakPoint = counter + _.options.slidesToScroll; 1057 counter += 1058 _.options.slidesToScroll <= _.options.slidesToShow 1059 ? _.options.slidesToScroll 1060 : _.options.slidesToShow; 1061 } 1062 } 1063 1064 return pagerQty - 1; 1065 }; 1066 1067 Slick.prototype.getLeft = function (slideIndex) { 1068 var _ = this, 1069 targetLeft, 1070 verticalHeight, 1071 verticalOffset = 0, 1072 targetSlide, 1073 coef; 1074 1075 _.slideOffset = 0; 1076 verticalHeight = _.$slides.first().outerHeight(true); 1077 1078 if (_.options.infinite === true) { 1079 if (_.slideCount > _.options.slidesToShow) { 1080 _.slideOffset = _.slideWidth * _.options.slidesToShow * -1; 1081 coef = -1; 1082 1083 if (_.options.vertical === true && _.options.centerMode === true) { 1084 if (_.options.slidesToShow === 2) { 1085 coef = -1.5; 1086 } else if (_.options.slidesToShow === 1) { 1087 coef = -2; 1088 } 1089 } 1090 verticalOffset = verticalHeight * _.options.slidesToShow * coef; 1091 } 1092 if (_.slideCount % _.options.slidesToScroll !== 0) { 1093 if ( 1094 slideIndex + _.options.slidesToScroll > _.slideCount && 1095 _.slideCount > _.options.slidesToShow 1096 ) { 1097 if (slideIndex > _.slideCount) { 1098 _.slideOffset =
1099 (_.options.slidesToShow - (slideIndex - _.slideCount)) * 1100 _.slideWidth * 1101 -1; 1102 verticalOffset = 1103 (_.options.slidesToShow - (slideIndex - _.slideCount)) * 1104 verticalHeight * 1105 -1; 1106 } else { 1107 _.slideOffset = 1108 (_.slideCount % _.options.slidesToScroll) * _.slideWidth * -1; 1109 verticalOffset = 1110 (_.slideCount % _.options.slidesToScroll) * verticalHeight * -1; 1111 } 1112 } 1113 } 1114 } else { 1115 if (slideIndex + _.options.slidesToShow > _.slideCount) { 1116 _.slideOffset = 1117 (slideIndex + _.options.slidesToShow - _.slideCount) * _.slideWidth; 1118 verticalOffset = 1119 (slideIndex + _.options.slidesToShow - _.slideCount) * verticalHeight; 1120 } 1121 } 1122 1123 if (_.slideCount <= _.options.slidesToShow) { 1124 _.slideOffset = 0; 1125 verticalOffset = 0; 1126 } 1127 1128 if ( 1129 _.options.centerMode === true && 1130 _.slideCount <= _.options.slidesToShow 1131 ) { 1132 _.slideOffset = 1133 (_.slideWidth * Math.floor(_.options.slidesToShow)) / 2 - 1134 (_.slideWidth * _.slideCount) / 2; 1135 } else if (_.options.centerMode === true && _.options.infinite === true) { 1136 _.slideOffset += 1137 _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 1138 } else if (_.options.centerMode === true) { 1139 _.slideOffset = 0; 1140 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 1141 } 1142 1143 if (_.options.vertical === false) { 1144 targetLeft = slideIndex * _.slideWidth * -1 + _.slideOffset; 1145 } else { 1146 targetLeft = slideIndex * verticalHeight * -1 + verticalOffset; 1147 } 1148 1149 if (_.options.variableWidth === true) { 1150 if ( 1151 _.slideCount <= _.options.slidesToShow || 1152 _.options.infinite === false 1153 ) { 1154 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 1155 } else { 1156 targetSlide = _.$slideTrack 1157 .children('.slick-slide') 1158 .eq(slideIndex + _.options.slidesToShow); 1159 } 1160 1161 if (_.options.rtl === true) { 1162 if (targetSlide[0]) { 1163 targetLeft = 1164 (_.$slideTrack.width() - 1165 targetSlide[0].offsetLeft - 1166 targetSlide.width()) * 1167 -1; 1168 } else { 1169 targetLeft = 0; 1170 } 1171 } else { 1172 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1173 } 1174 1175 if (_.options.centerMode === true) { 1176 if ( 1177 _.slideCount <= _.options.slidesToShow || 1178 _.options.infinite === false 1179 ) { 1180 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 1181 } else { 1182 targetSlide = _.$slideTrack 1183 .children('.slick-slide') 1184 .eq(slideIndex + _.options.slidesToShow + 1); 1185 } 1186 1187 if (_.options.rtl === true) { 1188 if (targetSlide[0]) { 1189 targetLeft = 1190 (_.$slideTrack.width() - 1191 targetSlide[0].offsetLeft - 1192 targetSlide.width()) * 1193 -1; 1194 } else { 1195 targetLeft = 0; 1196 } 1197 } else { 1198 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1199 } 1200 1201 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 1202 } 1203 } 1204 1205 return targetLeft; 1206 }; 1207 1208 Slick.prototype.getOption = Slick.prototype.slickGetOption = function ( 1209 option 1210 ) { 1211 var _ = this; 1212 1213 return _.options[option]; 1214 }; 1215 1216 Slick.prototype.getNavigableIndexes = function () { 1217 var _ = this, 1218 breakPoint = 0, 1219 counter = 0, 1220 indexes = [], 1221 max; 1222 1223 if (_.options.infinite === false) { 1224 max = _.slideCount; 1225 } else { 1226 breakPoint = _.options.slidesToScroll * -1; 1227 counter = _.options.slidesToScroll * -1; 1228 max = _.slideCount * 2; 1229 } 1230 1231 while (breakPoint < max) { 1232 indexes.push(breakPoint); 1233 breakPoint = counter + _.options.slidesToScroll; 1234 counter += 1235 _.options.slidesToScroll <= _.options.slidesToShow
1236 ? _.options.slidesToScroll 1237 : _.options.slidesToShow; 1238 } 1239 1240 return indexes; 1241 }; 1242 1243 Slick.prototype.getSlick = function () { 1244 return this; 1245 }; 1246 1247 Slick.prototype.getSlideCount = function () { 1248 var _ = this, 1249 slidesTraversed, 1250 swipedSlide, 1251 centerOffset; 1252 1253 centerOffset = 1254 _.options.centerMode === true 1255 ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) 1256 : 0; 1257 1258 if (_.options.swipeToSlide === true) { 1259 _.$slideTrack.find('.slick-slide').each(function (index, slide) { 1260 if ( 1261 slide.offsetLeft - centerOffset + $(slide).outerWidth() / 2 > 1262 _.swipeLeft * -1 1263 ) { 1264 swipedSlide = slide; 1265 return false; 1266 } 1267 }); 1268 1269 slidesTraversed = 1270 Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 1271 1272 return slidesTraversed; 1273 } else { 1274 return _.options.slidesToScroll; 1275 } 1276 }; 1277 1278 Slick.prototype.goTo = Slick.prototype.slickGoTo = function ( 1279 slide, 1280 dontAnimate 1281 ) { 1282 var _ = this; 1283 1284 _.changeSlide( 1285 { 1286 data: { 1287 message: 'index', 1288 index: parseInt(slide) 1289 } 1290 }, 1291 dontAnimate 1292 ); 1293 }; 1294 1295 Slick.prototype.init = function (creation) { 1296 var _ = this; 1297 1298 if (!$(_.$slider).hasClass('slick-initialized')) { 1299 $(_.$slider).addClass('slick-initialized'); 1300 1301 _.buildRows(); 1302 _.buildOut(); 1303 _.setProps(); 1304 _.startLoad(); 1305 _.loadSlider(); 1306 _.initializeEvents(); 1307 _.updateArrows(); 1308 _.updateDots(); 1309 _.checkResponsive(true); 1310 _.focusHandler(); 1311 } 1312 1313 if (creation) { 1314 _.$slider.trigger('init', [_]); 1315 } 1316 1317 if (_.options.accessibility === true) { 1318 _.initADA(); 1319 } 1320 1321 if (_.options.autoplay) { 1322 _.paused = false; 1323 _.autoPlay(); 1324 } 1325 }; 1326 1327 Slick.prototype.initADA = function () { 1328 var _ = this, 1329 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), 1330 tabControlIndexes = _.getNavigableIndexes().filter(function (val) { 1331 return val >= 0 && val < _.slideCount; 1332 }); 1333 1334 _.$slides 1335 .add(_.$slideTrack.find('.slick-cloned')) 1336 .attr({ 1337 'aria-hidden': 'true', 1338 tabindex: '-1' 1339 }) 1340 .find('a, input, button, select') 1341 .attr({ 1342 tabindex: '-1' 1343 }); 1344 1345 if (_.$dots !== null) { 1346 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function (i) { 1347 var slideControlIndex = tabControlIndexes.indexOf(i); 1348 1349 $(this).attr({ 1350 role: 'tabpanel', 1351 id: 'slick-slide' + _.instanceUid + i, 1352 tabindex: -1 1353 }); 1354 1355 if (slideControlIndex !== -1) { 1356 $(this).attr({ 1357 'aria-describedby': 1358 'slick-slide-control' + _.instanceUid + slideControlIndex 1359 }); 1360 } 1361 }); 1362 1363 _.$dots 1364 .attr('role', 'tablist') 1365 .find('li') 1366 .each(function (i) { 1367 var mappedSlideIndex = tabControlIndexes[i]; 1368 1369 $(this).attr({ 1370 role: 'presentation' 1371 }); 1372 1373 $(this) 1374 .find('button') 1375 .first() 1376 .attr({ 1377 role: 'tab', 1378 id: 'slick-slide-control' + _.instanceUid + i, 1379 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 1380 'aria-label': i + 1 + ' of ' + numDotGroups, 1381 'aria-selected': null, 1382 tabindex: '-1' 1383 }); 1384 }) 1385 .eq(_.currentSlide) 1386 .find('button') 1387 .attr({ 1388 'aria-selected': 'true', 1389 tabindex: '0' 1390 }) 1391 .end(); 1392 } 1393 1394 for ( 1395 var i = _.currentSlide, max = i + _.options.slidesToShow; 1396 i < max; 1397 i++ 1398 ) { 1399 _.$slides.eq(i).attr('tabindex', 0); 1400 } 1401 1402 _.activateADA(); 1403 }; 1404 1405 Slick.prototype.initArrowEvents = function () { 1406 var _ = this; 1407 1408 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1409 _.$prevArrow.off('click.slick').on( 1410 'click.slick', 1411 { 1412 message: 'previous' 1413 }, 1414 _.changeSlide 1415 ); 1416 _.$nextArrow.off('click.slick').on( 1417 'click.slick', 1418 { 1419 message: 'next' 1420 }, 1421 _.changeSlide 1422 ); 1423 1424 if (_.options.accessibility === true) { 1425 _.$prevArrow.on('keydown.slick', _.keyHandler); 1426 _.$nextArrow.on('keydown.slick', _.keyHandler); 1427 } 1428 } 1429 }; 1430 1431 Slick.prototype.initDotEvents = function () { 1432 var _ = this; 1433 1434 if (_.options.dots === true) { 1435 $('li', _.$dots).on( 1436 'click.slick', 1437 { 1438 message: 'index' 1439 }, 1440 _.changeSlide 1441 ); 1442 1443 if (_.options.accessibility === true) { 1444 _.$dots.on('keydown.slick', _.keyHandler); 1445 } 1446 } 1447 1448 if (_.options.dots === true && _.options.pauseOnDotsHover === true) { 1449 $('li', _.$dots) 1450 .on('mouseenter.slick', $.proxy(_.interrupt, _, true))
vendor: 39,440 bytes, lines 1451-2971
1451 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 1452 } 1453 }; 1454 1455 Slick.prototype.initSlideEvents = function () { 1456 var _ = this; 1457 1458 if (_.options.pauseOnHover) { 1459 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 1460 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 1461 } 1462 }; 1463 1464 Slick.prototype.initializeEvents = function () { 1465 var _ = this; 1466 1467 _.initArrowEvents(); 1468 1469 _.initDotEvents(); 1470 _.initSlideEvents(); 1471 1472 _.$list.on( 1473 'touchstart.slick mousedown.slick', 1474 { 1475 action: 'start' 1476 }, 1477 _.swipeHandler 1478 ); 1479 _.$list.on( 1480 'touchmove.slick mousemove.slick', 1481 { 1482 action: 'move' 1483 }, 1484 _.swipeHandler 1485 ); 1486 _.$list.on( 1487 'touchend.slick mouseup.slick', 1488 { 1489 action: 'end' 1490 }, 1491 _.swipeHandler 1492 ); 1493 _.$list.on( 1494 'touchcancel.slick mouseleave.slick', 1495 { 1496 action: 'end' 1497 }, 1498 _.swipeHandler 1499 ); 1500 1501 _.$list.on('click.slick', _.clickHandler); 1502 1503 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 1504 1505 if (_.options.accessibility === true) { 1506 _.$list.on('keydown.slick', _.keyHandler); 1507 } 1508 1509 if (_.options.focusOnSelect === true) { 1510 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1511 } 1512 1513 $(window).on( 1514 'orientationchange.slick.slick-' + _.instanceUid, 1515 $.proxy(_.orientationChange, _) 1516 ); 1517 1518 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 1519 1520 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 1521 1522 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 1523 $(_.setPosition); 1524 }; 1525 1526 Slick.prototype.initUI = function () { 1527 var _ = this; 1528 1529 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1530 _.$prevArrow.show(); 1531 _.$nextArrow.show(); 1532 } 1533 1534 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1535 _.$dots.show(); 1536 } 1537 }; 1538 1539 Slick.prototype.keyHandler = function (event) { 1540 var _ = this; 1541 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 1542 if (!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 1543 if (event.keyCode === 37 && _.options.accessibility === true) { 1544 _.changeSlide({ 1545 data: { 1546 message: _.options.rtl === true ? 'next' : 'previous' 1547 } 1548 }); 1549 } else if (event.keyCode === 39 && _.options.accessibility === true) { 1550 _.changeSlide({ 1551 data: { 1552 message: _.options.rtl === true ? 'previous' : 'next' 1553 } 1554 }); 1555 } 1556 } 1557 }; 1558 1559 Slick.prototype.lazyLoad = function () { 1560 var _ = this, 1561 loadRange, 1562 cloneRange, 1563 rangeStart, 1564 rangeEnd; 1565 1566 function loadImages(imagesScope) { 1567 $('img[data-lazy]', imagesScope).each(function () { 1568 var image = $(this), 1569 imageSource = $(this).attr('data-lazy'), 1570 imageSrcSet = $(this).attr('data-srcset'), 1571 imageSizes = 1572 $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 1573 imageToLoad = document.createElement('img'); 1574 1575 imageToLoad.onload = function () { 1576 image.animate({ opacity: 0 }, 100, function () { 1577 if (imageSrcSet) { 1578 image.attr('srcset', imageSrcSet); 1579 1580 if (imageSizes) { 1581 image.attr('sizes', imageSizes); 1582 } 1583 } 1584 1585 image 1586 .attr('src', imageSource) 1587 .animate({ opacity: 1 }, 200, function () { 1588 image 1589 .removeAttr('data-lazy data-srcset data-sizes') 1590 .removeClass('slick-loading'); 1591 }); 1592 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 1593 }); 1594 }; 1595 1596 imageToLoad.onerror = function () { 1597 image 1598 .removeAttr('data-lazy') 1599 .removeClass('slick-loading') 1600 .addClass('slick-lazyload-error'); 1601 1602 _.$slider.trigger('lazyLoadError', [_, image, imageSource]); 1603 }; 1604 1605 imageToLoad.src = imageSource; 1606 }); 1607 } 1608 1609 if (_.options.centerMode === true) { 1610 if (_.options.infinite === true) { 1611 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 1612 rangeEnd = rangeStart + _.options.slidesToShow + 2; 1613 } else { 1614 rangeStart = Math.max( 1615 0, 1616 _.currentSlide - (_.options.slidesToShow / 2 + 1) 1617 ); 1618 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 1619 } 1620 } else { 1621 rangeStart = _.options.infinite 1622 ? _.options.slidesToShow + _.currentSlide 1623 : _.currentSlide; 1624 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 1625 if (_.options.fade === true) { 1626 if (rangeStart > 0) rangeStart--; 1627 if (rangeEnd <= _.slideCount) rangeEnd++; 1628 } 1629 } 1630 1631 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 1632 1633 if (_.options.lazyLoad === 'anticipated') { 1634 var prevSlide = rangeStart - 1, 1635 nextSlide = rangeEnd, 1636 $slides = _.$slider.find('.slick-slide'); 1637 1638 for (var i = 0; i < _.options.slidesToScroll; i++) { 1639 if (prevSlide < 0) prevSlide = _.slideCount - 1; 1640 loadRange = loadRange.add($slides.eq(prevSlide)); 1641 loadRange = loadRange.add($slides.eq(nextSlide)); 1642 prevSlide--; 1643 nextSlide++; 1644 } 1645 } 1646 1647 loadImages(loadRange); 1648 1649 if (_.slideCount <= _.options.slidesToShow) { 1650 cloneRange = _.$slider.find('.slick-slide'); 1651 loadImages(cloneRange); 1652 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 1653 cloneRange = _.$slider 1654 .find('.slick-cloned') 1655 .slice(0, _.options.slidesToShow); 1656 loadImages(cloneRange); 1657 } else if (_.currentSlide === 0) { 1658 cloneRange = _.$slider 1659 .find('.slick-cloned') 1660 .slice(_.options.slidesToShow * -1); 1661 loadImages(cloneRange); 1662 } 1663 }; 1664 1665 Slick.prototype.loadSlider = function () { 1666 var _ = this; 1667 1668 _.setPosition(); 1669 1670 _.$slideTrack.css({ 1671 opacity: 1 1672 }); 1673 1674 _.$slider.removeClass('slick-loading'); 1675 1676 _.initUI(); 1677 1678 if (_.options.lazyLoad === 'progressive') { 1679 _.progressiveLazyLoad(); 1680 } 1681 }; 1682 1683 Slick.prototype.next = Slick.prototype.slickNext = function () { 1684 var _ = this; 1685 1686 _.changeSlide({ 1687 data: { 1688 message: 'next' 1689 } 1690 }); 1691 }; 1692 1693 Slick.prototype.orientationChange = function () { 1694 var _ = this; 1695 1696 _.checkResponsive(); 1697 _.setPosition(); 1698 }; 1699 1700 Slick.prototype.pause = Slick.prototype.slickPause = function () { 1701 var _ = this; 1702 1703 _.autoPlayClear(); 1704 _.paused = true; 1705 }; 1706 1707 Slick.prototype.play = Slick.prototype.slickPlay = function () { 1708 var _ = this; 1709 1710 _.autoPlay(); 1711 _.options.autoplay = true; 1712 _.paused = false; 1713 _.focussed = false; 1714 _.interrupted = false; 1715 }; 1716 1717 Slick.prototype.postSlide = function (index) { 1718 var _ = this; 1719 1720 if (!_.unslicked) { 1721 _.$slider.trigger('afterChange', [_, index]); 1722 1723 _.animating = false; 1724 1725 if (_.slideCount > _.options.slidesToShow) { 1726 _.setPosition(); 1727 } 1728 1729 _.swipeLeft = null; 1730 1731 if (_.options.autoplay) { 1732 _.autoPlay(); 1733 } 1734 1735 if (_.options.accessibility === true) { 1736 _.initADA(); 1737 1738 if (_.options.focusOnChange) { 1739 var $currentSlide = $(_.$slides.get(_.currentSlide)); 1740 $currentSlide.attr('tabindex', 0).focus(); 1741 } 1742 } 1743 } 1744 }; 1745 1746 Slick.prototype.prev = Slick.prototype.slickPrev = function () { 1747 var _ = this; 1748 1749 _.changeSlide({ 1750 data: { 1751 message: 'previous' 1752 } 1753 }); 1754 }; 1755 1756 Slick.prototype.preventDefault = function (event) { 1757 event.preventDefault(); 1758 }; 1759 1760 Slick.prototype.progressiveLazyLoad = function (tryCount) { 1761 tryCount = tryCount || 1; 1762 1763 var _ = this, 1764 $imgsToLoad = $('img[data-lazy]', _.$slider), 1765 image, 1766 imageSource, 1767 imageSrcSet, 1768 imageSizes, 1769 imageToLoad; 1770 1771 if ($imgsToLoad.length) { 1772 image = $imgsToLoad.first(); 1773 imageSource = image.attr('data-lazy'); 1774 imageSrcSet = image.attr('data-srcset'); 1775 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 1776 imageToLoad = document.createElement('img'); 1777 1778 imageToLoad.onload = function () { 1779 if (imageSrcSet) { 1780 image.attr('srcset', imageSrcSet); 1781 1782 if (imageSizes) { 1783 image.attr('sizes', imageSizes); 1784 } 1785 } 1786 1787 image 1788 .attr('src', imageSource) 1789 .removeAttr('data-lazy data-srcset data-sizes') 1790 .removeClass('slick-loading'); 1791 1792 if (_.options.adaptiveHeight === true) { 1793 _.setPosition(); 1794 } 1795 1796 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 1797 _.progressiveLazyLoad(); 1798 }; 1799 1800 imageToLoad.onerror = function () { 1801 if (tryCount < 3) { 1802 /** 1803 * try to load the image 3 times, 1804 * leave a slight delay so we don't get 1805 * servers blocking the request. 1806 */ 1807 setTimeout(function () { 1808 _.progressiveLazyLoad(tryCount + 1); 1809 }, 500); 1810 } else { 1811 image 1812 .removeAttr('data-lazy') 1813 .removeClass('slick-loading') 1814 .addClass('slick-lazyload-error'); 1815 1816 _.$slider.trigger('lazyLoadError', [_, image, imageSource]); 1817 1818 _.progressiveLazyLoad(); 1819 } 1820 }; 1821 1822 imageToLoad.src = imageSource; 1823 } else { 1824 _.$slider.trigger('allImagesLoaded', [_]); 1825 } 1826 }; 1827 1828 Slick.prototype.refresh = function (initializing) { 1829 var _ = this, 1830 currentSlide, 1831 lastVisibleIndex; 1832 1833 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 1834 1835 // in non-infinite sliders, we don't want to go past the 1836 // last visible index. 1837 if (!_.options.infinite && _.currentSlide > lastVisibleIndex) { 1838 _.currentSlide = lastVisibleIndex; 1839 } 1840 1841 // if less slides than to show, go to start. 1842 if (_.slideCount <= _.options.slidesToShow) { 1843 _.currentSlide = 0; 1844 } 1845 1846 currentSlide = _.currentSlide; 1847 1848 _.destroy(true); 1849 1850 $.extend(_, _.initials, { currentSlide: currentSlide }); 1851 1852 _.init(); 1853 1854 if (!initializing) { 1855 _.changeSlide( 1856 { 1857 data: { 1858 message: 'index', 1859 index: currentSlide 1860 } 1861 }, 1862 false 1863 ); 1864 } 1865 }; 1866 1867 Slick.prototype.registerBreakpoints = function () { 1868 var _ = this, 1869 breakpoint, 1870 currentBreakpoint, 1871 l, 1872 responsiveSettings = _.options.responsive || null; 1873 1874 if ($.type(responsiveSettings) === 'array' && responsiveSettings.length) { 1875 _.respondTo = _.options.respondTo || 'window'; 1876 1877 for (breakpoint in responsiveSettings) { 1878 l = _.breakpoints.length - 1; 1879 1880 if (responsiveSettings.hasOwnProperty(breakpoint)) { 1881 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 1882 1883 // loop through the breakpoints and cut out any existing 1884 // ones with the same breakpoint number, we don't want dupes. 1885 while (l >= 0) { 1886 if (_.breakpoints[l] && _.breakpoints[l] === currentBreakpoint) { 1887 _.breakpoints.splice(l, 1); 1888 } 1889 l--; 1890 } 1891 1892 _.breakpoints.push(currentBreakpoint); 1893 _.breakpointSettings[currentBreakpoint] = 1894 responsiveSettings[breakpoint].settings; 1895 } 1896 } 1897 1898 _.breakpoints.sort(function (a, b) { 1899 return _.options.mobileFirst ? a - b : b - a; 1900 }); 1901 } 1902 }; 1903 1904 Slick.prototype.reinit = function () { 1905 var _ = this; 1906 1907 _.$slides = _.$slideTrack.children(_.options.slide).addClass('slick-slide'); 1908 1909 _.slideCount = _.$slides.length; 1910 1911 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 1912 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 1913 } 1914 1915 if (_.slideCount <= _.options.slidesToShow) { 1916 _.currentSlide = 0; 1917 } 1918 1919 _.registerBreakpoints(); 1920 1921 _.setProps(); 1922 _.setupInfinite(); 1923 _.buildArrows(); 1924 _.updateArrows(); 1925 _.initArrowEvents(); 1926 _.buildDots(); 1927 _.updateDots(); 1928 _.initDotEvents(); 1929 _.cleanUpSlideEvents(); 1930 _.initSlideEvents(); 1931 1932 _.checkResponsive(false, true); 1933 1934 if (_.options.focusOnSelect === true) { 1935 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1936 } 1937 1938 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 1939 1940 _.setPosition(); 1941 _.focusHandler(); 1942 1943 _.paused = !_.options.autoplay; 1944 _.autoPlay(); 1945 1946 _.$slider.trigger('reInit', [_]); 1947 }; 1948 1949 Slick.prototype.resize = function () { 1950 var _ = this; 1951 1952 if ($(window).width() !== _.windowWidth) { 1953 clearTimeout(_.windowDelay); 1954 _.windowDelay = window.setTimeout(function () { 1955 _.windowWidth = $(window).width(); 1956 _.checkResponsive(); 1957 if (!_.unslicked) { 1958 _.setPosition(); 1959 } 1960 }, 50); 1961 } 1962 }; 1963 1964 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function ( 1965 index, 1966 removeBefore, 1967 removeAll 1968 ) { 1969 var _ = this; 1970 1971 if (typeof index === 'boolean') { 1972 removeBefore = index; 1973 index = removeBefore === true ? 0 : _.slideCount - 1; 1974 } else { 1975 index = removeBefore === true ? --index : index; 1976 } 1977 1978 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 1979 return false; 1980 } 1981 1982 _.unload(); 1983 1984 if (removeAll === true) { 1985 _.$slideTrack.children().remove(); 1986 } else { 1987 _.$slideTrack.children(this.options.slide).eq(index).remove(); 1988 } 1989 1990 _.$slides = _.$slideTrack.children(this.options.slide); 1991 1992 _.$slideTrack.children(this.options.slide).detach(); 1993 1994 _.$slideTrack.append(_.$slides); 1995 1996 _.$slidesCache = _.$slides; 1997 1998 _.reinit(); 1999 }; 2000 2001 Slick.prototype.setCSS = function (position) { 2002 var _ = this, 2003 positionProps = {}, 2004 x, 2005 y; 2006 2007 if (_.options.rtl === true) { 2008 position = -position; 2009 } 2010 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 2011 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 2012 2013 positionProps[_.positionProp] = position; 2014 2015 if (_.transformsEnabled === false) { 2016 _.$slideTrack.css(positionProps); 2017 } else { 2018 positionProps = {}; 2019 if (_.cssTransitions === false) { 2020 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 2021 _.$slideTrack.css(positionProps); 2022 } else { 2023 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 2024 _.$slideTrack.css(positionProps); 2025 } 2026 } 2027 }; 2028 2029 Slick.prototype.setDimensions = function () { 2030 var _ = this; 2031 2032 if (_.options.vertical === false) { 2033 if (_.options.centerMode === true) { 2034 _.$list.css({ 2035 padding: '0px ' + _.options.centerPadding 2036 }); 2037 } 2038 } else { 2039 _.$list.height( 2040 _.$slides.first().outerHeight(true) * _.options.slidesToShow 2041 ); 2042 if (_.options.centerMode === true) { 2043 _.$list.css({ 2044 padding: _.options.centerPadding + ' 0px' 2045 }); 2046 } 2047 } 2048 2049 _.listWidth = _.$list.width(); 2050 _.listHeight = _.$list.height(); 2051 2052 if (_.options.vertical === false && _.options.variableWidth === false) { 2053 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 2054 _.$slideTrack.width( 2055 Math.ceil(_.slideWidth * _.$slideTrack.children('.slick-slide').length) 2056 ); 2057 } else if (_.options.variableWidth === true) { 2058 _.$slideTrack.width(5000 * _.slideCount); 2059 } else { 2060 _.slideWidth = Math.ceil(_.listWidth); 2061 _.$slideTrack.height( 2062 Math.ceil( 2063 _.$slides.first().outerHeight(true) * 2064 _.$slideTrack.children('.slick-slide').length 2065 ) 2066 ); 2067 } 2068 2069 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 2070 if (_.options.variableWidth === false) 2071 _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 2072 }; 2073 2074 Slick.prototype.setFade = function () { 2075 var _ = this, 2076 targetLeft; 2077 2078 _.$slides.each(function (index, element) { 2079 targetLeft = _.slideWidth * index * -1; 2080 if (_.options.rtl === true) { 2081 $(element).css({ 2082 position: 'relative', 2083 right: targetLeft, 2084 top: 0, 2085 zIndex: _.options.zIndex - 2, 2086 opacity: 0 2087 }); 2088 } else { 2089 $(element).css({ 2090 position: 'relative', 2091 left: targetLeft, 2092 top: 0, 2093 zIndex: _.options.zIndex - 2, 2094 opacity: 0 2095 }); 2096 } 2097 }); 2098 2099 _.$slides.eq(_.currentSlide).css({ 2100 zIndex: _.options.zIndex - 1, 2101 opacity: 1 2102 }); 2103 }; 2104 2105 Slick.prototype.setHeight = function () { 2106 var _ = this; 2107 2108 if ( 2109 _.options.slidesToShow === 1 && 2110 _.options.adaptiveHeight === true && 2111 _.options.vertical === false 2112 ) { 2113 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 2114 _.$list.css('height', targetHeight); 2115 } 2116 }; 2117 2118 Slick.prototype.setOption = Slick.prototype.slickSetOption = function () { 2119 /** 2120 * accepts arguments in format of: 2121 * 2122 * - for changing a single option's value: 2123 * .slick("setOption", option, value, refresh ) 2124 * 2125 * - for changing a set of responsive options: 2126 * .slick("setOption", 'responsive', [{}, ...], refresh ) 2127 * 2128 * - for updating multiple values at once (not responsive) 2129 * .slick("setOption", { 'option': value, ... }, refresh ) 2130 */ 2131 2132 var _ = this, 2133 l, 2134 item, 2135 option, 2136 value, 2137 refresh = false, 2138 type; 2139 2140 if ($.type(arguments[0]) === 'object') { 2141 option = arguments[0]; 2142 refresh = arguments[1]; 2143 type = 'multiple'; 2144 } else if ($.type(arguments[0]) === 'string') { 2145 option = arguments[0]; 2146 value = arguments[1]; 2147 refresh = arguments[2]; 2148 2149 if (arguments[0] === 'responsive' && $.type(arguments[1]) === 'array') { 2150 type = 'responsive'; 2151 } else if (typeof arguments[1] !== 'undefined') { 2152 type = 'single'; 2153 } 2154 } 2155 2156 if (type === 'single') { 2157 _.options[option] = value; 2158 } else if (type === 'multiple') { 2159 $.each(option, function (opt, val) { 2160 _.options[opt] = val; 2161 }); 2162 } else if (type === 'responsive') { 2163 for (item in value) { 2164 if ($.type(_.options.responsive) !== 'array') { 2165 _.options.responsive = [value[item]]; 2166 } else { 2167 l = _.options.responsive.length - 1; 2168 2169 // loop through the responsive object and splice out duplicates. 2170 while (l >= 0) { 2171 if (_.options.responsive[l].breakpoint === value[item].breakpoint) { 2172 _.options.responsive.splice(l, 1); 2173 } 2174 2175 l--; 2176 } 2177 2178 _.options.responsive.push(value[item]); 2179 } 2180 } 2181 } 2182 2183 if (refresh) { 2184 _.unload(); 2185 _.reinit(); 2186 } 2187 }; 2188 2189 Slick.prototype.setPosition = function () { 2190 var _ = this; 2191 2192 _.setDimensions(); 2193 2194 _.setHeight(); 2195 2196 if (_.options.fade === false) { 2197 _.setCSS(_.getLeft(_.currentSlide)); 2198 } else { 2199 _.setFade(); 2200 } 2201 2202 _.$slider.trigger('setPosition', [_]); 2203 }; 2204 2205 Slick.prototype.setProps = function () { 2206 var _ = this, 2207 bodyStyle = document.body.style; 2208 2209 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 2210 2211 if (_.positionProp === 'top') { 2212 _.$slider.addClass('slick-vertical'); 2213 } else { 2214 _.$slider.removeClass('slick-vertical'); 2215 } 2216 2217 if ( 2218 bodyStyle.WebkitTransition !== undefined || 2219 bodyStyle.MozTransition !== undefined || 2220 bodyStyle.msTransition !== undefined 2221 ) { 2222 if (_.options.useCSS === true) { 2223 _.cssTransitions = true; 2224 } 2225 } 2226 2227 if (_.options.fade) { 2228 if (typeof _.options.zIndex === 'number') { 2229 if (_.options.zIndex < 3) { 2230 _.options.zIndex = 3; 2231 } 2232 } else { 2233 _.options.zIndex = _.defaults.zIndex; 2234 } 2235 } 2236 2237 if (bodyStyle.OTransform !== undefined) { 2238 _.animType = 'OTransform'; 2239 _.transformType = '-o-transform'; 2240 _.transitionType = 'OTransition'; 2241 if ( 2242 bodyStyle.perspectiveProperty === undefined && 2243 bodyStyle.webkitPerspective === undefined 2244 ) 2245 _.animType = false; 2246 } 2247 if (bodyStyle.MozTransform !== undefined) { 2248 _.animType = 'MozTransform'; 2249 _.transformType = '-moz-transform'; 2250 _.transitionType = 'MozTransition'; 2251 if ( 2252 bodyStyle.perspectiveProperty === undefined && 2253 bodyStyle.MozPerspective === undefined 2254 ) 2255 _.animType = false; 2256 } 2257 if (bodyStyle.webkitTransform !== undefined) { 2258 _.animType = 'webkitTransform'; 2259 _.transformType = '-webkit-transform'; 2260 _.transitionType = 'webkitTransition'; 2261 if ( 2262 bodyStyle.perspectiveProperty === undefined && 2263 bodyStyle.webkitPerspective === undefined 2264 ) 2265 _.animType = false; 2266 } 2267 if (bodyStyle.msTransform !== undefined) { 2268 _.animType = 'msTransform'; 2269 _.transformType = '-ms-transform'; 2270 _.transitionType = 'msTransition'; 2271 if (bodyStyle.msTransform === undefined) _.animType = false; 2272 } 2273 if (bodyStyle.transform !== undefined && _.animType !== false) { 2274 _.animType = 'transform'; 2275 _.transformType = 'transform'; 2276 _.transitionType = 'transition'; 2277 } 2278 _.transformsEnabled = 2279 _.options.useTransform && _.animType !== null && _.animType !== false; 2280 }; 2281 2282 Slick.prototype.setSlideClasses = function (index) { 2283 var _ = this, 2284 centerOffset, 2285 allSlides, 2286 indexOffset, 2287 remainder; 2288 2289 allSlides = _.$slider 2290 .find('.slick-slide') 2291 .removeClass('slick-active slick-center slick-current') 2292 .attr('aria-hidden', 'true'); 2293 2294 _.$slides.eq(index).addClass('slick-current'); 2295 2296 if (_.options.centerMode === true) { 2297 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 2298 2299 centerOffset = Math.floor(_.options.slidesToShow / 2); 2300 2301 if (_.options.infinite === true) { 2302 if (index >= centerOffset && index <= _.slideCount - 1 - centerOffset) { 2303 _.$slides 2304 .slice(index - centerOffset + evenCoef, index + centerOffset + 1) 2305 .addClass('slick-active') 2306 .attr('aria-hidden', 'false'); 2307 } else { 2308 indexOffset = _.options.slidesToShow + index; 2309 allSlides 2310 .slice( 2311 indexOffset - centerOffset + 1 + evenCoef, 2312 indexOffset + centerOffset + 2 2313 ) 2314 .addClass('slick-active') 2315 .attr('aria-hidden', 'false'); 2316 } 2317 2318 if (index === 0) { 2319 allSlides 2320 .eq(allSlides.length - 1 - _.options.slidesToShow) 2321 .addClass('slick-center'); 2322 } else if (index === _.slideCount - 1) { 2323 allSlides.eq(_.options.slidesToShow).addClass('slick-center'); 2324 } 2325 } 2326 2327 _.$slides.eq(index).addClass('slick-center'); 2328 } else { 2329 if (index >= 0 && index <= _.slideCount - _.options.slidesToShow) { 2330 _.$slides 2331 .slice(index, index + _.options.slidesToShow) 2332 .addClass('slick-active') 2333 .attr('aria-hidden', 'false'); 2334 } else if (allSlides.length <= _.options.slidesToShow) { 2335 allSlides.addClass('slick-active').attr('aria-hidden', 'false'); 2336 } else { 2337 remainder = _.slideCount % _.options.slidesToShow; 2338 indexOffset = 2339 _.options.infinite === true ? _.options.slidesToShow + index : index; 2340 2341 if ( 2342 _.options.slidesToShow == _.options.slidesToScroll && 2343 _.slideCount - index < _.options.slidesToShow 2344 ) { 2345 allSlides 2346 .slice( 2347 indexOffset - (_.options.slidesToShow - remainder), 2348 indexOffset + remainder 2349 ) 2350 .addClass('slick-active') 2351 .attr('aria-hidden', 'false'); 2352 } else { 2353 allSlides 2354 .slice(indexOffset, indexOffset + _.options.slidesToShow) 2355 .addClass('slick-active') 2356 .attr('aria-hidden', 'false'); 2357 } 2358 } 2359 } 2360 2361 if ( 2362 _.options.lazyLoad === 'ondemand' || 2363 _.options.lazyLoad === 'anticipated' 2364 ) { 2365 _.lazyLoad(); 2366 } 2367 }; 2368 2369 Slick.prototype.setupInfinite = function () { 2370 var _ = this, 2371 i, 2372 slideIndex, 2373 infiniteCount; 2374 2375 if (_.options.fade === true) { 2376 _.options.centerMode = false; 2377 } 2378 2379 if (_.options.infinite === true && _.options.fade === false) { 2380 slideIndex = null; 2381 2382 if (_.slideCount > _.options.slidesToShow) { 2383 if (_.options.centerMode === true) { 2384 infiniteCount = _.options.slidesToShow + 1; 2385 } else { 2386 infiniteCount = _.options.slidesToShow; 2387 } 2388 2389 for (i = _.slideCount; i > _.slideCount - infiniteCount; i -= 1) { 2390 slideIndex = i - 1; 2391 $(_.$slides[slideIndex]) 2392 .clone(true) 2393 .attr('id', '') 2394 .attr('data-slick-index', slideIndex - _.slideCount) 2395 .prependTo(_.$slideTrack) 2396 .addClass('slick-cloned'); 2397 } 2398 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 2399 slideIndex = i; 2400 $(_.$slides[slideIndex]) 2401 .clone(true) 2402 .attr('id', '') 2403 .attr('data-slick-index', slideIndex + _.slideCount) 2404 .appendTo(_.$slideTrack) 2405 .addClass('slick-cloned'); 2406 } 2407 _.$slideTrack 2408 .find('.slick-cloned') 2409 .find('[id]') 2410 .each(function () { 2411 $(this).attr('id', ''); 2412 }); 2413 } 2414 } 2415 }; 2416 2417 Slick.prototype.interrupt = function (toggle) { 2418 var _ = this; 2419 2420 if (!toggle) { 2421 _.autoPlay(); 2422 } 2423 _.interrupted = toggle; 2424 }; 2425 2426 Slick.prototype.selectHandler = function (event) { 2427 var _ = this; 2428 2429 var targetElement = $(event.target).is('.slick-slide') 2430 ? $(event.target) 2431 : $(event.target).parents('.slick-slide'); 2432 2433 var index = parseInt(targetElement.attr('data-slick-index')); 2434 2435 if (!index) index = 0; 2436 2437 if (_.slideCount <= _.options.slidesToShow) { 2438 _.slideHandler(index, false, true); 2439 return; 2440 } 2441 2442 _.slideHandler(index); 2443 }; 2444 2445 Slick.prototype.slideHandler = function (index, sync, dontAnimate) { 2446 var targetSlide, 2447 animSlide, 2448 oldSlide, 2449 slideLeft, 2450 targetLeft = null, 2451 _ = this, 2452 navTarget; 2453 2454 sync = sync || false; 2455 2456 if (_.animating === true && _.options.waitForAnimate === true) { 2457 return; 2458 } 2459 2460 if (_.options.fade === true && _.currentSlide === index) { 2461 return; 2462 } 2463 2464 if (sync === false) { 2465 _.asNavFor(index); 2466 } 2467 2468 targetSlide = index; 2469 targetLeft = _.getLeft(targetSlide); 2470 slideLeft = _.getLeft(_.currentSlide); 2471 2472 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 2473 2474 if ( 2475 _.options.infinite === false && 2476 _.options.centerMode === false && 2477 (index < 0 || index > _.getDotCount() * _.options.slidesToScroll) 2478 ) { 2479 if (_.options.fade === false) { 2480 targetSlide = _.currentSlide; 2481 if (dontAnimate !== true) { 2482 _.animateSlide(slideLeft, function () { 2483 _.postSlide(targetSlide); 2484 }); 2485 } else { 2486 _.postSlide(targetSlide); 2487 } 2488 } 2489 return; 2490 } else if ( 2491 _.options.infinite === false && 2492 _.options.centerMode === true && 2493 (index < 0 || index > _.slideCount - _.options.slidesToScroll) 2494 ) { 2495 if (_.options.fade === false) { 2496 targetSlide = _.currentSlide; 2497 if (dontAnimate !== true) { 2498 _.animateSlide(slideLeft, function () { 2499 _.postSlide(targetSlide); 2500 }); 2501 } else { 2502 _.postSlide(targetSlide); 2503 } 2504 } 2505 return; 2506 } 2507 2508 if (_.options.autoplay) { 2509 clearInterval(_.autoPlayTimer); 2510 } 2511 2512 if (targetSlide < 0) { 2513 if (_.slideCount % _.options.slidesToScroll !== 0) { 2514 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 2515 } else { 2516 animSlide = _.slideCount + targetSlide; 2517 } 2518 } else if (targetSlide >= _.slideCount) { 2519 if (_.slideCount % _.options.slidesToScroll !== 0) { 2520 animSlide = 0; 2521 } else { 2522 animSlide = targetSlide - _.slideCount; 2523 } 2524 } else { 2525 animSlide = targetSlide; 2526 } 2527 2528 _.animating = true; 2529 2530 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 2531 2532 oldSlide = _.currentSlide; 2533 _.currentSlide = animSlide; 2534 2535 _.setSlideClasses(_.currentSlide); 2536 2537 if (_.options.asNavFor) { 2538 navTarget = _.getNavTarget(); 2539 navTarget = navTarget.slick('getSlick'); 2540 2541 if (navTarget.slideCount <= navTarget.options.slidesToShow) { 2542 navTarget.setSlideClasses(_.currentSlide); 2543 } 2544 } 2545 2546 _.updateDots(); 2547 _.updateArrows(); 2548 2549 if (_.options.fade === true) { 2550 if (dontAnimate !== true) { 2551 _.fadeSlideOut(oldSlide); 2552 2553 _.fadeSlide(animSlide, function () { 2554 _.postSlide(animSlide); 2555 }); 2556 } else { 2557 _.postSlide(animSlide); 2558 } 2559 _.animateHeight(); 2560 return; 2561 } 2562 2563 if (dontAnimate !== true) { 2564 _.animateSlide(targetLeft, function () { 2565 _.postSlide(animSlide); 2566 }); 2567 } else { 2568 _.postSlide(animSlide); 2569 } 2570 }; 2571 2572 Slick.prototype.startLoad = function () { 2573 var _ = this; 2574 2575 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 2576 _.$prevArrow.hide(); 2577 _.$nextArrow.hide(); 2578 } 2579 2580 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 2581 _.$dots.hide(); 2582 } 2583 2584 _.$slider.addClass('slick-loading'); 2585 }; 2586 2587 Slick.prototype.swipeDirection = function () { 2588 var xDist, 2589 yDist, 2590 r, 2591 swipeAngle, 2592 _ = this; 2593 2594 xDist = _.touchObject.startX - _.touchObject.curX; 2595 yDist = _.touchObject.startY - _.touchObject.curY; 2596 r = Math.atan2(yDist, xDist); 2597 2598 swipeAngle = Math.round((r * 180) / Math.PI); 2599 if (swipeAngle < 0) { 2600 swipeAngle = 360 - Math.abs(swipeAngle); 2601 } 2602 2603 if (swipeAngle <= 45 && swipeAngle >= 0) { 2604 return _.options.rtl === false ? 'left' : 'right'; 2605 } 2606 if (swipeAngle <= 360 && swipeAngle >= 315) { 2607 return _.options.rtl === false ? 'left' : 'right'; 2608 } 2609 if (swipeAngle >= 135 && swipeAngle <= 225) { 2610 return _.options.rtl === false ? 'right' : 'left'; 2611 } 2612 if (_.options.verticalSwiping === true) { 2613 if (swipeAngle >= 35 && swipeAngle <= 135) { 2614 return 'down'; 2615 } else { 2616 return 'up'; 2617 } 2618 } 2619 2620 return 'vertical'; 2621 }; 2622 2623 Slick.prototype.swipeEnd = function (event) { 2624 var _ = this, 2625 slideCount, 2626 direction; 2627 2628 _.dragging = false; 2629 _.swiping = false; 2630 2631 if (_.scrolling) { 2632 _.scrolling = false; 2633 return false; 2634 } 2635 2636 _.interrupted = false; 2637 _.shouldClick = _.touchObject.swipeLength > 10 ? false : true; 2638 2639 if (_.touchObject.curX === undefined) { 2640 return false; 2641 } 2642 2643 if (_.touchObject.edgeHit === true) { 2644 _.$slider.trigger('edge', [_, _.swipeDirection()]); 2645 } 2646 2647 if (_.touchObject.swipeLength >= _.touchObject.minSwipe) { 2648 direction = _.swipeDirection(); 2649 2650 switch (direction) { 2651 case 'left': 2652 case 'down': 2653 slideCount = _.options.swipeToSlide 2654 ? _.checkNavigable(_.currentSlide + _.getSlideCount()) 2655 : _.currentSlide + _.getSlideCount(); 2656 2657 _.currentDirection = 0; 2658 2659 break; 2660 2661 case 'right': 2662 case 'up': 2663 slideCount = _.options.swipeToSlide 2664 ? _.checkNavigable(_.currentSlide - _.getSlideCount()) 2665 : _.currentSlide - _.getSlideCount(); 2666 2667 _.currentDirection = 1; 2668 2669 break; 2670 2671 default: 2672 } 2673 2674 if (direction != 'vertical') { 2675 _.slideHandler(slideCount); 2676 _.touchObject = {}; 2677 _.$slider.trigger('swipe', [_, direction]); 2678 } 2679 } else { 2680 if (_.touchObject.startX !== _.touchObject.curX) { 2681 _.slideHandler(_.currentSlide); 2682 _.touchObject = {}; 2683 } 2684 } 2685 }; 2686 2687 Slick.prototype.swipeHandler = function (event) { 2688 var _ = this; 2689 2690 if ( 2691 _.options.swipe === false || 2692 ('ontouchend' in document && _.options.swipe === false) 2693 ) { 2694 return; 2695 } else if ( 2696 _.options.draggable === false && 2697 event.type.indexOf('mouse') !== -1 2698 ) { 2699 return; 2700 } 2701 2702 _.touchObject.fingerCount = 2703 event.originalEvent && event.originalEvent.touches !== undefined 2704 ? event.originalEvent.touches.length 2705 : 1; 2706 2707 _.touchObject.minSwipe = _.listWidth / _.options.touchThreshold; 2708 2709 if (_.options.verticalSwiping === true) { 2710 _.touchObject.minSwipe = _.listHeight / _.options.touchThreshold; 2711 } 2712 2713 switch (event.data.action) { 2714 case 'start': 2715 _.swipeStart(event); 2716 break; 2717 2718 case 'move': 2719 _.swipeMove(event); 2720 break; 2721 2722 case 'end': 2723 _.swipeEnd(event); 2724 break; 2725 } 2726 }; 2727 2728 Slick.prototype.swipeMove = function (event) { 2729 var _ = this, 2730 edgeWasHit = false, 2731 curLeft, 2732 swipeDirection, 2733 swipeLength, 2734 positionOffset, 2735 touches, 2736 verticalSwipeLength; 2737 2738 touches = 2739 event.originalEvent !== undefined ? event.originalEvent.touches : null; 2740 2741 if (!_.dragging || _.scrolling || (touches && touches.length !== 1)) { 2742 return false; 2743 } 2744 2745 curLeft = _.getLeft(_.currentSlide); 2746 2747 _.touchObject.curX = 2748 touches !== undefined ? touches[0].pageX : event.clientX; 2749 _.touchObject.curY = 2750 touches !== undefined ? touches[0].pageY : event.clientY; 2751 2752 _.touchObject.swipeLength = Math.round( 2753 Math.sqrt(Math.pow(_.touchObject.curX - _.touchObject.startX, 2)) 2754 ); 2755 2756 verticalSwipeLength = Math.round( 2757 Math.sqrt(Math.pow(_.touchObject.curY - _.touchObject.startY, 2)) 2758 ); 2759 2760 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 2761 _.scrolling = true; 2762 return false; 2763 } 2764 2765 if (_.options.verticalSwiping === true) { 2766 _.touchObject.swipeLength = verticalSwipeLength; 2767 } 2768 2769 swipeDirection = _.swipeDirection(); 2770 2771 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 2772 _.swiping = true; 2773 event.preventDefault(); 2774 } 2775 2776 positionOffset = 2777 (_.options.rtl === false ? 1 : -1) * 2778 (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 2779 if (_.options.verticalSwiping === true) { 2780 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 2781 } 2782 2783 swipeLength = _.touchObject.swipeLength; 2784 2785 _.touchObject.edgeHit = false; 2786 2787 if (_.options.infinite === false) { 2788 if ( 2789 (_.currentSlide === 0 && swipeDirection === 'right') || 2790 (_.currentSlide >= _.getDotCount() && swipeDirection === 'left') 2791 ) { 2792 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 2793 _.touchObject.edgeHit = true; 2794 } 2795 } 2796 2797 if (_.options.vertical === false) { 2798 _.swipeLeft = curLeft + swipeLength * positionOffset; 2799 } else { 2800 _.swipeLeft = 2801 curLeft + 2802 swipeLength * (_.$list.height() / _.listWidth) * positionOffset; 2803 } 2804 if (_.options.verticalSwiping === true) { 2805 _.swipeLeft = curLeft + swipeLength * positionOffset; 2806 } 2807 2808 if (_.options.fade === true || _.options.touchMove === false) { 2809 return false; 2810 } 2811 2812 if (_.animating === true) { 2813 _.swipeLeft = null; 2814 return false; 2815 } 2816 2817 _.setCSS(_.swipeLeft); 2818 }; 2819 2820 Slick.prototype.swipeStart = function (event) { 2821 var _ = this, 2822 touches; 2823 2824 _.interrupted = true; 2825 2826 if ( 2827 _.touchObject.fingerCount !== 1 || 2828 _.slideCount <= _.options.slidesToShow 2829 ) { 2830 _.touchObject = {}; 2831 return false; 2832 } 2833 2834 if ( 2835 event.originalEvent !== undefined && 2836 event.originalEvent.touches !== undefined 2837 ) { 2838 touches = event.originalEvent.touches[0]; 2839 } 2840 2841 _.touchObject.startX = _.touchObject.curX = 2842 touches !== undefined ? touches.pageX : event.clientX; 2843 _.touchObject.startY = _.touchObject.curY = 2844 touches !== undefined ? touches.pageY : event.clientY; 2845 2846 _.dragging = true; 2847 }; 2848 2849 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function () { 2850 var _ = this; 2851 2852 if (_.$slidesCache !== null) { 2853 _.unload(); 2854 2855 _.$slideTrack.children(this.options.slide).detach(); 2856 2857 _.$slidesCache.appendTo(_.$slideTrack); 2858 2859 _.reinit(); 2860 } 2861 }; 2862 2863 Slick.prototype.unload = function () { 2864 var _ = this; 2865 2866 $('.slick-cloned', _.$slider).remove(); 2867 2868 if (_.$dots) { 2869 _.$dots.remove(); 2870 } 2871 2872 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 2873 _.$prevArrow.remove(); 2874 } 2875 2876 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 2877 _.$nextArrow.remove(); 2878 } 2879 2880 _.$slides 2881 .removeClass('slick-slide slick-active slick-visible slick-current') 2882 .attr('aria-hidden', 'true') 2883 .css('width', ''); 2884 }; 2885 2886 Slick.prototype.unslick = function (fromBreakpoint) { 2887 var _ = this; 2888 _.$slider.trigger('unslick', [_, fromBreakpoint]); 2889 _.destroy(); 2890 }; 2891 2892 Slick.prototype.updateArrows = function () { 2893 var _ = this, 2894 centerOffset; 2895 2896 centerOffset = Math.floor(_.options.slidesToShow / 2); 2897 2898 if ( 2899 _.options.arrows === true && 2900 _.slideCount > _.options.slidesToShow && 2901 !_.options.infinite 2902 ) { 2903 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2904 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2905 2906 if (_.currentSlide === 0) { 2907 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2908 _.$nextArrow 2909 .removeClass('slick-disabled') 2910 .attr('aria-disabled', 'false'); 2911 } else if ( 2912 _.currentSlide >= _.slideCount - _.options.slidesToShow && 2913 _.options.centerMode === false 2914 ) { 2915 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2916 _.$prevArrow 2917 .removeClass('slick-disabled') 2918 .attr('aria-disabled', 'false'); 2919 } else if ( 2920 _.currentSlide >= _.slideCount - 1 && 2921 _.options.centerMode === true 2922 ) { 2923 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2924 _.$prevArrow 2925 .removeClass('slick-disabled') 2926 .attr('aria-disabled', 'false'); 2927 } 2928 } 2929 }; 2930 2931 Slick.prototype.updateDots = function () { 2932 var _ = this; 2933 2934 if (_.$dots !== null) { 2935 _.$dots.find('li').removeClass('slick-active').end(); 2936 2937 _.$dots 2938 .find('li') 2939 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 2940 .addClass('slick-active'); 2941 } 2942 }; 2943 2944 Slick.prototype.visibility = function () { 2945 var _ = this; 2946 2947 if (_.options.autoplay) { 2948 if (document[_.hidden]) { 2949 _.interrupted = true; 2950 } else { 2951 _.interrupted = false; 2952 } 2953 } 2954 }; 2955 2956 $.fn.slick = function () { 2957 var _ = this, 2958 opt = arguments[0], 2959 args = Array.prototype.slice.call(arguments, 1), 2960 l = _.length, 2961 i, 2962 ret; 2963 for (i = 0; i < l; i++) { 2964 if (typeof opt == 'object' || typeof opt == 'undefined') 2965 _[i].slick = new Slick(_[i], opt); 2966 else ret = _[i].slick[opt].apply(_[i].slick, args); 2967 if (typeof ret != 'undefined') return ret; 2968 } 2969 return _; 2970 }; 2971});
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.