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