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