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