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