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