1/** 2 * Copyright ETS Software Technology Co., Ltd 3 * 4 * NOTICE OF LICENSE 5 * 6 * This file is not open source! Each license that you purchased is only available for 1 website only. 7 * If you want to use this file on more websites (or projects), you need to purchase additional licenses. 8 * You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party. 9 * 10 * DISCLAIMER 11 * 12 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer 13 * versions in the future. 14 * 15 * @author ETS Software Technology Co., Ltd 16 * @copyright ETS Software Technology Co., Ltd 17 * @license Valid for 1 website (or project) for each purchase of license 18 */ 19;(function(factory) { 20 'use strict'; 21 if (typeof define === 'function' && define.amd) { 22 define(['jquery'], factory); 23 } else if (typeof exports !== 'undefined') { 24 module.exports = factory(require('jquery')); 25 } else { 26 factory(jQuery); 27 } 28 29}(function($) { 30 'use strict'; 31 var Slick = window.Slick || {}; 32 33 Slick = (function() { 34 35 var instanceUid = 0; 36 37 function Slick(element, settings) { 38 39 var _ = this, dataSettings; 40 41 _.defaults = { 42 accessibility: true, 43 adaptiveHeight: false, 44 appendArrows: $(element), 45 appendDots: $(element), 46 arrows: true, 47 asNavFor: null, 48 prevArrow: '<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>', 49 nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button">Next</button>', 50 autoplay: false, 51 autoplaySpeed: 3000, 52 centerMode: false, 53 centerPadding: '50px', 54 cssEase: 'ease', 55 customPaging: function(slider, i) { 56 return $('<button type="button" data-role="none" role="button" tabindex="0" />').text(i + 1); 57 }, 58 dots: false, 59 dotsClass: 'slick-dots', 60 draggable: true, 61 easing: 'linear', 62 edgeFriction: 0.35, 63 fade: false, 64 focusOnSelect
vendor: 12,428 bytes, lines 64-487
64: 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; 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 }).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
vendor: 17,997 bytes, lines 487-1084
487) { 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').attr('aria-hidden', 'false'); 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 aria-live="polite" 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 > 1) { 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 } 766 767 _.$slider.off('focus.slick blur.slick'); 768 769 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 770 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 771 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 772 } 773 774 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 775 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 776 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler); 777 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 778 779 _.$list.off('click.slick', _.clickHandler); 780 781 $(document).off(_.visibilityChange, _.visibility); 782 783 _.cleanUpSlideEvents(); 784 785 if (_.options.accessibility === true) { 786 _.$list.off('keydown.slick', _.keyHandler); 787 } 788 789 if (_.options.focusOnSelect === true) { 790 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 791 } 792 793 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 794 795 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 796 797 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 798 799 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 800 801 }; 802 803 Slick.prototype.cleanUpSlideEvents = function() { 804 805 var _ = this; 806 807 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 808 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 809 810 }; 811 812 Slick.prototype.cleanUpRows = function() { 813 814 var _ = this, originalSlides; 815 816 if(_.options.rows > 1) { 817 originalSlides = _.$slides.children().children(); 818 originalSlides.removeAttr('style'); 819 _.$slider.empty().append(originalSlides); 820 } 821 822 }; 823 824 Slick.prototype.clickHandler = function(event) { 825 826 var _ = this; 827 828 if (_.shouldClick === false) { 829 event.stopImmediatePropagation(); 830 event.stopPropagation(); 831 event.preventDefault(); 832 } 833 834 }; 835 836 Slick.prototype.destroy = function(refresh) { 837 838 var _ = this; 839 840 _.autoPlayClear(); 841 842 _.touchObject = {}; 843 844 _.cleanUpEvents(); 845 846 $('.slick-cloned', _.$slider).detach(); 847 848 if (_.$dots) { 849 _.$dots.remove(); 850 } 851 852 if ( _.$prevArrow && _.$prevArrow.length ) { 853 854 _.$prevArrow 855 .removeClass('slick-disabled slick-arrow slick-hidden') 856 .removeAttr('aria-hidden aria-disabled tabindex') 857 .css('display',''); 858 859 if ( _.htmlExpr.test( _.options.prevArrow )) { 860 _.$prevArrow.remove(); 861 } 862 } 863 864 if ( _.$nextArrow && _.$nextArrow.length ) { 865 866 _.$nextArrow 867 .removeClass('slick-disabled slick-arrow slick-hidden') 868 .removeAttr('aria-hidden aria-disabled tabindex') 869 .css('display',''); 870 871 if ( _.htmlExpr.test( _.options.nextArrow )) { 872 _.$nextArrow.remove(); 873 } 874 } 875 876 877 if (_.$slides) { 878 879 _.$slides 880 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 881 .removeAttr('aria-hidden') 882 .removeAttr('data-slick-index') 883 .each(function(){ 884 $(this).attr('style', $(this).data('originalStyling')); 885 }); 886 887 _.$slideTrack.children(this.options.slide).detach(); 888 889 _.$slideTrack.detach(); 890 891 _.$list.detach(); 892 893 _.$slider.append(_.$slides); 894 } 895 896 _.cleanUpRows(); 897 898 _.$slider.removeClass('slick-slider'); 899 _.$slider.removeClass('slick-initialized'); 900 _.$slider.removeClass('slick-dotted'); 901 902 _.unslicked = true; 903 904 if(!refresh) { 905 _.$slider.trigger('destroy', [_]); 906 } 907 908 }; 909 910 Slick.prototype.disableTransition = function(slide) { 911 912 var _ = this, 913 transition = {}; 914 915 transition[_.transitionType] = ''; 916 917 if (_.options.fade === false) { 918 _.$slideTrack.css(transition); 919 } else { 920 _.$slides.eq(slide).css(transition); 921 } 922 923 }; 924 925 Slick.prototype.fadeSlide = function(slideIndex, callback) { 926 927 var _ = this; 928 929 if (_.cssTransitions === false) { 930 931 _.$slides.eq(slideIndex).css({ 932 zIndex: _.options.zIndex 933 }); 934 935 _.$slides.eq(slideIndex).animate({ 936 opacity: 1 937 }, _.options.speed, _.options.easing, callback); 938 939 } else { 940 941 _.applyTransition(slideIndex); 942 943 _.$slides.eq(slideIndex).css({ 944 opacity: 1, 945 zIndex: _.options.zIndex 946 }); 947 948 if (callback) { 949 setTimeout(function() { 950 951 _.disableTransition(slideIndex); 952 953 callback.call(); 954 }, _.options.speed); 955 } 956 957 } 958 959 }; 960 961 Slick.prototype.fadeSlideOut = function(slideIndex) { 962 963 var _ = this; 964 965 if (_.cssTransitions === false) { 966 967 _.$slides.eq(slideIndex).animate({ 968 opacity: 0, 969 zIndex: _.options.zIndex - 2 970 }, _.options.speed, _.options.easing); 971 972 } else { 973 974 _.applyTransition(slideIndex); 975 976 _.$slides.eq(slideIndex).css({ 977 opacity: 0, 978 zIndex: _.options.zIndex - 2 979 }); 980 981 } 982 983 }; 984 985 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 986 987 var _ = this; 988 989 if (filter !== null) { 990 991 _.$slidesCache = _.$slides; 992 993 _.unload(); 994 995 _.$slideTrack.children(this.options.slide).detach(); 996 997 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 998 999 _.reinit(); 1000 1001 } 1002 1003 }; 1004 1005 Slick.prototype.focusHandler = function() { 1006 1007 var _ = this; 1008 1009 _.$slider 1010 .off('focus.slick blur.slick') 1011 .on('focus.slick blur.slick', 1012 '*:not(.slick-arrow)', function(event) { 1013 1014 event.stopImmediatePropagation(); 1015 var $sf = $(this); 1016 1017 setTimeout(function() { 1018 1019 if( _.options.pauseOnFocus ) { 1020 _.focussed = $sf.is(':focus'); 1021 _.autoPlay(); 1022 } 1023 1024 }, 0); 1025 1026 }); 1027 }; 1028 1029 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 1030 1031 var _ = this; 1032 return _.currentSlide; 1033 1034 }; 1035 1036 Slick.prototype.getDotCount = function() { 1037 1038 var _ = this; 1039 1040 var breakPoint = 0; 1041 var counter = 0; 1042 var pagerQty = 0; 1043 1044 if (_.options.infinite === true) { 1045 if (_.slideCount <= _.options.slidesToShow) { 1046 ++pagerQty; 1047 } else { 1048 while (breakPoint < _.slideCount) { 1049 ++pagerQty; 1050 breakPoint = counter + _.options.slidesToScroll; 1051 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1052 } 1053 } 1054 } else if (_.options.centerMode === true) { 1055 pagerQty = _.slideCount; 1056 } else if(!_.options.asNavFor) { 1057 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 1058 }else { 1059 while (breakPoint < _.slideCount) { 1060 ++pagerQty; 1061 breakPoint = counter + _.options.slidesToScroll; 1062 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1063 } 1064 } 1065 1066 return pagerQty - 1; 1067 1068 }; 1069 1070 Slick.prototype.getLeft = function(slideIndex) { 1071 1072 var _ = this, 1073 targetLeft, 1074 verticalHeight, 1075 verticalOffset = 0, 1076 targetSlide; 1077 1078 _.slideOffset = 0; 1079 verticalHeight = _.$slides.first().outerHeight(true); 1080 1081 if (_.options.infinite === true) { 1082 if (_.slideCount > _.options.slidesToShow) { 1083 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 1084 verticalOffset = (verticalHeight * _.options.slidesToShow) * -1
vendor: 6,628 bytes, lines 1084-1284
1084; 1085 } 1086 if (_.slideCount % _.options.slidesToScroll !== 0) { 1087 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 1088 if (slideIndex > _.slideCount) { 1089 _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1; 1090 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 1091 } else { 1092 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 1093 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 1094 } 1095 } 1096 } 1097 } else { 1098 if (slideIndex + _.options.slidesToShow > _.slideCount) { 1099 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 1100 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 1101 } 1102 } 1103 1104 if (_.slideCount <= _.options.slidesToShow) { 1105 _.slideOffset = 0; 1106 verticalOffset = 0; 1107 } 1108 1109 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 1110 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 1111 } else if (_.options.centerMode === true && _.options.infinite === true) { 1112 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 1113 } else if (_.options.centerMode === true) { 1114 _.slideOffset = 0; 1115 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 1116 } 1117 1118 if (_.options.vertical === false) { 1119 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 1120 } else { 1121 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 1122 } 1123 1124 if (_.options.variableWidth === true) { 1125 1126 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 1127 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 1128 } else { 1129 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 1130 } 1131 1132 if (_.options.rtl === true) { 1133 if (targetSlide[0]) { 1134 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 1135 } else { 1136 targetLeft = 0; 1137 } 1138 } else { 1139 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1140 } 1141 1142 if (_.options.centerMode === true) { 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 + 1); 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 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 1160 } 1161 } 1162 1163 return targetLeft; 1164 1165 }; 1166 1167 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 1168 1169 var _ = this; 1170 1171 return _.options[option]; 1172 1173 }; 1174 1175 Slick.prototype.getNavigableIndexes = function() { 1176 1177 var _ = this, 1178 breakPoint = 0, 1179 counter = 0, 1180 indexes = [], 1181 max; 1182 1183 if (_.options.infinite === false) { 1184 max = _.slideCount; 1185 } else { 1186 breakPoint = _.options.slidesToScroll * -1; 1187 counter = _.options.slidesToScroll * -1; 1188 max = _.slideCount * 2; 1189 } 1190 1191 while (breakPoint < max) { 1192 indexes.push(breakPoint); 1193 breakPoint = counter + _.options.slidesToScroll; 1194 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1195 } 1196 1197 return indexes; 1198 1199 }; 1200 1201 Slick.prototype.getSlick = function() { 1202 1203 return this; 1204 1205 }; 1206 1207 Slick.prototype.getSlideCount = function() { 1208 1209 var _ = this, 1210 slidesTraversed, swipedSlide, centerOffset; 1211 1212 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 1213 1214 if (_.options.swipeToSlide === true) { 1215 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 1216 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 1217 swipedSlide = slide; 1218 return false; 1219 } 1220 }); 1221 1222 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 1223 1224 return slidesTraversed; 1225 1226 } else { 1227 return _.options.slidesToScroll; 1228 } 1229 1230 }; 1231 1232 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 1233 1234 var _ = this; 1235 1236 _.changeSlide({ 1237 data: { 1238 message: 'index', 1239 index: parseInt(slide) 1240 } 1241 }, dontAnimate); 1242 1243 }; 1244 1245 Slick.prototype.init = function(creation) { 1246 1247 var _ = this; 1248 1249 if (!$(_.$slider).hasClass('slick-initialized')) { 1250 1251 $(_.$slider).addClass('slick-initialized'); 1252 1253 _.buildRows(); 1254 _.buildOut(); 1255 _.setProps(); 1256 _.startLoad(); 1257 _.loadSlider(); 1258 _.initializeEvents(); 1259 _.updateArrows(); 1260 _.updateDots(); 1261 _.checkResponsive(true); 1262 _.focusHandler(); 1263 1264 } 1265 1266 if (creation) { 1267 _.$slider.trigger('init', [_]); 1268 } 1269 1270 if (_.options.accessibility === true) { 1271 _.initADA(); 1272 } 1273 1274 if ( _.options.autoplay ) { 1275 1276 _.paused = false; 1277 _.autoPlay(); 1278 1279 } 1280 1281 }; 1282 1283 Slick.prototype.initADA = function() { 1284 var _ = this
1284; 1285 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 1286 'aria-hidden': 'true', 1287 'tabindex': '-1' 1288 }).find('a, input, button, select').attr({ 1289 'tabindex': '-1' 1290 }); 1291 1292 _.$slideTrack.attr('role', 'listbox'); 1293 1294 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 1295 $(this).attr('role', 'option'); 1296 1297 //Evenly distribute aria-describedby tags through available dots. 1298 var describedBySlideId = _.options.centerMode ? i : Math.floor(i / _.options.slidesToShow); 1299 1300 if (_.options.dots === true) { 1301 $(this).attr('aria-describedby', 'slick-slide' + _.instanceUid + describedBySlideId + ''); 1302 } 1303 }); 1304 1305 if (_.$dots !== null) { 1306 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 1307 $(this).attr({ 1308 'role': 'presentation', 1309 'aria-selected': 'false', 1310 'aria-controls': 'navigation' + _.instanceUid + i + '', 1311 'id': 'slick-slide' + _.instanceUid + i + '' 1312 }); 1313 }) 1314 .first().attr('aria-selected', 'true').end() 1315 .find('button').attr('role', 'button').end() 1316 .closest('div').attr('role', 'toolbar'); 1317 } 1318 _.activateADA(); 1319 1320 }; 1321 1322 Slick.prototype.initArrowEvents = function() { 1323 1324 var _ = this; 1325 1326 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1327 _.$prevArrow 1328 .off('click.slick') 1329 .on('click.slick', { 1330 message: 'previous' 1331 }, _.changeSlide); 1332 _.$nextArrow 1333 .off('click.slick') 1334 .on('click.slick', { 1335 message: 'next' 1336 }, _.changeSlide); 1337 } 1338 1339 }; 1340 1341 Slick.prototype.initDotEvents = function() { 1342 1343 var _ = this; 1344 1345 if (_.options.dots === true) { 1346 $('li', _.$dots).on('click.slick', { 1347 message: 'index' 1348 }, _.changeSlide); 1349 } 1350 1351 if ( _.options.dots === true && _.options.pauseOnDotsHover === true ) { 1352 1353 $('li', _.$dots) 1354 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 1355 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 1356 1357 } 1358 1359 }; 1360 1361 Slick.prototype.initSlideEvents = function() { 1362 1363 var _ = this; 1364 1365 if ( _.options.pauseOnHover ) { 1366 1367 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 1368 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 1369 1370 } 1371 1372 }; 1373 1374 Slick.prototype.initializeEvents = function() { 1375 1376 var _ = this; 1377 1378 _.initArrowEvents(); 1379 1380 _.initDotEvents(); 1381 _.initSlideEvents(); 1382 1383 _.$list.on('touchstart.slick mousedown.slick', { 1384 action: 'start' 1385 }, _.swipeHandler); 1386 _.$list.on('touchmove.slick mousemove.slick', { 1387 action: 'move' 1388 }, _.swipeHandler); 1389 _.$list.on('touchend.slick mouseup.slick', { 1390 action: 'end' 1391 }, _.swipeHandler);
vendor: 7,649 bytes, lines 1392-1651
1392 _.$list.on('touchcancel.slick mouseleave.slick', { 1393 action: 'end' 1394 }, _.swipeHandler); 1395 1396 _.$list.on('click.slick', _.clickHandler); 1397 1398 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 1399 1400 if (_.options.accessibility === true) { 1401 _.$list.on('keydown.slick', _.keyHandler); 1402 } 1403 1404 if (_.options.focusOnSelect === true) { 1405 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1406 } 1407 1408 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 1409 1410 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 1411 1412 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 1413 1414 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 1415 $(_.setPosition); 1416 1417 }; 1418 1419 Slick.prototype.initUI = function() { 1420 1421 var _ = this; 1422 1423 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1424 1425 _.$prevArrow.show(); 1426 _.$nextArrow.show(); 1427 1428 } 1429 1430 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1431 1432 _.$dots.show(); 1433 1434 } 1435 1436 }; 1437 1438 Slick.prototype.keyHandler = function(event) { 1439 1440 var _ = this; 1441 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 1442 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 1443 if (event.keyCode === 37 && _.options.accessibility === true) { 1444 _.changeSlide({ 1445 data: { 1446 message: _.options.rtl === true ? 'next' : 'previous' 1447 } 1448 }); 1449 } else if (event.keyCode === 39 && _.options.accessibility === true) { 1450 _.changeSlide({ 1451 data: { 1452 message: _.options.rtl === true ? 'previous' : 'next' 1453 } 1454 }); 1455 } 1456 } 1457 1458 }; 1459 1460 Slick.prototype.lazyLoad = function() { 1461 1462 var _ = this, 1463 loadRange, cloneRange, rangeStart, rangeEnd; 1464 1465 function loadImages(imagesScope) { 1466 1467 $('img[data-lazy]', imagesScope).each(function() { 1468 1469 var image = $(this), 1470 imageSource = $(this).attr('data-lazy'), 1471 imageSrcSet = $(this).attr('data-srcset'), 1472 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 1473 imageToLoad = document.createElement('img'); 1474 1475 imageToLoad.onload = function() { 1476 1477 image 1478 .animate({ opacity: 0 }, 100, function() { 1479 1480 if (imageSrcSet) { 1481 image 1482 .attr('srcset', imageSrcSet ); 1483 1484 if (imageSizes) { 1485 image 1486 .attr('sizes', imageSizes ); 1487 } 1488 } 1489 1490 image 1491 .attr('src', imageSource) 1492 .animate({ opacity: 1 }, 200, function() { 1493 image 1494 .removeAttr('data-lazy data-srcset data-sizes') 1495 .removeClass('slick-loading'); 1496 }); 1497 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 1498 }); 1499 1500 }; 1501 1502 imageToLoad.onerror = function() { 1503 1504 image 1505 .removeAttr( 'data-lazy' ) 1506 .removeClass( 'slick-loading' ) 1507 .addClass( 'slick-lazyload-error' ); 1508 1509 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 1510 1511 }; 1512 1513 imageToLoad.src = imageSource; 1514 1515 }); 1516 1517 } 1518 1519 if (_.options.centerMode === true) { 1520 if (_.options.infinite === true) { 1521 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 1522 rangeEnd = rangeStart + _.options.slidesToShow + 2; 1523 } else { 1524 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 1525 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 1526 } 1527 } else { 1528 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 1529 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 1530 if (_.options.fade === true) { 1531 if (rangeStart > 0) rangeStart--; 1532 if (rangeEnd <= _.slideCount) rangeEnd++; 1533 } 1534 } 1535 1536 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 1537 1538 if (_.options.lazyLoad === 'anticipated') { 1539 var prevSlide = rangeStart - 1, 1540 nextSlide = rangeEnd, 1541 $slides = _.$slider.find('.slick-slide'); 1542 1543 for (var i = 0; i < _.options.slidesToScroll; i++) { 1544 if (prevSlide < 0) prevSlide = _.slideCount - 1; 1545 loadRange = loadRange.add($slides.eq(prevSlide)); 1546 loadRange = loadRange.add($slides.eq(nextSlide)); 1547 prevSlide--; 1548 nextSlide++; 1549 } 1550 } 1551 1552 loadImages(loadRange); 1553 1554 if (_.slideCount <= _.options.slidesToShow) { 1555 cloneRange = _.$slider.find('.slick-slide'); 1556 loadImages(cloneRange); 1557 } else 1558 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 1559 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 1560 loadImages(cloneRange); 1561 } else if (_.currentSlide === 0) { 1562 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 1563 loadImages(cloneRange); 1564 } 1565 1566 }; 1567 1568 Slick.prototype.loadSlider = function() { 1569 1570 var _ = this; 1571 1572 _.setPosition(); 1573 1574 _.$slideTrack.css({ 1575 opacity: 1 1576 }); 1577 1578 _.$slider.removeClass('slick-loading'); 1579 1580 _.initUI(); 1581 1582 if (_.options.lazyLoad === 'progressive') { 1583 _.progressiveLazyLoad(); 1584 } 1585 1586 }; 1587 1588 Slick.prototype.next = Slick.prototype.slickNext = function() { 1589 1590 var _ = this; 1591 1592 _.changeSlide({ 1593 data: { 1594 message: 'next' 1595 } 1596 }); 1597 1598 }; 1599 1600 Slick.prototype.orientationChange = function() { 1601 1602 var _ = this; 1603 1604 _.checkResponsive(); 1605 _.setPosition(); 1606 1607 }; 1608 1609 Slick.prototype.pause = Slick.prototype.slickPause = function() { 1610 1611 var _ = this; 1612 1613 _.autoPlayClear(); 1614 _.paused = true; 1615 1616 }; 1617 1618 Slick.prototype.play = Slick.prototype.slickPlay = function() { 1619 1620 var _ = this; 1621 1622 _.autoPlay(); 1623 _.options.autoplay = true; 1624 _.paused = false; 1625 _.focussed = false; 1626 _.interrupted = false; 1627 1628 }; 1629 1630 Slick.prototype.postSlide = function(index) { 1631 1632 var _ = this; 1633 1634 if( !_.unslicked ) { 1635 1636 _.$slider.trigger('afterChange', [_, index]); 1637 1638 _.animating = false; 1639 1640 if (_.slideCount > _.options.slidesToShow) { 1641 _.setPosition(); 1642 } 1643 1644 _.swipeLeft = null; 1645 1646 if ( _.options.autoplay ) { 1647 _.autoPlay(); 1648 } 1649 1650 if (_.options.accessibility === true) { 1651 _.initADA();
vendor: 16,676 bytes, lines 1651-2246
1651 1652 } 1653 1654 } 1655 1656 }; 1657 1658 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 1659 1660 var _ = this; 1661 1662 _.changeSlide({ 1663 data: { 1664 message: 'previous' 1665 } 1666 }); 1667 1668 }; 1669 1670 Slick.prototype.preventDefault = function(event) { 1671 1672 event.preventDefault(); 1673 1674 }; 1675 1676 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 1677 1678 tryCount = tryCount || 1; 1679 1680 var _ = this, 1681 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 1682 image, 1683 imageSource, 1684 imageSrcSet, 1685 imageSizes, 1686 imageToLoad; 1687 1688 if ( $imgsToLoad.length ) { 1689 1690 image = $imgsToLoad.first(); 1691 imageSource = image.attr('data-lazy'); 1692 imageSrcSet = image.attr('data-srcset'); 1693 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 1694 imageToLoad = document.createElement('img'); 1695 1696 imageToLoad.onload = function() { 1697 1698 if (imageSrcSet) { 1699 image 1700 .attr('srcset', imageSrcSet ); 1701 1702 if (imageSizes) { 1703 image 1704 .attr('sizes', imageSizes ); 1705 } 1706 } 1707 1708 image 1709 .attr( 'src', imageSource ) 1710 .removeAttr('data-lazy data-srcset data-sizes') 1711 .removeClass('slick-loading'); 1712 1713 if ( _.options.adaptiveHeight === true ) { 1714 _.setPosition(); 1715 } 1716 1717 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 1718 _.progressiveLazyLoad(); 1719 1720 }; 1721 1722 imageToLoad.onerror = function() { 1723 1724 if ( tryCount < 3 ) { 1725 1726 /** 1727 * try to load the image 3 times, 1728 * leave a slight delay so we don't get 1729 * servers blocking the request. 1730 */ 1731 setTimeout( function() { 1732 _.progressiveLazyLoad( tryCount + 1 ); 1733 }, 500 ); 1734 1735 } else { 1736 1737 image 1738 .removeAttr( 'data-lazy' ) 1739 .removeClass( 'slick-loading' ) 1740 .addClass( 'slick-lazyload-error' ); 1741 1742 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 1743 1744 _.progressiveLazyLoad(); 1745 1746 } 1747 1748 }; 1749 1750 imageToLoad.src = imageSource; 1751 1752 } else { 1753 1754 _.$slider.trigger('allImagesLoaded', [ _ ]); 1755 1756 } 1757 1758 }; 1759 1760 Slick.prototype.refresh = function( initializing ) { 1761 1762 var _ = this, currentSlide, lastVisibleIndex; 1763 1764 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 1765 1766 // in non-infinite sliders, we don't want to go past the 1767 // last visible index. 1768 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 1769 _.currentSlide = lastVisibleIndex; 1770 } 1771 1772 // if less slides than to show, go to start. 1773 if ( _.slideCount <= _.options.slidesToShow ) { 1774 _.currentSlide = 0; 1775 1776 } 1777 1778 currentSlide = _.currentSlide; 1779 1780 _.destroy(true); 1781 1782 $.extend(_, _.initials, { currentSlide: currentSlide }); 1783 1784 _.init(); 1785 1786 if( !initializing ) { 1787 1788 _.changeSlide({ 1789 data: { 1790 message: 'index', 1791 index: currentSlide 1792 } 1793 }, false); 1794 1795 } 1796 1797 }; 1798 1799 Slick.prototype.registerBreakpoints = function() { 1800 1801 var _ = this, breakpoint, currentBreakpoint, l, 1802 responsiveSettings = _.options.responsive || null; 1803 1804 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 1805 1806 _.respondTo = _.options.respondTo || 'window'; 1807 1808 for ( breakpoint in responsiveSettings ) { 1809 1810 l = _.breakpoints.length-1; 1811 1812 if (responsiveSettings.hasOwnProperty(breakpoint)) { 1813 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 1814 1815 // loop through the breakpoints and cut out any existing 1816 // ones with the same breakpoint number, we don't want dupes. 1817 while( l >= 0 ) { 1818 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 1819 _.breakpoints.splice(l,1); 1820 } 1821 l--; 1822 } 1823 1824 _.breakpoints.push(currentBreakpoint); 1825 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 1826 1827 } 1828 1829 } 1830 1831 _.breakpoints.sort(function(a, b) { 1832 return ( _.options.mobileFirst ) ? a-b : b-a; 1833 }); 1834 1835 } 1836 1837 }; 1838 1839 Slick.prototype.reinit = function() { 1840 1841 var _ = this; 1842 1843 _.$slides = 1844 _.$slideTrack 1845 .children(_.options.slide) 1846 .addClass('slick-slide'); 1847 1848 _.slideCount = _.$slides.length; 1849 1850 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 1851 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 1852 } 1853 1854 if (_.slideCount <= _.options.slidesToShow) { 1855 _.currentSlide = 0; 1856 } 1857 1858 _.registerBreakpoints(); 1859 1860 _.setProps(); 1861 _.setupInfinite(); 1862 _.buildArrows(); 1863 _.updateArrows(); 1864 _.initArrowEvents(); 1865 _.buildDots(); 1866 _.updateDots(); 1867 _.initDotEvents(); 1868 _.cleanUpSlideEvents(); 1869 _.initSlideEvents(); 1870 1871 _.checkResponsive(false, true); 1872 1873 if (_.options.focusOnSelect === true) { 1874 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1875 } 1876 1877 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 1878 1879 _.setPosition(); 1880 _.focusHandler(); 1881 1882 _.paused = !_.options.autoplay; 1883 _.autoPlay(); 1884 1885 _.$slider.trigger('reInit', [_]); 1886 1887 }; 1888 1889 Slick.prototype.resize = function() { 1890 1891 var _ = this; 1892 1893 if ($(window).width() !== _.windowWidth) { 1894 clearTimeout(_.windowDelay); 1895 _.windowDelay = window.setTimeout(function() { 1896 _.windowWidth = $(window).width(); 1897 _.checkResponsive(); 1898 if( !_.unslicked ) { _.setPosition(); } 1899 }, 50); 1900 } 1901 }; 1902 1903 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 1904 1905 var _ = this; 1906 1907 if (typeof(index) === 'boolean') { 1908 removeBefore = index; 1909 index = removeBefore === true ? 0 : _.slideCount - 1; 1910 } else { 1911 index = removeBefore === true ? --index : index; 1912 } 1913 1914 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 1915 return false; 1916 } 1917 1918 _.unload(); 1919 1920 if (removeAll === true) { 1921 _.$slideTrack.children().remove(); 1922 } else { 1923 _.$slideTrack.children(this.options.slide).eq(index).remove(); 1924 } 1925 1926 _.$slides = _.$slideTrack.children(this.options.slide); 1927 1928 _.$slideTrack.children(this.options.slide).detach(); 1929 1930 _.$slideTrack.append(_.$slides); 1931 1932 _.$slidesCache = _.$slides; 1933 1934 _.reinit(); 1935 1936 }; 1937 1938 Slick.prototype.setCSS = function(position) { 1939 1940 var _ = this, 1941 positionProps = {}, 1942 x, y; 1943 1944 if (_.options.rtl === true) { 1945 position = -position; 1946 } 1947 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 1948 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 1949 1950 positionProps[_.positionProp] = position; 1951 1952 if (_.transformsEnabled === false) { 1953 _.$slideTrack.css(positionProps); 1954 } else { 1955 positionProps = {}; 1956 if (_.cssTransitions === false) { 1957 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 1958 _.$slideTrack.css(positionProps); 1959 } else { 1960 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 1961 _.$slideTrack.css(positionProps); 1962 } 1963 } 1964 1965 }; 1966 1967 Slick.prototype.setDimensions = function() { 1968 1969 var _ = this; 1970 1971 if (_.options.vertical === false) { 1972 if (_.options.centerMode === true) { 1973 _.$list.css({ 1974 padding: ('0px ' + _.options.centerPadding) 1975 }); 1976 } 1977 } else { 1978 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 1979 if (_.options.centerMode === true) { 1980 _.$list.css({ 1981 padding: (_.options.centerPadding + ' 0px') 1982 }); 1983 } 1984 } 1985 1986 _.listWidth = _.$list.width(); 1987 _.listHeight = _.$list.height(); 1988 1989 1990 if (_.options.vertical === false && _.options.variableWidth === false) { 1991 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 1992 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 1993 1994 } else if (_.options.variableWidth === true) { 1995 _.$slideTrack.width(5000 * _.slideCount); 1996 } else { 1997 _.slideWidth = Math.ceil(_.listWidth); 1998 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 1999 } 2000 2001 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 2002 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 2003 2004 }; 2005 2006 Slick.prototype.setFade = function() { 2007 2008 var _ = this, 2009 targetLeft; 2010 2011 _.$slides.each(function(index, element) { 2012 targetLeft = (_.slideWidth * index) * -1; 2013 if (_.options.rtl === true) { 2014 $(element).css({ 2015 position: 'relative', 2016 right: targetLeft, 2017 top: 0, 2018 zIndex: _.options.zIndex - 2, 2019 opacity: 0 2020 }); 2021 } else { 2022 $(element).css({ 2023 position: 'relative', 2024 left: targetLeft, 2025 top: 0, 2026 zIndex: _.options.zIndex - 2, 2027 opacity: 0 2028 }); 2029 } 2030 }); 2031 2032 _.$slides.eq(_.currentSlide).css({ 2033 zIndex: _.options.zIndex - 1, 2034 opacity: 1 2035 }); 2036 2037 }; 2038 2039 Slick.prototype.setHeight = function() { 2040 2041 var _ = this; 2042 2043 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 2044 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 2045 _.$list.css('height', targetHeight); 2046 } 2047 2048 }; 2049 2050 Slick.prototype.setOption = 2051 Slick.prototype.slickSetOption = function() { 2052 2053 /** 2054 * accepts arguments in format of: 2055 * 2056 * - for changing a single option's value: 2057 * .slick("setOption", option, value, refresh ) 2058 * 2059 * - for changing a set of responsive options: 2060 * .slick("setOption", 'responsive', [{}, ...], refresh ) 2061 * 2062 * - for updating multiple values at once (not responsive) 2063 * .slick("setOption", { 'option': value, ... }, refresh ) 2064 */ 2065 2066 var _ = this, l, item, option, value, refresh = false, type; 2067 2068 if( $.type( arguments[0] ) === 'object' ) { 2069 2070 option = arguments[0]; 2071 refresh = arguments[1]; 2072 type = 'multiple'; 2073 2074 } else if ( $.type( arguments[0] ) === 'string' ) { 2075 2076 option = arguments[0]; 2077 value = arguments[1]; 2078 refresh = arguments[2]; 2079 2080 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 2081 2082 type = 'responsive'; 2083 2084 } else if ( typeof arguments[1] !== 'undefined' ) { 2085 2086 type = 'single'; 2087 2088 } 2089 2090 } 2091 2092 if ( type === 'single' ) { 2093 2094 _.options[option] = value; 2095 2096 2097 } else if ( type === 'multiple' ) { 2098 2099 $.each( option , function( opt, val ) { 2100 2101 _.options[opt] = val; 2102 2103 }); 2104 2105 2106 } else if ( type === 'responsive' ) { 2107 2108 for ( item in value ) { 2109 2110 if( $.type( _.options.responsive ) !== 'array' ) { 2111 2112 _.options.responsive = [ value[item] ]; 2113 2114 } else { 2115 2116 l = _.options.responsive.length-1; 2117 2118 // loop through the responsive object and splice out duplicates. 2119 while( l >= 0 ) { 2120 2121 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 2122 2123 _.options.responsive.splice(l,1); 2124 2125 } 2126 2127 l--; 2128 2129 } 2130 2131 _.options.responsive.push( value[item] ); 2132 2133 } 2134 2135 } 2136 2137 } 2138 2139 if ( refresh ) { 2140 2141 _.unload(); 2142 _.reinit(); 2143 2144 } 2145 2146 }; 2147 2148 Slick.prototype.setPosition = function() { 2149 2150 var _ = this; 2151 2152 _.setDimensions(); 2153 2154 _.setHeight(); 2155 2156 if (_.options.fade === false) { 2157 _.setCSS(_.getLeft(_.currentSlide)); 2158 } else { 2159 _.setFade(); 2160 } 2161 2162 _.$slider.trigger('setPosition', [_]); 2163 2164 }; 2165 2166 Slick.prototype.setProps = function() { 2167 2168 var _ = this, 2169 bodyStyle = document.body.style; 2170 2171 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 2172 2173 if (_.positionProp === 'top') { 2174 _.$slider.addClass('slick-vertical'); 2175 } else { 2176 _.$slider.removeClass('slick-vertical'); 2177 } 2178 2179 if (bodyStyle.WebkitTransition !== undefined || 2180 bodyStyle.MozTransition !== undefined || 2181 bodyStyle.msTransition !== undefined) { 2182 if (_.options.useCSS === true) { 2183 _.cssTransitions = true; 2184 } 2185 } 2186 2187 if ( _.options.fade ) { 2188 if ( typeof _.options.zIndex === 'number' ) { 2189 if( _.options.zIndex < 3 ) { 2190 _.options.zIndex = 3; 2191 } 2192 } else { 2193 _.options.zIndex = _.defaults.zIndex; 2194 } 2195 } 2196 2197 if (bodyStyle.OTransform !== undefined) { 2198 _.animType = 'OTransform'; 2199 _.transformType = '-o-transform'; 2200 _.transitionType = 'OTransition'; 2201 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 2202 } 2203 if (bodyStyle.MozTransform !== undefined) { 2204 _.animType = 'MozTransform'; 2205 _.transformType = '-moz-transform'; 2206 _.transitionType = 'MozTransition'; 2207 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 2208 } 2209 if (bodyStyle.webkitTransform !== undefined) { 2210 _.animType = 'webkitTransform'; 2211 _.transformType = '-webkit-transform'; 2212 _.transitionType = 'webkitTransition'; 2213 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 2214 } 2215 if (bodyStyle.msTransform !== undefined) { 2216 _.animType = 'msTransform'; 2217 _.transformType = '-ms-transform'; 2218 _.transitionType = 'msTransition'; 2219 if (bodyStyle.msTransform === undefined) _.animType = false; 2220 } 2221 if (bodyStyle.transform !== undefined && _.animType !== false) { 2222 _.animType = 'transform'; 2223 _.transformType = 'transform'; 2224 _.transitionType = 'transition'; 2225 } 2226 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 2227 }; 2228 2229 2230 Slick.prototype.setSlideClasses = function(index) { 2231 2232 var _ = this, 2233 centerOffset, allSlides, indexOffset, remainder; 2234 2235 allSlides = _.$slider 2236 .find('.slick-slide') 2237 .removeClass('slick-active slick-center slick-current') 2238 .attr('aria-hidden', 'true'); 2239 2240 _.$slides 2241 .eq(index) 2242 .addClass('slick-current'); 2243 2244 if (_.options.centerMode === true) { 2245 2246
vendor: 19,978 bytes, lines 2246-2951
2246centerOffset = Math.floor(_.options.slidesToShow / 2); 2247 2248 if (_.options.infinite === true) { 2249 2250 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 2251 2252 _.$slides 2253 .slice(index - centerOffset, index + centerOffset + 1) 2254 .addClass('slick-active') 2255 .attr('aria-hidden', 'false'); 2256 2257 } else { 2258 2259 indexOffset = _.options.slidesToShow + index; 2260 allSlides 2261 .slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2) 2262 .addClass('slick-active') 2263 .attr('aria-hidden', 'false'); 2264 2265 } 2266 2267 if (index === 0) { 2268 2269 allSlides 2270 .eq(allSlides.length - 1 - _.options.slidesToShow) 2271 .addClass('slick-center'); 2272 2273 } else if (index === _.slideCount - 1) { 2274 2275 allSlides 2276 .eq(_.options.slidesToShow) 2277 .addClass('slick-center'); 2278 2279 } 2280 2281 } 2282 2283 _.$slides 2284 .eq(index) 2285 .addClass('slick-center'); 2286 2287 } else { 2288 2289 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 2290 2291 _.$slides 2292 .slice(index, index + _.options.slidesToShow) 2293 .addClass('slick-active') 2294 .attr('aria-hidden', 'false'); 2295 2296 } else if (allSlides.length <= _.options.slidesToShow) { 2297 2298 allSlides 2299 .addClass('slick-active') 2300 .attr('aria-hidden', 'false'); 2301 2302 } else { 2303 2304 remainder = _.slideCount % _.options.slidesToShow; 2305 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 2306 2307 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 2308 2309 allSlides 2310 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 2311 .addClass('slick-active') 2312 .attr('aria-hidden', 'false'); 2313 2314 } else { 2315 2316 allSlides 2317 .slice(indexOffset, indexOffset + _.options.slidesToShow) 2318 .addClass('slick-active') 2319 .attr('aria-hidden', 'false'); 2320 2321 } 2322 2323 } 2324 2325 } 2326 2327 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 2328 _.lazyLoad(); 2329 } 2330 }; 2331 2332 Slick.prototype.setupInfinite = function() { 2333 2334 var _ = this, 2335 i, slideIndex, infiniteCount; 2336 2337 if (_.options.fade === true) { 2338 _.options.centerMode = false; 2339 } 2340 2341 if (_.options.infinite === true && _.options.fade === false) { 2342 2343 slideIndex = null; 2344 2345 if (_.slideCount > _.options.slidesToShow) { 2346 2347 if (_.options.centerMode === true) { 2348 infiniteCount = _.options.slidesToShow + 1; 2349 } else { 2350 infiniteCount = _.options.slidesToShow; 2351 } 2352 2353 for (i = _.slideCount; i > (_.slideCount - 2354 infiniteCount); i -= 1) { 2355 slideIndex = i - 1; 2356 $(_.$slides[slideIndex]).clone(true).attr('id', '') 2357 .attr('data-slick-index', slideIndex - _.slideCount) 2358 .prependTo(_.$slideTrack).addClass('slick-cloned'); 2359 } 2360 for (i = 0; i < infiniteCount; i += 1) { 2361 slideIndex = i; 2362 $(_.$slides[slideIndex]).clone(true).attr('id', '') 2363 .attr('data-slick-index', slideIndex + _.slideCount) 2364 .appendTo(_.$slideTrack).addClass('slick-cloned'); 2365 } 2366 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 2367 $(this).attr('id', ''); 2368 }); 2369 2370 } 2371 2372 } 2373 2374 }; 2375 2376 Slick.prototype.interrupt = function( toggle ) { 2377 2378 var _ = this; 2379 2380 if( !toggle ) { 2381 _.autoPlay(); 2382 } 2383 _.interrupted = toggle; 2384 2385 }; 2386 2387 Slick.prototype.selectHandler = function(event) { 2388 2389 var _ = this; 2390 2391 var targetElement = 2392 $(event.target).is('.slick-slide') ? 2393 $(event.target) : 2394 $(event.target).parents('.slick-slide'); 2395 2396 var index = parseInt(targetElement.attr('data-slick-index')); 2397 2398 if (!index) index = 0; 2399 2400 if (_.slideCount <= _.options.slidesToShow) { 2401 2402 _.slideHandler(index, false, true); 2403 return; 2404 2405 } 2406 2407 _.slideHandler(index); 2408 2409 }; 2410 2411 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 2412 2413 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 2414 _ = this, navTarget; 2415 2416 sync = sync || false; 2417 2418 if (_.animating === true && _.options.waitForAnimate === true) { 2419 return; 2420 } 2421 2422 if (_.options.fade === true && _.currentSlide === index) { 2423 return; 2424 } 2425 2426 if (sync === false) { 2427 _.asNavFor(index); 2428 } 2429 2430 targetSlide = index; 2431 targetLeft = _.getLeft(targetSlide); 2432 slideLeft = _.getLeft(_.currentSlide); 2433 2434 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 2435 2436 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 2437 if (_.options.fade === false) { 2438 targetSlide = _.currentSlide; 2439 if (dontAnimate !== true) { 2440 _.animateSlide(slideLeft, function() { 2441 _.postSlide(targetSlide); 2442 }); 2443 } else { 2444 _.postSlide(targetSlide); 2445 } 2446 } 2447 return; 2448 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 2449 if (_.options.fade === false) { 2450 targetSlide = _.currentSlide; 2451 if (dontAnimate !== true) { 2452 _.animateSlide(slideLeft, function() { 2453 _.postSlide(targetSlide); 2454 }); 2455 } else { 2456 _.postSlide(targetSlide); 2457 } 2458 } 2459 return; 2460 } 2461 2462 if ( _.options.autoplay ) { 2463 clearInterval(_.autoPlayTimer); 2464 } 2465 2466 if (targetSlide < 0) { 2467 if (_.slideCount % _.options.slidesToScroll !== 0) { 2468 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 2469 } else { 2470 animSlide = _.slideCount + targetSlide; 2471 } 2472 } else if (targetSlide >= _.slideCount) { 2473 if (_.slideCount % _.options.slidesToScroll !== 0) { 2474 animSlide = 0; 2475 } else { 2476 animSlide = targetSlide - _.slideCount; 2477 } 2478 } else { 2479 animSlide = targetSlide; 2480 } 2481 2482 _.animating = true; 2483 2484 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 2485 2486 oldSlide = _.currentSlide; 2487 _.currentSlide = animSlide; 2488 2489 _.setSlideClasses(_.currentSlide); 2490 2491 if ( _.options.asNavFor ) { 2492 2493 navTarget = _.getNavTarget(); 2494 navTarget = navTarget.slick('getSlick'); 2495 2496 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 2497 navTarget.setSlideClasses(_.currentSlide); 2498 } 2499 2500 } 2501 2502 _.updateDots(); 2503 _.updateArrows(); 2504 2505 if (_.options.fade === true) { 2506 if (dontAnimate !== true) { 2507 2508 _.fadeSlideOut(oldSlide); 2509 2510 _.fadeSlide(animSlide, function() { 2511 _.postSlide(animSlide); 2512 }); 2513 2514 } else { 2515 _.postSlide(animSlide); 2516 } 2517 _.animateHeight(); 2518 return; 2519 } 2520 2521 if (dontAnimate !== true) { 2522 _.animateSlide(targetLeft, function() { 2523 _.postSlide(animSlide); 2524 }); 2525 } else { 2526 _.postSlide(animSlide); 2527 } 2528 2529 }; 2530 2531 Slick.prototype.startLoad = function() { 2532 2533 var _ = this; 2534 2535 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 2536 2537 _.$prevArrow.hide(); 2538 _.$nextArrow.hide(); 2539 2540 } 2541 2542 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 2543 2544 _.$dots.hide(); 2545 2546 } 2547 2548 _.$slider.addClass('slick-loading'); 2549 2550 }; 2551 2552 Slick.prototype.swipeDirection = function() { 2553 2554 var xDist, yDist, r, swipeAngle, _ = this; 2555 2556 xDist = _.touchObject.startX - _.touchObject.curX; 2557 yDist = _.touchObject.startY - _.touchObject.curY; 2558 r = Math.atan2(yDist, xDist); 2559 2560 swipeAngle = Math.round(r * 180 / Math.PI); 2561 if (swipeAngle < 0) { 2562 swipeAngle = 360 - Math.abs(swipeAngle); 2563 } 2564 2565 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 2566 return (_.options.rtl === false ? 'left' : 'right'); 2567 } 2568 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 2569 return (_.options.rtl === false ? 'left' : 'right'); 2570 } 2571 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 2572 return (_.options.rtl === false ? 'right' : 'left'); 2573 } 2574 if (_.options.verticalSwiping === true) { 2575 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 2576 return 'down'; 2577 } else { 2578 return 'up'; 2579 } 2580 } 2581 2582 return 'vertical'; 2583 2584 }; 2585 2586 Slick.prototype.swipeEnd = function(event) { 2587 2588 var _ = this, 2589 slideCount, 2590 direction; 2591 2592 _.dragging = false; 2593 _.swiping = false; 2594 2595 if (_.scrolling) { 2596 _.scrolling = false; 2597 return false; 2598 } 2599 2600 _.interrupted = false; 2601 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 2602 2603 if ( _.touchObject.curX === undefined ) { 2604 return false; 2605 } 2606 2607 if ( _.touchObject.edgeHit === true ) { 2608 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 2609 } 2610 2611 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 2612 2613 direction = _.swipeDirection(); 2614 2615 switch ( direction ) { 2616 2617 case 'left': 2618 case 'down': 2619 2620 slideCount = 2621 _.options.swipeToSlide ? 2622 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 2623 _.currentSlide + _.getSlideCount(); 2624 2625 _.currentDirection = 0; 2626 2627 break; 2628 2629 case 'right': 2630 case 'up': 2631 2632 slideCount = 2633 _.options.swipeToSlide ? 2634 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 2635 _.currentSlide - _.getSlideCount(); 2636 2637 _.currentDirection = 1; 2638 2639 break; 2640 2641 default: 2642 2643 2644 } 2645 2646 if( direction != 'vertical' ) { 2647 2648 _.slideHandler( slideCount ); 2649 _.touchObject = {}; 2650 _.$slider.trigger('swipe', [_, direction ]); 2651 2652 } 2653 2654 } else { 2655 2656 if ( _.touchObject.startX !== _.touchObject.curX ) { 2657 2658 _.slideHandler( _.currentSlide ); 2659 _.touchObject = {}; 2660 2661 } 2662 2663 } 2664 2665 }; 2666 2667 Slick.prototype.swipeHandler = function(event) { 2668 2669 var _ = this; 2670 2671 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 2672 return; 2673 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 2674 return; 2675 } 2676 2677 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 2678 event.originalEvent.touches.length : 1; 2679 2680 _.touchObject.minSwipe = _.listWidth / _.options 2681 .touchThreshold; 2682 2683 if (_.options.verticalSwiping === true) { 2684 _.touchObject.minSwipe = _.listHeight / _.options 2685 .touchThreshold; 2686 } 2687 2688 switch (event.data.action) { 2689 2690 case 'start': 2691 _.swipeStart(event); 2692 break; 2693 2694 case 'move': 2695 _.swipeMove(event); 2696 break; 2697 2698 case 'end': 2699 _.swipeEnd(event); 2700 break; 2701 2702 } 2703 2704 }; 2705 2706 Slick.prototype.swipeMove = function(event) { 2707 2708 var _ = this, 2709 edgeWasHit = false, 2710 curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength; 2711 2712 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 2713 2714 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 2715 return false; 2716 } 2717 2718 curLeft = _.getLeft(_.currentSlide); 2719 2720 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 2721 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 2722 2723 _.touchObject.swipeLength = Math.round(Math.sqrt( 2724 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 2725 2726 verticalSwipeLength = Math.round(Math.sqrt( 2727 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 2728 2729 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 2730 _.scrolling = true; 2731 return false; 2732 } 2733 2734 if (_.options.verticalSwiping === true) { 2735 _.touchObject.swipeLength = verticalSwipeLength; 2736 } 2737 2738 swipeDirection = _.swipeDirection(); 2739 2740 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 2741 _.swiping = true; 2742 event.preventDefault(); 2743 } 2744 2745 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 2746 if (_.options.verticalSwiping === true) { 2747 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 2748 } 2749 2750 2751 swipeLength = _.touchObject.swipeLength; 2752 2753 _.touchObject.edgeHit = false; 2754 2755 if (_.options.infinite === false) { 2756 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 2757 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 2758 _.touchObject.edgeHit = true; 2759 } 2760 } 2761 2762 if (_.options.vertical === false) { 2763 _.swipeLeft = curLeft + swipeLength * positionOffset; 2764 } else { 2765 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 2766 } 2767 if (_.options.verticalSwiping === true) { 2768 _.swipeLeft = curLeft + swipeLength * positionOffset; 2769 } 2770 2771 if (_.options.fade === true || _.options.touchMove === false) { 2772 return false; 2773 } 2774 2775 if (_.animating === true) { 2776 _.swipeLeft = null; 2777 return false; 2778 } 2779 2780 _.setCSS(_.swipeLeft); 2781 2782 }; 2783 2784 Slick.prototype.swipeStart = function(event) { 2785 2786 var _ = this, 2787 touches; 2788 2789 _.interrupted = true; 2790 2791 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 2792 _.touchObject = {}; 2793 return false; 2794 } 2795 2796 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 2797 touches = event.originalEvent.touches[0]; 2798 } 2799 2800 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 2801 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 2802 2803 _.dragging = true; 2804 2805 }; 2806 2807 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 2808 2809 var _ = this; 2810 2811 if (_.$slidesCache !== null) { 2812 2813 _.unload(); 2814 2815 _.$slideTrack.children(this.options.slide).detach(); 2816 2817 _.$slidesCache.appendTo(_.$slideTrack); 2818 2819 _.reinit(); 2820 2821 } 2822 2823 }; 2824 2825 Slick.prototype.unload = function() { 2826 2827 var _ = this; 2828 2829 $('.slick-cloned', _.$slider).remove(); 2830 2831 if (_.$dots) { 2832 _.$dots.remove(); 2833 } 2834 2835 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 2836 _.$prevArrow.remove(); 2837 } 2838 2839 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 2840 _.$nextArrow.remove(); 2841 } 2842 2843 _.$slides 2844 .removeClass('slick-slide slick-active slick-visible slick-current') 2845 .attr('aria-hidden', 'true') 2846 .css('width', ''); 2847 2848 }; 2849 2850 Slick.prototype.unslick = function(fromBreakpoint) { 2851 2852 var _ = this; 2853 _.$slider.trigger('unslick', [_, fromBreakpoint]); 2854 _.destroy(); 2855 2856 }; 2857 2858 Slick.prototype.updateArrows = function() { 2859 2860 var _ = this, 2861 centerOffset; 2862 2863 centerOffset = Math.floor(_.options.slidesToShow / 2); 2864 2865 if ( _.options.arrows === true && 2866 _.slideCount > _.options.slidesToShow && 2867 !_.options.infinite ) { 2868 2869 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2870 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2871 2872 if (_.currentSlide === 0) { 2873 2874 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2875 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2876 2877 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 2878 2879 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2880 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2881 2882 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 2883 2884 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2885 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2886 2887 } 2888 2889 } 2890 2891 }; 2892 2893 Slick.prototype.updateDots = function() { 2894 2895 var _ = this; 2896 2897 if (_.$dots !== null) { 2898 2899 _.$dots 2900 .find('li') 2901 .removeClass('slick-active') 2902 .attr('aria-hidden', 'true'); 2903 2904 _.$dots 2905 .find('li') 2906 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 2907 .addClass('slick-active') 2908 .attr('aria-hidden', 'false'); 2909 2910 } 2911 2912 }; 2913 2914 Slick.prototype.visibility = function() { 2915 2916 var _ = this; 2917 2918 if ( _.options.autoplay ) { 2919 2920 if ( document[_.hidden] ) { 2921 2922 _.interrupted = true; 2923 2924 } else { 2925 2926 _.interrupted = false; 2927 2928 } 2929 2930 } 2931 2932 }; 2933 2934 $.fn.slick = function() { 2935 var _ = this, 2936 opt = arguments[0], 2937 args = Array.prototype.slice.call(arguments, 1), 2938 l = _.length, 2939 i, 2940 ret; 2941 for (i = 0; i < l; i++) { 2942 if (typeof opt == 'object' || typeof opt == 'undefined') 2943 _[i].slick = new Slick(_[i], opt); 2944 else 2945 ret = _[i].slick[opt].apply(_[i].slick, args); 2946 if (typeof ret != 'undefined') return ret; 2947 } 2948 return _; 2949 }; 2950 2951}));
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.