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