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