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