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