vendor: 27,518 bytes, lines 1-722
1 2 3/* global window, document, define, jQuery, setInterval, clearInterval */ 4;(function(factory) { 5 'use strict'; 6 if (typeof define === 'function' && define.amd) { 7 define(['jquery'], factory); 8 } else if (typeof exports !== 'undefined') { 9 module.exports = factory(require('jquery')); 10 } else { 11 factory(jQuery); 12 } 13}(function($) { 14 'use strict'; 15 var Slick = window.Slick || {}; 16 Slick = (function() { 17 var instanceUid = 0; 18 function Slick(element, settings) { 19 var _ = this, dataSettings; 20 _.defaults = { 21 accessibility: true, 22 adaptiveHeight: false, 23 appendArrows: $(element), 24 appendDots: $(element), 25 arrows: true, 26 asNavFor: null, 27 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 28 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 29 autoplay: false, 30 autoplaySpeed: 3000, 31 centerMode: false, 32 centerPadding: '50px', 33 cssEase: 'ease', 34 customPaging: function(slider, i) { 35 return $('<button type="button" />').text(i + 1); 36 }, 37 dots: false, 38 dotsClass: 'slick-dots', 39 draggable: true, 40 easing: 'linear', 41 edgeFriction: 0.35, 42 fade: false, 43 focusOnSelect: false, 44 focusOnChange: false, 45 infinite: true, 46 initialSlide: 0, 47 lazyLoad: 'ondemand', 48 mobileFirst: false, 49 pauseOnHover: true, 50 pauseOnFocus: true, 51 pauseOnDotsHover: false, 52 respondTo: 'window', 53 responsive: null, 54 rows: 1, 55 rtl: false, 56 slide: '', 57 slidesPerRow: 1, 58 slidesToShow: 1, 59 slidesToScroll: 1, 60 speed: 500, 61 swipe: true, 62 swipeToSlide: false, 63 touchMove: true, 64 touchThreshold: 5, 65 useCSS: true, 66 useTransform: true, 67 variableWidth: false, 68 vertical: false, 69 verticalSwiping: false, 70 waitForAnimate: true, 71 zIndex: 1000 72 }; 73 _.initials = { 74 animating: false, 75 dragging: false, 76 autoPlayTimer: null, 77 currentDirection: 0, 78 currentLeft: null, 79 currentSlide: 0, 80 direction: 1, 81 $dots: null, 82 listWidth: null, 83 listHeight: null, 84 loadIndex: 0, 85 $nextArrow: null, 86 $prevArrow: null, 87 scrolling: false, 88 slideCount: null, 89 slideWidth: null, 90 $slideTrack: null, 91 $slides: null, 92 sliding: false, 93 slideOffset: 0, 94 swipeLeft: null, 95 swiping: false, 96 $list: null, 97 touchObject: {}, 98 transformsEnabled: false, 99 unslicked: false 100 }; 101 $.extend(_, _.initials); 102 _.activeBreakpoint = null; 103 _.animType = null; 104 _.animProp = null; 105 _.breakpoints = []; 106 _.breakpointSettings = []; 107 _.cssTransitions = false; 108 _.focussed = false; 109 _.interrupted = false; 110 _.hidden = 'hidden'; 111 _.paused = true; 112 _.positionProp = null; 113 _.respondTo = null; 114 _.rowCount = 1; 115 _.shouldClick = true; 116 _.$slider = $(element); 117 _.$slidesCache = null; 118 _.transformType = null; 119 _.transitionType = null; 120 _.visibilityChange = 'visibilitychange'; 121 _.windowWidth = 0; 122 _.windowTimer = null; 123 dataSettings = $(element).data('slick') || {}; 124 _.options = $.extend({}, _.defaults, settings, dataSettings); 125 _.currentSlide = _.options.initialSlide; 126 _.originalSettings = _.options; 127 if (typeof document.mozHidden !== 'undefined') { 128 _.hidden = 'mozHidden'; 129 _.visibilityChange = 'mozvisibilitychange'; 130 } else if (typeof document.webkitHidden !== 'undefined') { 131 _.hidden = 'webkitHidden'; 132 _.visibilityChange = 'webkitvisibilitychange'; 133 } 134 _.autoPlay = $.proxy(_.autoPlay, _); 135 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 136 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 137 _.changeSlide = $.proxy(_.changeSlide, _); 138 _.clickHandler = $.proxy(_.clickHandler, _); 139 _.selectHandler = $.proxy(_.selectHandler, _); 140 _.setPosition = $.proxy(_.setPosition, _); 141 _.swipeHandler = $.proxy(_.swipeHandler, _); 142 _.dragHandler = $.proxy(_.dragHandler, _); 143 _.keyHandler = $.proxy(_.keyHandler, _); 144 _.instanceUid = instanceUid++; 145 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 146 _.registerBreakpoints(); 147 _.init(true); 148 } 149 return Slick; 150 }()); 151 Slick.prototype.activateADA = function() { 152 var _ = this; 153 _.$slideTrack.find('.slick-active').attr({ 154 'aria-hidden': 'false' 155 }).find('a, input, button, select').attr({ 156 'tabindex': '0' 157 }); 158 }; 159 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 160 var _ = this; 161 if (typeof(index) === 'boolean') { 162 addBefore = index; 163 index = null; 164 } else if (index < 0 || (index >= _.slideCount)) { 165 return false; 166 } 167 _.unload(); 168 if (typeof(index) === 'number') { 169 if (index === 0 && _.$slides.length === 0) { 170 $(markup).appendTo(_.$slideTrack); 171 } else if (addBefore) { 172 $(markup).insertBefore(_.$slides.eq(index)); 173 } else { 174 $(markup).insertAfter(_.$slides.eq(index)); 175 } 176 } else { 177 if (addBefore === true) { 178 $(markup).prependTo(_.$slideTrack); 179 } else { 180 $(markup).appendTo(_.$slideTrack); 181 } 182 } 183 _.$slides = _.$slideTrack.children(this.options.slide); 184 _.$slideTrack.children(this.options.slide).detach(); 185 _.$slideTrack.append(_.$slides); 186 _.$slides.each(function(index, element) { 187 $(element).attr('data-slick-index', index); 188 }); 189 _.$slidesCache = _.$slides; 190 _.reinit(); 191 }; 192 Slick.prototype.animateHeight = function() { 193 var _ = this; 194 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 195 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 196 _.$list.animate({ 197 height: targetHeight 198 }, _.options.speed); 199 } 200 }; 201 Slick.prototype.animateSlide = function(targetLeft, callback) { 202 var animProps = {}, 203 _ = this; 204 _.animateHeight(); 205 if (_.options.rtl === true && _.options.vertical === false) { 206 targetLeft = -targetLeft; 207 } 208 if (_.transformsEnabled === false) { 209 if (_.options.vertical === false) { 210 _.$slideTrack.animate({ 211 left: targetLeft 212 }, _.options.speed, _.options.easing, callback); 213 } else { 214 _.$slideTrack.animate({ 215 top: targetLeft 216 }, _.options.speed, _.options.easing, callback); 217 } 218 } else { 219 if (_.cssTransitions === false) { 220 if (_.options.rtl === true) { 221 _.currentLeft = -(_.currentLeft); 222 } 223 $({ 224 animStart: _.currentLeft 225 }).animate({ 226 animStart: targetLeft 227 }, { 228 duration: _.options.speed, 229 easing: _.options.easing, 230 step: function(now) { 231 now = Math.ceil(now); 232 if (_.options.vertical === false) { 233 animProps[_.animType] = 'translate(' + 234 now + 'px, 0px)'; 235 _.$slideTrack.css(animProps); 236 } else { 237 animProps[_.animType] = 'translate(0px,' + 238 now + 'px)'; 239 _.$slideTrack.css(animProps); 240 } 241 }, 242 complete: function() { 243 if (callback) { 244 callback.call(); 245 } 246 } 247 }); 248 } else { 249 _.applyTransition(); 250 targetLeft = Math.ceil(targetLeft); 251 if (_.options.vertical === false) { 252 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 253 } else { 254 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 255 } 256 _.$slideTrack.css(animProps); 257 if (callback) { 258 setTimeout(function() { 259 _.disableTransition(); 260 callback.call(); 261 }, _.options.speed); 262 } 263 } 264 } 265 }; 266 Slick.prototype.getNavTarget = function() { 267 var _ = this, 268 asNavFor = _.options.asNavFor; 269 if ( asNavFor && asNavFor !== null ) { 270 asNavFor = $(asNavFor).not(_.$slider); 271 } 272 return asNavFor; 273 }; 274 Slick.prototype.asNavFor = function(index) { 275 var _ = this, 276 asNavFor = _.getNavTarget(); 277 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 278 asNavFor.each(function() { 279 var target = $(this).slick('getSlick'); 280 if(!target.unslicked) { 281 target.slideHandler(index, true); 282 } 283 }); 284 } 285 }; 286 Slick.prototype.applyTransition = function(slide) { 287 var _ = this, 288 transition = {}; 289 if (_.options.fade === false) { 290 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 291 } else { 292 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 293 } 294 if (_.options.fade === false) { 295 _.$slideTrack.css(transition); 296 } else { 297 _.$slides.eq(slide).css(transition); 298 } 299 }; 300 Slick.prototype.autoPlay = function() { 301 var _ = this; 302 _.autoPlayClear(); 303 if ( _.slideCount > _.options.slidesToShow ) { 304 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 305 } 306 }; 307 Slick.prototype.autoPlayClear = function() { 308 var _ = this; 309 if (_.autoPlayTimer) { 310 clearInterval(_.autoPlayTimer); 311 } 312 }; 313 Slick.prototype.autoPlayIterator = function() { 314 var _ = this, 315 slideTo = _.currentSlide + _.options.slidesToScroll; 316 if ( !_.paused && !_.interrupted && !_.focussed ) { 317 if ( _.options.infinite === false ) { 318 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 319 _.direction = 0; 320 } 321 else if ( _.direction === 0 ) { 322 slideTo = _.currentSlide - _.options.slidesToScroll; 323 if ( _.currentSlide - 1 === 0 ) { 324 _.direction = 1; 325 } 326 } 327 } 328 _.slideHandler( slideTo ); 329 } 330 }; 331 Slick.prototype.buildArrows = function() { 332 var _ = this; 333 if (_.options.arrows === true ) { 334 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 335 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 336 if( _.slideCount > _.options.slidesToShow ) { 337 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 338 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 339 if (_.htmlExpr.test(_.options.prevArrow)) { 340 _.$prevArrow.prependTo(_.options.appendArrows); 341 } 342 if (_.htmlExpr.test(_.options.nextArrow)) { 343 _.$nextArrow.appendTo(_.options.appendArrows); 344 } 345 if (_.options.infinite !== true) { 346 _.$prevArrow 347 .addClass('slick-disabled') 348 .attr('aria-disabled', 'true'); 349 } 350 } else { 351 _.$prevArrow.add( _.$nextArrow ) 352 .addClass('slick-hidden') 353 .attr({ 354 'aria-disabled': 'true', 355 'tabindex': '-1' 356 }); 357 } 358 } 359 }; 360 Slick.prototype.buildDots = function() { 361 var _ = this, 362 i, dot; 363 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 364 _.$slider.addClass('slick-dotted'); 365 dot = $('<ul />').addClass(_.options.dotsClass); 366 for (i = 0; i <= _.getDotCount(); i += 1) { 367 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 368 } 369 _.$dots = dot.appendTo(_.options.appendDots); 370 _.$dots.find('li').first().addClass('slick-active'); 371 } 372 }; 373 Slick.prototype.buildOut = function() { 374 var _ = this; 375 _.$slides = 376 _.$slider 377 .children( _.options.slide + ':not(.slick-cloned)') 378 .addClass('slick-slide'); 379 _.slideCount = _.$slides.length; 380 _.$slides.each(function(index, element) { 381 $(element) 382 .attr('data-slick-index', index) 383 .data('originalStyling', $(element).attr('style') || ''); 384 }); 385 _.$slider.addClass('slick-slider'); 386 _.$slideTrack = (_.slideCount === 0) ? 387 $('<div class="slick-track"/>').appendTo(_.$slider) : 388 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 389 _.$list = _.$slideTrack.wrap( 390 '<div class="slick-list"/>').parent(); 391 _.$slideTrack.css('opacity', 0); 392 if (_.options.centerMode === true || _.options.swipeToSlide === true) { 393 _.options.slidesToScroll = 1; 394 } 395 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 396 _.setupInfinite(); 397 _.buildArrows(); 398 _.buildDots(); 399 _.updateDots(); 400 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 401 if (_.options.draggable === true) { 402 _.$list.addClass('draggable'); 403 } 404 }; 405 Slick.prototype.buildRows = function() { 406 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 407 newSlides = document.createDocumentFragment(); 408 originalSlides = _.$slider.children(); 409 if(_.options.rows > 0) { 410 slidesPerSection = _.options.slidesPerRow * _.options.rows; 411 numOfSlides = Math.ceil( 412 originalSlides.length / slidesPerSection 413 ); 414 for(a = 0; a < numOfSlides; a++){ 415 var slide = document.createElement('div'); 416 for(b = 0; b < _.options.rows; b++) { 417 var row = document.createElement('div'); 418 for(c = 0; c < _.options.slidesPerRow; c++) { 419 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 420 if (originalSlides.get(target)) { 421 row.appendChild(originalSlides.get(target)); 422 } 423 } 424 slide.appendChild(row); 425 } 426 newSlides.appendChild(slide); 427 } 428 _.$slider.empty().append(newSlides); 429 _.$slider.children().children().children() 430 .css({ 431 'width':(100 / _.options.slidesPerRow) + '%', 432 'display': 'inline-block' 433 }); 434 } 435 }; 436 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 437 var _ = this, 438 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 439 var sliderWidth = _.$slider.width(); 440 var windowWidth = window.innerWidth || $(window).width(); 441 if (_.respondTo === 'window') { 442 respondToWidth = windowWidth; 443 } else if (_.respondTo === 'slider') { 444 respondToWidth = sliderWidth; 445 } else if (_.respondTo === 'min') { 446 respondToWidth = Math.min(windowWidth, sliderWidth); 447 } 448 if ( _.options.responsive && 449 _.options.responsive.length && 450 _.options.responsive !== null) { 451 targetBreakpoint = null; 452 for (breakpoint in _.breakpoints) { 453 if (_.breakpoints.hasOwnProperty(breakpoint)) { 454 if (_.originalSettings.mobileFirst === false) { 455 if (respondToWidth < _.breakpoints[breakpoint]) { 456 targetBreakpoint = _.breakpoints[breakpoint]; 457 } 458 } else { 459 if (respondToWidth > _.breakpoints[breakpoint]) { 460 targetBreakpoint = _.breakpoints[breakpoint]; 461 } 462 } 463 } 464 } 465 if (targetBreakpoint !== null) { 466 if (_.activeBreakpoint !== null) { 467 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 468 _.activeBreakpoint = 469 targetBreakpoint; 470 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 471 _.unslick(targetBreakpoint); 472 } else { 473 _.options = $.extend({}, _.originalSettings, 474 _.breakpointSettings[ 475 targetBreakpoint]); 476 if (initial === true) { 477 _.currentSlide = _.options.initialSlide; 478 } 479 _.refresh(initial); 480 } 481 triggerBreakpoint = targetBreakpoint; 482 } 483 } else { 484 _.activeBreakpoint = targetBreakpoint; 485 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 486 _.unslick(targetBreakpoint); 487 } else { 488 _.options = $.extend({}, _.originalSettings, 489 _.breakpointSettings[ 490 targetBreakpoint]); 491 if (initial === true) { 492 _.currentSlide = _.options.initialSlide; 493 } 494 _.refresh(initial); 495 } 496 triggerBreakpoint = targetBreakpoint; 497 } 498 } else { 499 if (_.activeBreakpoint !== null) { 500 _.activeBreakpoint = null; 501 _.options = _.originalSettings; 502 if (initial === true) { 503 _.currentSlide = _.options.initialSlide; 504 } 505 _.refresh(initial); 506 triggerBreakpoint = targetBreakpoint; 507 } 508 } 509 if( !initial && triggerBreakpoint !== false ) { 510 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 511 } 512 } 513 }; 514 Slick.prototype.changeSlide = function(event, dontAnimate) { 515 var _ = this, 516 $target = $(event.currentTarget), 517 indexOffset, slideOffset, unevenOffset; 518 if($target.is('a')) { 519 event.preventDefault(); 520 } 521 if(!$target.is('li')) { 522 $target = $target.closest('li'); 523 } 524 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 525 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 526 switch (event.data.message) { 527 case 'previous': 528 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 529 if (_.slideCount > _.options.slidesToShow) { 530 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 531 } 532 break; 533 case 'next': 534 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 535 if (_.slideCount > _.options.slidesToShow) { 536 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 537 } 538 break; 539 case 'index': 540 var index = event.data.index === 0 ? 0 : 541 event.data.index || $target.index() * _.options.slidesToScroll; 542 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 543 $target.children().trigger('focus'); 544 break; 545 default: 546 return; 547 } 548 }; 549 Slick.prototype.checkNavigable = function(index) { 550 var _ = this, 551 navigables, prevNavigable; 552 navigables = _.getNavigableIndexes(); 553 prevNavigable = 0; 554 if (index > navigables[navigables.length - 1]) { 555 index = navigables[navigables.length - 1]; 556 } else { 557 for (var n in navigables) { 558 if (index < navigables[n]) { 559 index = prevNavigable; 560 break; 561 } 562 prevNavigable = navigables[n]; 563 } 564 } 565 return index; 566 }; 567 Slick.prototype.cleanUpEvents = function() { 568 var _ = this; 569 if (_.options.dots && _.$dots !== null) { 570 $('li', _.$dots) 571 .off('click.slick', _.changeSlide) 572 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 573 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 574 if (_.options.accessibility === true) { 575 _.$dots.off('keydown.slick', _.keyHandler); 576 } 577 } 578 _.$slider.off('focus.slick blur.slick'); 579 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 580 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 581 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 582 if (_.options.accessibility === true) { 583 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 584 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 585 } 586 } 587 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 588 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 589 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler); 590 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 591 _.$list.off('click.slick', _.clickHandler); 592 $(document).off(_.visibilityChange, _.visibility); 593 _.cleanUpSlideEvents(); 594 if (_.options.accessibility === true) { 595 _.$list.off('keydown.slick', _.keyHandler); 596 } 597 if (_.options.focusOnSelect === true) { 598 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 599 } 600 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 601 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 602 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 603 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 604 }; 605 Slick.prototype.cleanUpSlideEvents = function() { 606 var _ = this; 607 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 608 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 609 }; 610 Slick.prototype.cleanUpRows = function() { 611 var _ = this, originalSlides; 612 if(_.options.rows > 0) { 613 originalSlides = _.$slides.children().children(); 614 originalSlides.removeAttr('style'); 615 _.$slider.empty().append(originalSlides); 616 } 617 }; 618 Slick.prototype.clickHandler = function(event) { 619 var _ = this; 620 if (_.shouldClick === false) { 621 event.stopImmediatePropagation(); 622 event.stopPropagation(); 623 event.preventDefault(); 624 } 625 }; 626 Slick.prototype.destroy = function(refresh) { 627 var _ = this; 628 _.autoPlayClear(); 629 _.touchObject = {}; 630 _.cleanUpEvents(); 631 $('.slick-cloned', _.$slider).detach(); 632 if (_.$dots) { 633 _.$dots.remove(); 634 } 635 if ( _.$prevArrow && _.$prevArrow.length ) { 636 _.$prevArrow 637 .removeClass('slick-disabled slick-arrow slick-hidden') 638 .removeAttr('aria-hidden aria-disabled tabindex') 639 .css('display',''); 640 if ( _.htmlExpr.test( _.options.prevArrow )) { 641 _.$prevArrow.remove(); 642 } 643 } 644 if ( _.$nextArrow && _.$nextArrow.length ) { 645 _.$nextArrow 646 .removeClass('slick-disabled slick-arrow slick-hidden') 647 .removeAttr('aria-hidden aria-disabled tabindex') 648 .css('display',''); 649 if ( _.htmlExpr.test( _.options.nextArrow )) { 650 _.$nextArrow.remove(); 651 } 652 } 653 if (_.$slides) { 654 _.$slides 655 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 656 .removeAttr('aria-hidden') 657 .removeAttr('data-slick-index') 658 .each(function(){ 659 $(this).attr('style', $(this).data('originalStyling')); 660 }); 661 _.$slideTrack.children(this.options.slide).detach(); 662 _.$slideTrack.detach(); 663 _.$list.detach(); 664 _.$slider.append(_.$slides); 665 } 666 _.cleanUpRows(); 667 _.$slider.removeClass('slick-slider'); 668 _.$slider.removeClass('slick-initialized'); 669 _.$slider.removeClass('slick-dotted'); 670 _.unslicked = true; 671 if(!refresh) { 672 _.$slider.trigger('destroy', [_]); 673 } 674 }; 675 Slick.prototype.disableTransition = function(slide) { 676 var _ = this, 677 transition = {}; 678 transition[_.transitionType] = ''; 679 if (_.options.fade === false) { 680 _.$slideTrack.css(transition); 681 } else { 682 _.$slides.eq(slide).css(transition); 683 } 684 }; 685 Slick.prototype.fadeSlide = function(slideIndex, callback) { 686 var _ = this; 687 if (_.cssTransitions === false) { 688 _.$slides.eq(slideIndex).css({ 689 zIndex: _.options.zIndex 690 }); 691 _.$slides.eq(slideIndex).animate({ 692 opacity: 1 693 }, _.options.speed, _.options.easing, callback); 694 } else { 695 _.applyTransition(slideIndex); 696 _.$slides.eq(slideIndex).css({ 697 opacity: 1, 698 zIndex: _.options.zIndex 699 }); 700 if (callback) { 701 setTimeout(function() { 702 _.disableTransition(slideIndex); 703 callback.call(); 704 }, _.options.speed); 705 } 706 } 707 }; 708 Slick.prototype.fadeSlideOut = function(slideIndex) { 709 var _ = this; 710 if (_.cssTransitions === false) { 711 _.$slides.eq(slideIndex).animate({ 712 opacity: 0, 713 zIndex: _.options.zIndex - 2 714 }, _.options.speed, _.options.easing); 715 } else { 716 _.applyTransition(slideIndex); 717 _.$slides.eq(slideIndex).css({ 718 opacity: 0, 719 zIndex: _.options.zIndex - 2 720 }); 721 } 722 };
723 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 724 var _ = this; 725 if (filter !== null) { 726 _.$slidesCache = _.$slides; 727 _.unload(); 728 _.$slideTrack.children(this.options.slide).detach(); 729 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 730 _.reinit(); 731 } 732 }; 733 Slick.prototype.focusHandler = function() { 734 var _ = this; 735 _.$slider 736 .off('focus.slick blur.slick') 737 .on( 738 'focus.slick', 739 '*', 740 function(event) { 741 var $sf = $(this); 742 setTimeout(function() { 743 if( _.options.pauseOnFocus ) { 744 if ($sf.is(':focus')) { 745 _.focussed = true; 746 _.autoPlay(); 747 } 748 } 749 }, 0); 750 } 751 ).on( 752 'blur.slick', 753 '*', 754 function(event) { 755 var $sf = $(this); 756 if( _.options.pauseOnFocus ) { 757 _.focussed = false; 758 _.autoPlay(); 759 } 760 } 761 ); 762 }; 763 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 764 var _ = this; 765 return _.currentSlide; 766 }; 767 Slick.prototype.getDotCount = function() { 768 var _ = this; 769 var breakPoint = 0; 770 var counter = 0; 771 var pagerQty = 0; 772 if (_.options.infinite === true) { 773 if (_.slideCount <= _.options.slidesToShow) { 774 ++pagerQty; 775 } else { 776 while (breakPoint < _.slideCount) { 777 ++pagerQty; 778 breakPoint = counter + _.options.slidesToScroll; 779 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 780 } 781 } 782 } else if (_.options.centerMode === true) { 783 pagerQty = _.slideCount; 784 } else if(!_.options.asNavFor) { 785 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 786 }else { 787 while (breakPoint < _.slideCount) { 788 ++pagerQty; 789 breakPoint = counter + _.options.slidesToScroll; 790 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 791 } 792 } 793 return pagerQty - 1; 794 }; 795 Slick.prototype.getLeft = function(slideIndex) { 796 var _ = this, 797 targetLeft, 798 verticalHeight, 799 verticalOffset = 0, 800 targetSlide, 801 coef; 802 _.slideOffset = 0; 803 verticalHeight = _.$slides.first().outerHeight(true); 804 if (_.options.infinite === true) { 805 if (_.slideCount > _.options.slidesToShow) { 806 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 807 coef = -1 808 if (_.options.vertical === true && _.options.centerMode === true) { 809 if (_.options.slidesToShow === 2) { 810 coef = -1.5; 811 } else if (_.options.slidesToShow === 1) { 812 coef = -2 813 } 814 } 815 verticalOffset = (verticalHeight * _.options.slidesToShow) * coef; 816 } 817 if (_.slideCount % _.options.slidesToScroll !== 0) { 818 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 819 if (slideIndex > _.slideCount) { 820 _.slideOffset = ((_.options.slidesToShow - (sl
vendor: 1,697 bytes, lines 820-851
820ideIndex - _.slideCount)) * _.slideWidth) * -1; 821 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 822 } else { 823 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 824 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 825 } 826 } 827 } 828 } else { 829 if (slideIndex + _.options.slidesToShow > _.slideCount) { 830 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 831 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 832 } 833 } 834 if (_.slideCount <= _.options.slidesToShow) { 835 _.slideOffset = 0; 836 verticalOffset = 0; 837 } 838 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 839 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 840 } else if (_.options.centerMode === true && _.options.infinite === true) { 841 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 842 } else if (_.options.centerMode === true) { 843 _.slideOffset = 0; 844 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 845 } 846 if (_.options.vertical === false) { 847 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 848 } else { 849 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 850 } 851 if (_.options.variableWidth === true) {
852 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 853 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 854 } else { 855 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 856 } 857 if (_.options.rtl === true) { 858 if (targetSlide[0]) { 859 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 860 } else { 861 targetLeft = 0; 862 } 863 } else { 864 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 865 } 866 if (_.options.centerMode === true) { 867 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 868 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 869 } else { 870 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 871 } 872 if (_.options.rtl === true) { 873 if (targetSlide[0]) { 874 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 875 } else { 876 targetLeft = 0; 877 } 878 } else { 879 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 880 } 881 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 882 } 883 } 884 return targetLeft; 885 }; 886 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 887 var _ = this; 888 return _.options[option]; 889 }; 890 Slick.prototype.getNavigableIndexes = function() { 891 var _ = this, 892 breakPoint = 0, 893 counter = 0, 894 indexes = [], 895 max; 896 if (_.options.infinite === false) { 897 max = _.slideCount; 898 } else { 899 breakPoint = _.options.slidesToScroll * -1; 900 counter = _.options.slidesToScroll * -1; 901 max = _.slideCount * 2; 902 } 903 while (breakPoint < max) { 904 indexes.push(breakPoint); 905 breakPoint = counter + _.options.slidesToScroll; 906 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 907 } 908 return indexes; 909 }; 910 Slick.prototype.getSlick = function() { 911 return this; 912 }; 913 Slick.prototype.getSlideCount = function() { 914 var _ = this, 915 slidesTraversed, swipedSlide, swipeTarget, centerOffset; 916 centerOffset = _.options.centerMode === true ? Math.floor(_.$list.width() / 2) : 0; 917 swipeTarget = (_.swipeLeft * -1) + centerOffset; 918 if (_.options.swipeToSlide === true) { 919 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 920 var slideOuterWidth, slideOffset, slideRightBoundary; 921 slideOuterWidth = $(slide).outerWidth(); 922 slideOffset = slide.offsetLeft; 923 if (_.options.centerMode !== true) { 924 slideOffset += (slideOuterWidth / 2); 925 } 926 slideRightBoundary = slideOffset + (slideOuterWidth); 927 if (swipeTarget < slideRightBoundary) { 928 swipedSlide = slide; 929 return false; 930 } 931 }); 932 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 933 return slidesTraversed; 934 } else { 935 return _.options.slidesToScroll; 936 } 937 }; 938 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 939 var _ = this; 940 _.changeSlide({ 941 data: { 942 message: 'index', 943 index: parseInt(slide) 944 } 945 }, dontAnimate); 946 }; 947 Slick.prototype.init = function(creation) { 948 var _ = this; 949 if (!$(_.$slider).hasClass('slick-initialized')) { 950 $(_.$slider).addClass('slick-initialized'); 951 _.buildRows(); 952 _.buildOut(); 953 _.setProps(); 954 _.startLoad(); 955 _.loadSlider(); 956 _.initializeEvents(); 957 _.updateArrows(); 958 _.updateDots(); 959 _.checkResponsive(true); 960 _.focusHandler(); 961 } 962 if (creation) { 963 _.$slider.trigger('init', [_]); 964 } 965 if (_.options.accessibility === true) { 966 _.initADA(); 967 } 968 if ( _.options.autoplay ) { 969 _.paused = false;
vendor: 45,948 bytes, lines 970-2162
970 _.autoPlay(); 971 } 972 }; 973 Slick.prototype.initADA = function() { 974 var _ = this, 975 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), 976 tabControlIndexes = _.getNavigableIndexes().filter(function(val) { 977 return (val >= 0) && (val < _.slideCount); 978 }); 979 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 980 'aria-hidden': 'true', 981 'tabindex': '-1' 982 }).find('a, input, button, select').attr({ 983 'tabindex': '-1' 984 }); 985 if (_.$dots !== null) { 986 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 987 var slideControlIndex = tabControlIndexes.indexOf(i); 988 $(this).attr({ 989 'role': 'tabpanel', 990 'id': 'slick-slide' + _.instanceUid + i, 991 'tabindex': -1 992 }); 993 if (slideControlIndex !== -1) { 994 var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex 995 if ($('#' + ariaButtonControl).length) { 996 $(this).attr({ 997 'aria-describedby': ariaButtonControl 998 }); 999 } 1000 } 1001 }); 1002 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 1003 var mappedSlideIndex = tabControlIndexes[i]; 1004 $(this).attr({ 1005 'role': 'presentation' 1006 }); 1007 $(this).find('button').first().attr({ 1008 'role': 'tab', 1009 'id': 'slick-slide-control' + _.instanceUid + i, 1010 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 1011 'aria-label': (i + 1) + ' of ' + numDotGroups, 1012 'aria-selected': null, 1013 'tabindex': '-1' 1014 }); 1015 }).eq(_.currentSlide).find('button').attr({ 1016 'aria-selected': 'true', 1017 'tabindex': '0' 1018 }).end(); 1019 } 1020 for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) { 1021 if (_.options.focusOnChange) { 1022 _.$slides.eq(i).attr({'tabindex': '0'}); 1023 } else { 1024 _.$slides.eq(i).removeAttr('tabindex'); 1025 } 1026 } 1027 _.activateADA(); 1028 }; 1029 Slick.prototype.initArrowEvents = function() { 1030 var _ = this; 1031 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1032 _.$prevArrow 1033 .off('click.slick') 1034 .on('click.slick', { 1035 message: 'previous' 1036 }, _.changeSlide); 1037 _.$nextArrow 1038 .off('click.slick') 1039 .on('click.slick', { 1040 message: 'next' 1041 }, _.changeSlide); 1042 if (_.options.accessibility === true) { 1043 _.$prevArrow.on('keydown.slick', _.keyHandler); 1044 _.$nextArrow.on('keydown.slick', _.keyHandler); 1045 } 1046 } 1047 }; 1048 Slick.prototype.initDotEvents = function() { 1049 var _ = this; 1050 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1051 $('li', _.$dots).on('click.slick', { 1052 message: 'index' 1053 }, _.changeSlide); 1054 if (_.options.accessibility === true) { 1055 _.$dots.on('keydown.slick', _.keyHandler); 1056 } 1057 } 1058 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) { 1059 $('li', _.$dots) 1060 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 1061 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 1062 } 1063 }; 1064 Slick.prototype.initSlideEvents = function() { 1065 var _ = this; 1066 if ( _.options.pauseOnHover ) { 1067 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 1068 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 1069 } 1070 }; 1071 Slick.prototype.initializeEvents = function() { 1072 var _ = this; 1073 _.initArrowEvents(); 1074 _.initDotEvents(); 1075 _.initSlideEvents(); 1076 _.$list.on('touchstart.slick mousedown.slick', { 1077 action: 'start' 1078 }, _.swipeHandler); 1079 _.$list.on('touchmove.slick mousemove.slick', { 1080 action: 'move' 1081 }, _.swipeHandler); 1082 _.$list.on('touchend.slick mouseup.slick', { 1083 action: 'end' 1084 }, _.swipeHandler); 1085 _.$list.on('touchcancel.slick mouseleave.slick', { 1086 action: 'end' 1087 }, _.swipeHandler); 1088 _.$list.on('click.slick', _.clickHandler); 1089 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 1090 if (_.options.accessibility === true) { 1091 _.$list.on('keydown.slick', _.keyHandler); 1092 } 1093 if (_.options.focusOnSelect === true) { 1094 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1095 } 1096 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 1097 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 1098 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 1099 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 1100 $(_.setPosition); 1101 }; 1102 Slick.prototype.initUI = function() { 1103 var _ = this; 1104 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1105 _.$prevArrow.show(); 1106 _.$nextArrow.show(); 1107 } 1108 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1109 _.$dots.show(); 1110 } 1111 }; 1112 Slick.prototype.keyHandler = function(event) { 1113 var _ = this; 1114 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 1115 if (event.keyCode === 37 && _.options.accessibility === true) { 1116 _.changeSlide({ 1117 data: { 1118 message: _.options.rtl === true ? 'next' : 'previous' 1119 } 1120 }); 1121 } else if (event.keyCode === 39 && _.options.accessibility === true) { 1122 _.changeSlide({ 1123 data: { 1124 message: _.options.rtl === true ? 'previous' : 'next' 1125 } 1126 }); 1127 } 1128 } 1129 }; 1130 Slick.prototype.lazyLoad = function() { 1131 var _ = this, 1132 loadRange, cloneRange, rangeStart, rangeEnd; 1133 function loadImages(imagesScope) { 1134 $('img[data-lazy]', imagesScope).each(function() { 1135 var image = $(this), 1136 imageSource = $(this).attr('data-lazy'), 1137 imageSrcSet = $(this).attr('data-srcset'), 1138 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 1139 imageToLoad = document.createElement('img'); 1140 imageToLoad.onload = function() { 1141 image 1142 .animate({ opacity: 0 }, 100, function() { 1143 if (imageSrcSet) { 1144 image 1145 .attr('srcset', imageSrcSet ); 1146 if (imageSizes) { 1147 image 1148 .attr('sizes', imageSizes ); 1149 } 1150 } 1151 image 1152 .attr('src', imageSource) 1153 .animate({ opacity: 1 }, 200, function() { 1154 image 1155 .removeAttr('data-lazy data-srcset data-sizes') 1156 .removeClass('slick-loading'); 1157 }); 1158 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 1159 }); 1160 }; 1161 imageToLoad.onerror = function() { 1162 image 1163 .removeAttr( 'data-lazy' ) 1164 .removeClass( 'slick-loading' ) 1165 .addClass( 'slick-lazyload-error' ); 1166 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 1167 }; 1168 imageToLoad.src = imageSource; 1169 }); 1170 } 1171 if (_.options.centerMode === true) { 1172 if (_.options.infinite === true) { 1173 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 1174 rangeEnd = rangeStart + _.options.slidesToShow + 2; 1175 } else { 1176 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 1177 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 1178 } 1179 } else { 1180 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 1181 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 1182 if (_.options.fade === true) { 1183 if (rangeStart > 0) rangeStart--; 1184 if (rangeEnd <= _.slideCount) rangeEnd++; 1185 } 1186 } 1187 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 1188 if (_.options.lazyLoad === 'anticipated') { 1189 var prevSlide = rangeStart - 1, 1190 nextSlide = rangeEnd, 1191 $slides = _.$slider.find('.slick-slide'); 1192 for (var i = 0; i < _.options.slidesToScroll; i++) { 1193 if (prevSlide < 0) prevSlide = _.slideCount - 1; 1194 loadRange = loadRange.add($slides.eq(prevSlide)); 1195 loadRange = loadRange.add($slides.eq(nextSlide)); 1196 prevSlide--; 1197 nextSlide++; 1198 } 1199 } 1200 loadImages(loadRange); 1201 if (_.slideCount <= _.options.slidesToShow) { 1202 cloneRange = _.$slider.find('.slick-slide'); 1203 loadImages(cloneRange); 1204 } else 1205 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 1206 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 1207 loadImages(cloneRange); 1208 } else if (_.currentSlide === 0) { 1209 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 1210 loadImages(cloneRange); 1211 } 1212 }; 1213 Slick.prototype.loadSlider = function() { 1214 var _ = this; 1215 _.setPosition(); 1216 _.$slideTrack.css({ 1217 opacity: 1 1218 }); 1219 _.$slider.removeClass('slick-loading'); 1220 _.initUI(); 1221 if (_.options.lazyLoad === 'progressive') { 1222 _.progressiveLazyLoad(); 1223 } 1224 }; 1225 Slick.prototype.next = Slick.prototype.slickNext = function() { 1226 var _ = this; 1227 _.changeSlide({ 1228 data: { 1229 message: 'next' 1230 } 1231 }); 1232 }; 1233 Slick.prototype.orientationChange = function() { 1234 var _ = this; 1235 _.checkResponsive(); 1236 _.setPosition(); 1237 }; 1238 Slick.prototype.pause = Slick.prototype.slickPause = function() { 1239 var _ = this; 1240 _.autoPlayClear(); 1241 _.paused = true; 1242 }; 1243 Slick.prototype.play = Slick.prototype.slickPlay = function() { 1244 var _ = this; 1245 _.autoPlay(); 1246 _.options.autoplay = true; 1247 _.paused = false; 1248 _.focussed = false; 1249 _.interrupted = false; 1250 }; 1251 Slick.prototype.postSlide = function(index) { 1252 var _ = this; 1253 if( !_.unslicked ) { 1254 _.$slider.trigger('afterChange', [_, index]); 1255 _.animating = false; 1256 if (_.slideCount > _.options.slidesToShow) { 1257 _.setPosition(); 1258 } 1259 _.swipeLeft = null; 1260 if ( _.options.autoplay ) { 1261 _.autoPlay(); 1262 } 1263 if (_.options.accessibility === true) { 1264 _.initADA(); 1265 if (_.options.focusOnChange) { 1266 var $currentSlide = $(_.$slides.get(_.currentSlide)); 1267 $currentSlide.attr('tabindex', 0).focus(); 1268 } 1269 } 1270 } 1271 }; 1272 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 1273 var _ = this; 1274 _.changeSlide({ 1275 data: { 1276 message: 'previous' 1277 } 1278 }); 1279 }; 1280 Slick.prototype.preventDefault = function(event) { 1281 event.preventDefault(); 1282 }; 1283 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 1284 tryCount = tryCount || 1; 1285 var _ = this, 1286 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 1287 image, 1288 imageSource, 1289 imageSrcSet, 1290 imageSizes, 1291 imageToLoad; 1292 if ( $imgsToLoad.length ) { 1293 image = $imgsToLoad.first(); 1294 imageSource = image.attr('data-lazy'); 1295 imageSrcSet = image.attr('data-srcset'); 1296 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 1297 imageToLoad = document.createElement('img'); 1298 imageToLoad.onload = function() { 1299 if (imageSrcSet) { 1300 image 1301 .attr('srcset', imageSrcSet ); 1302 if (imageSizes) { 1303 image 1304 .attr('sizes', imageSizes ); 1305 } 1306 } 1307 image 1308 .attr( 'src', imageSource ) 1309 .removeAttr('data-lazy data-srcset data-sizes') 1310 .removeClass('slick-loading'); 1311 if ( _.options.adaptiveHeight === true ) { 1312 _.setPosition(); 1313 } 1314 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 1315 _.progressiveLazyLoad(); 1316 }; 1317 imageToLoad.onerror = function() { 1318 if ( tryCount < 3 ) { 1319 /** 1320 * try to load the image 3 times, 1321 * leave a slight delay so we don't get 1322 * servers blocking the request. 1323 */ 1324 setTimeout( function() { 1325 _.progressiveLazyLoad( tryCount + 1 ); 1326 }, 500 ); 1327 } else { 1328 image 1329 .removeAttr( 'data-lazy' ) 1330 .removeClass( 'slick-loading' ) 1331 .addClass( 'slick-lazyload-error' ); 1332 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 1333 _.progressiveLazyLoad(); 1334 } 1335 }; 1336 imageToLoad.src = imageSource; 1337 } else { 1338 _.$slider.trigger('allImagesLoaded', [ _ ]); 1339 } 1340 }; 1341 Slick.prototype.refresh = function( initializing ) { 1342 var _ = this, currentSlide, lastVisibleIndex; 1343 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 1344 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 1345 _.currentSlide = lastVisibleIndex; 1346 } 1347 if ( _.slideCount <= _.options.slidesToShow ) { 1348 _.currentSlide = 0; 1349 } 1350 currentSlide = _.currentSlide; 1351 _.destroy(true); 1352 $.extend(_, _.initials, { currentSlide: currentSlide }); 1353 _.init(); 1354 if( !initializing ) { 1355 _.changeSlide({ 1356 data: { 1357 message: 'index', 1358 index: currentSlide 1359 } 1360 }, false); 1361 } 1362 }; 1363 Slick.prototype.registerBreakpoints = function() { 1364 var _ = this, breakpoint, currentBreakpoint, l, 1365 responsiveSettings = _.options.responsive || null; 1366 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 1367 _.respondTo = _.options.respondTo || 'window'; 1368 for ( breakpoint in responsiveSettings ) { 1369 l = _.breakpoints.length-1; 1370 if (responsiveSettings.hasOwnProperty(breakpoint)) { 1371 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 1372 while( l >= 0 ) { 1373 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 1374 _.breakpoints.splice(l,1); 1375 } 1376 l--; 1377 } 1378 _.breakpoints.push(currentBreakpoint); 1379 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 1380 } 1381 } 1382 _.breakpoints.sort(function(a, b) { 1383 return ( _.options.mobileFirst ) ? a-b : b-a; 1384 }); 1385 } 1386 }; 1387 Slick.prototype.reinit = function() { 1388 var _ = this; 1389 _.$slides = 1390 _.$slideTrack 1391 .children(_.options.slide) 1392 .addClass('slick-slide'); 1393 _.slideCount = _.$slides.length; 1394 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 1395 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 1396 } 1397 if (_.slideCount <= _.options.slidesToShow) { 1398 _.currentSlide = 0; 1399 } 1400 _.registerBreakpoints(); 1401 _.setProps(); 1402 _.setupInfinite(); 1403 _.buildArrows(); 1404 _.updateArrows(); 1405 _.initArrowEvents(); 1406 _.buildDots(); 1407 _.updateDots(); 1408 _.initDotEvents(); 1409 _.cleanUpSlideEvents(); 1410 _.initSlideEvents(); 1411 _.checkResponsive(false, true); 1412 if (_.options.focusOnSelect === true) { 1413 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1414 } 1415 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 1416 _.setPosition(); 1417 _.focusHandler(); 1418 _.paused = !_.options.autoplay; 1419 _.autoPlay(); 1420 _.$slider.trigger('reInit', [_]); 1421 }; 1422 Slick.prototype.resize = function() { 1423 var _ = this; 1424 if ($(window).width() !== _.windowWidth) { 1425 clearTimeout(_.windowDelay); 1426 _.windowDelay = window.setTimeout(function() { 1427 _.windowWidth = $(window).width(); 1428 _.checkResponsive(); 1429 if( !_.unslicked ) { _.setPosition(); } 1430 }, 50); 1431 } 1432 }; 1433 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 1434 var _ = this; 1435 if (typeof(index) === 'boolean') { 1436 removeBefore = index; 1437 index = removeBefore === true ? 0 : _.slideCount - 1; 1438 } else { 1439 index = removeBefore === true ? --index : index; 1440 } 1441 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 1442 return false; 1443 } 1444 _.unload(); 1445 if (removeAll === true) { 1446 _.$slideTrack.children().remove(); 1447 } else { 1448 _.$slideTrack.children(this.options.slide).eq(index).remove(); 1449 } 1450 _.$slides = _.$slideTrack.children(this.options.slide); 1451 _.$slideTrack.children(this.options.slide).detach(); 1452 _.$slideTrack.append(_.$slides); 1453 _.$slidesCache = _.$slides; 1454 _.reinit(); 1455 }; 1456 Slick.prototype.setCSS = function(position) { 1457 var _ = this, 1458 positionProps = {}, 1459 x, y; 1460 if (_.options.rtl === true) { 1461 position = -position; 1462 } 1463 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 1464 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 1465 positionProps[_.positionProp] = position; 1466 if (_.transformsEnabled === false) { 1467 _.$slideTrack.css(positionProps); 1468 } else { 1469 positionProps = {}; 1470 if (_.cssTransitions === false) { 1471 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 1472 _.$slideTrack.css(positionProps); 1473 } else { 1474 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 1475 _.$slideTrack.css(positionProps); 1476 } 1477 } 1478 }; 1479 Slick.prototype.setDimensions = function() { 1480 var _ = this; 1481 if (_.options.vertical === false) { 1482 if (_.options.centerMode === true) { 1483 _.$list.css({ 1484 padding: ('0px ' + _.options.centerPadding) 1485 }); 1486 } 1487 } else { 1488 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 1489 if (_.options.centerMode === true) { 1490 _.$list.css({ 1491 padding: (_.options.centerPadding + ' 0px') 1492 }); 1493 } 1494 } 1495 _.listWidth = _.$list.width(); 1496 _.listHeight = _.$list.height(); 1497 if (_.options.vertical === false && _.options.variableWidth === false) { 1498 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 1499 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 1500 } else if (_.options.variableWidth === true) { 1501 _.$slideTrack.width(5000 * _.slideCount); 1502 } else { 1503 _.slideWidth = Math.ceil(_.listWidth); 1504 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 1505 } 1506 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 1507 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 1508 }; 1509 Slick.prototype.setFade = function() { 1510 var _ = this, 1511 targetLeft; 1512 _.$slides.each(function(index, element) { 1513 targetLeft = (_.slideWidth * index) * -1; 1514 if (_.options.rtl === true) { 1515 $(element).css({ 1516 position: 'relative', 1517 right: targetLeft, 1518 top: 0, 1519 zIndex: _.options.zIndex - 2, 1520 opacity: 0 1521 }); 1522 } else { 1523 $(element).css({ 1524 position: 'relative', 1525 left: targetLeft, 1526 top: 0, 1527 zIndex: _.options.zIndex - 2, 1528 opacity: 0 1529 }); 1530 } 1531 }); 1532 _.$slides.eq(_.currentSlide).css({ 1533 zIndex: _.options.zIndex - 1, 1534 opacity: 1 1535 }); 1536 }; 1537 Slick.prototype.setHeight = function() { 1538 var _ = this; 1539 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 1540 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 1541 _.$list.css('height', targetHeight); 1542 } 1543 }; 1544 Slick.prototype.setOption = 1545 Slick.prototype.slickSetOption = function() { 1546 /** 1547 * accepts arguments in format of: 1548 * 1549 * - for changing a single option's value: 1550 * .slick("setOption", option, value, refresh ) 1551 * 1552 * - for changing a set of responsive options: 1553 * .slick("setOption", 'responsive', [{}, ...], refresh ) 1554 * 1555 * - for updating multiple values at once (not responsive) 1556 * .slick("setOption", { 'option': value, ... }, refresh ) 1557 */ 1558 var _ = this, l, item, option, value, refresh = false, type; 1559 if( $.type( arguments[0] ) === 'object' ) { 1560 option = arguments[0]; 1561 refresh = arguments[1]; 1562 type = 'multiple'; 1563 } else if ( $.type( arguments[0] ) === 'string' ) { 1564 option = arguments[0]; 1565 value = arguments[1]; 1566 refresh = arguments[2]; 1567 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 1568 type = 'responsive'; 1569 } else if ( typeof arguments[1] !== 'undefined' ) { 1570 type = 'single'; 1571 } 1572 } 1573 if ( type === 'single' ) { 1574 _.options[option] = value; 1575 } else if ( type === 'multiple' ) { 1576 $.each( option , function( opt, val ) { 1577 _.options[opt] = val; 1578 }); 1579 } else if ( type === 'responsive' ) { 1580 for ( item in value ) { 1581 if( $.type( _.options.responsive ) !== 'array' ) { 1582 _.options.responsive = [ value[item] ]; 1583 } else { 1584 l = _.options.responsive.length-1; 1585 while( l >= 0 ) { 1586 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 1587 _.options.responsive.splice(l,1); 1588 } 1589 l--; 1590 } 1591 _.options.responsive.push( value[item] ); 1592 } 1593 } 1594 } 1595 if ( refresh ) { 1596 _.unload(); 1597 _.reinit(); 1598 } 1599 }; 1600 Slick.prototype.setPosition = function() { 1601 var _ = this; 1602 _.setDimensions(); 1603 _.setHeight(); 1604 if (_.options.fade === false) { 1605 _.setCSS(_.getLeft(_.currentSlide)); 1606 } else { 1607 _.setFade(); 1608 } 1609 _.$slider.trigger('setPosition', [_]); 1610 }; 1611 Slick.prototype.setProps = function() { 1612 var _ = this, 1613 bodyStyle = document.body.style; 1614 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 1615 if (_.positionProp === 'top') { 1616 _.$slider.addClass('slick-vertical'); 1617 } else { 1618 _.$slider.removeClass('slick-vertical'); 1619 } 1620 if (bodyStyle.WebkitTransition !== undefined || 1621 bodyStyle.MozTransition !== undefined || 1622 bodyStyle.msTransition !== undefined) { 1623 if (_.options.useCSS === true) { 1624 _.cssTransitions = true; 1625 } 1626 } 1627 if ( _.options.fade ) { 1628 if ( typeof _.options.zIndex === 'number' ) { 1629 if( _.options.zIndex < 3 ) { 1630 _.options.zIndex = 3; 1631 } 1632 } else { 1633 _.options.zIndex = _.defaults.zIndex; 1634 } 1635 } 1636 if (bodyStyle.OTransform !== undefined) { 1637 _.animType = 'OTransform'; 1638 _.transformType = '-o-transform'; 1639 _.transitionType = 'OTransition'; 1640 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 1641 } 1642 if (bodyStyle.MozTransform !== undefined) { 1643 _.animType = 'MozTransform'; 1644 _.transformType = '-moz-transform'; 1645 _.transitionType = 'MozTransition'; 1646 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 1647 } 1648 if (bodyStyle.webkitTransform !== undefined) { 1649 _.animType = 'webkitTransform'; 1650 _.transformType = '-webkit-transform'; 1651 _.transitionType = 'webkitTransition'; 1652 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 1653 } 1654 if (bodyStyle.msTransform !== undefined) { 1655 _.animType = 'msTransform'; 1656 _.transformType = '-ms-transform'; 1657 _.transitionType = 'msTransition'; 1658 if (bodyStyle.msTransform === undefined) _.animType = false; 1659 } 1660 if (bodyStyle.transform !== undefined && _.animType !== false) { 1661 _.animType = 'transform'; 1662 _.transformType = 'transform'; 1663 _.transitionType = 'transition'; 1664 } 1665 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 1666 }; 1667 Slick.prototype.setSlideClasses = function(index) { 1668 var _ = this, 1669 centerOffset, allSlides, indexOffset, remainder; 1670 allSlides = _.$slider 1671 .find('.slick-slide') 1672 .removeClass('slick-active slick-center slick-current') 1673 .attr('aria-hidden', 'true'); 1674 _.$slides 1675 .eq(index) 1676 .addClass('slick-current'); 1677 if (_.options.centerMode === true) { 1678 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 1679 centerOffset = Math.floor(_.options.slidesToShow / 2); 1680 if (_.options.infinite === true) { 1681 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 1682 _.$slides 1683 .slice(index - centerOffset + evenCoef, index + centerOffset + 1) 1684 .addClass('slick-active') 1685 .attr('aria-hidden', 'false'); 1686 } else { 1687 indexOffset = _.options.slidesToShow + index; 1688 allSlides 1689 .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2) 1690 .addClass('slick-active') 1691 .attr('aria-hidden', 'false'); 1692 } 1693 if (index === 0) { 1694 allSlides 1695 .eq(allSlides.length - 1 - _.options.slidesToShow) 1696 .addClass('slick-center'); 1697 } else if (index === _.slideCount - 1) { 1698 allSlides 1699 .eq(_.options.slidesToShow) 1700 .addClass('slick-center'); 1701 } 1702 } 1703 _.$slides 1704 .eq(index) 1705 .addClass('slick-center'); 1706 } else { 1707 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 1708 _.$slides 1709 .slice(index, index + _.options.slidesToShow) 1710 .addClass('slick-active') 1711 .attr('aria-hidden', 'false'); 1712 } else if (allSlides.length <= _.options.slidesToShow) { 1713 allSlides 1714 .addClass('slick-active') 1715 .attr('aria-hidden', 'false'); 1716 } else { 1717 remainder = _.slideCount % _.options.slidesToShow; 1718 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 1719 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 1720 allSlides 1721 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 1722 .addClass('slick-active') 1723 .attr('aria-hidden', 'false'); 1724 } else { 1725 allSlides 1726 .slice(indexOffset, indexOffset + _.options.slidesToShow) 1727 .addClass('slick-active') 1728 .attr('aria-hidden', 'false'); 1729 } 1730 } 1731 } 1732 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 1733 _.lazyLoad(); 1734 } 1735 }; 1736 Slick.prototype.setupInfinite = function() { 1737 var _ = this, 1738 i, slideIndex, infiniteCount; 1739 if (_.options.fade === true) { 1740 _.options.centerMode = false; 1741 } 1742 if (_.options.infinite === true && _.options.fade === false) { 1743 slideIndex = null; 1744 if (_.slideCount > _.options.slidesToShow) { 1745 if (_.options.centerMode === true) { 1746 infiniteCount = _.options.slidesToShow + 1; 1747 } else { 1748 infiniteCount = _.options.slidesToShow; 1749 } 1750 for (i = _.slideCount; i > (_.slideCount - 1751 infiniteCount); i -= 1) { 1752 slideIndex = i - 1; 1753 $(_.$slides[slideIndex]).clone(true).attr('id', '') 1754 .attr('data-slick-index', slideIndex - _.slideCount) 1755 .prependTo(_.$slideTrack).addClass('slick-cloned'); 1756 } 1757 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 1758 slideIndex = i; 1759 $(_.$slides[slideIndex]).clone(true).attr('id', '') 1760 .attr('data-slick-index', slideIndex + _.slideCount) 1761 .appendTo(_.$slideTrack).addClass('slick-cloned'); 1762 } 1763 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 1764 $(this).attr('id', ''); 1765 }); 1766 } 1767 } 1768 }; 1769 Slick.prototype.interrupt = function( toggle ) { 1770 var _ = this; 1771 if( !toggle ) { 1772 _.autoPlay(); 1773 } 1774 _.interrupted = toggle; 1775 }; 1776 Slick.prototype.selectHandler = function(event) { 1777 var _ = this; 1778 var targetElement = 1779 $(event.target).is('.slick-slide') ? 1780 $(event.target) : 1781 $(event.target).parents('.slick-slide'); 1782 var index = parseInt(targetElement.attr('data-slick-index')); 1783 if (!index) index = 0; 1784 if (_.slideCount <= _.options.slidesToShow) { 1785 _.slideHandler(index, false, true); 1786 return; 1787 } 1788 _.slideHandler(index); 1789 }; 1790 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 1791 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 1792 _ = this, navTarget; 1793 sync = sync || false; 1794 if (_.animating === true && _.options.waitForAnimate === true) { 1795 return; 1796 } 1797 if (_.options.fade === true && _.currentSlide === index) { 1798 return; 1799 } 1800 if (sync === false) { 1801 _.asNavFor(index); 1802 } 1803 targetSlide = index; 1804 targetLeft = _.getLeft(targetSlide); 1805 slideLeft = _.getLeft(_.currentSlide); 1806 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 1807 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 1808 if (_.options.fade === false) { 1809 targetSlide = _.currentSlide; 1810 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 1811 _.animateSlide(slideLeft, function() { 1812 _.postSlide(targetSlide); 1813 }); 1814 } else { 1815 _.postSlide(targetSlide); 1816 } 1817 } 1818 return; 1819 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 1820 if (_.options.fade === false) { 1821 targetSlide = _.currentSlide; 1822 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 1823 _.animateSlide(slideLeft, function() { 1824 _.postSlide(targetSlide); 1825 }); 1826 } else { 1827 _.postSlide(targetSlide); 1828 } 1829 } 1830 return; 1831 } 1832 if ( _.options.autoplay ) { 1833 clearInterval(_.autoPlayTimer); 1834 } 1835 if (targetSlide < 0) { 1836 if (_.slideCount % _.options.slidesToScroll !== 0) { 1837 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 1838 } else { 1839 animSlide = _.slideCount + targetSlide; 1840 } 1841 } else if (targetSlide >= _.slideCount) { 1842 if (_.slideCount % _.options.slidesToScroll !== 0) { 1843 animSlide = 0; 1844 } else { 1845 animSlide = targetSlide - _.slideCount; 1846 } 1847 } else { 1848 animSlide = targetSlide; 1849 } 1850 _.animating = true; 1851 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 1852 oldSlide = _.currentSlide; 1853 _.currentSlide = animSlide; 1854 _.setSlideClasses(_.currentSlide); 1855 if ( _.options.asNavFor ) { 1856 navTarget = _.getNavTarget(); 1857 navTarget = navTarget.slick('getSlick'); 1858 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 1859 navTarget.setSlideClasses(_.currentSlide); 1860 } 1861 } 1862 _.updateDots(); 1863 _.updateArrows(); 1864 if (_.options.fade === true) { 1865 if (dontAnimate !== true) { 1866 _.fadeSlideOut(oldSlide); 1867 _.fadeSlide(animSlide, function() { 1868 _.postSlide(animSlide); 1869 }); 1870 } else { 1871 _.postSlide(animSlide); 1872 } 1873 _.animateHeight(); 1874 return; 1875 } 1876 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 1877 _.animateSlide(targetLeft, function() { 1878 _.postSlide(animSlide); 1879 }); 1880 } else { 1881 _.postSlide(animSlide); 1882 } 1883 }; 1884 Slick.prototype.startLoad = function() { 1885 var _ = this; 1886 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1887 _.$prevArrow.hide(); 1888 _.$nextArrow.hide(); 1889 } 1890 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1891 _.$dots.hide(); 1892 } 1893 _.$slider.addClass('slick-loading'); 1894 }; 1895 Slick.prototype.swipeDirection = function() { 1896 var xDist, yDist, r, swipeAngle, _ = this; 1897 xDist = _.touchObject.startX - _.touchObject.curX; 1898 yDist = _.touchObject.startY - _.touchObject.curY; 1899 r = Math.atan2(yDist, xDist); 1900 swipeAngle = Math.round(r * 180 / Math.PI); 1901 if (swipeAngle < 0) { 1902 swipeAngle = 360 - Math.abs(swipeAngle); 1903 } 1904 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 1905 return (_.options.rtl === false ? 'left' : 'right'); 1906 } 1907 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 1908 return (_.options.rtl === false ? 'left' : 'right'); 1909 } 1910 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 1911 return (_.options.rtl === false ? 'right' : 'left'); 1912 } 1913 if (_.options.verticalSwiping === true) { 1914 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 1915 return 'down'; 1916 } else { 1917 return 'up'; 1918 } 1919 } 1920 return 'vertical'; 1921 }; 1922 Slick.prototype.swipeEnd = function(event) { 1923 var _ = this, 1924 slideCount, 1925 direction; 1926 _.dragging = false; 1927 _.swiping = false; 1928 if (_.scrolling) { 1929 _.scrolling = false; 1930 return false; 1931 } 1932 _.interrupted = false; 1933 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 1934 if ( _.touchObject.curX === undefined ) { 1935 return false; 1936 } 1937 if ( _.touchObject.edgeHit === true ) { 1938 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 1939 } 1940 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 1941 direction = _.swipeDirection(); 1942 switch ( direction ) { 1943 case 'left': 1944 case 'down': 1945 slideCount = 1946 _.options.swipeToSlide ? 1947 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 1948 _.currentSlide + _.getSlideCount(); 1949 _.currentDirection = 0; 1950 break; 1951 case 'right': 1952 case 'up': 1953 slideCount = 1954 _.options.swipeToSlide ? 1955 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 1956 _.currentSlide - _.getSlideCount(); 1957 _.currentDirection = 1; 1958 break; 1959 default: 1960 } 1961 if( direction != 'vertical' ) { 1962 _.slideHandler( slideCount ); 1963 _.touchObject = {}; 1964 _.$slider.trigger('swipe', [_, direction ]); 1965 } 1966 } else { 1967 if ( _.touchObject.startX !== _.touchObject.curX ) { 1968 _.slideHandler( _.currentSlide ); 1969 _.touchObject = {}; 1970 } 1971 } 1972 }; 1973 Slick.prototype.swipeHandler = function(event) { 1974 var _ = this; 1975 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 1976 return; 1977 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 1978 return; 1979 } 1980 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 1981 event.originalEvent.touches.length : 1; 1982 _.touchObject.minSwipe = _.listWidth / _.options 1983 .touchThreshold; 1984 if (_.options.verticalSwiping === true) { 1985 _.touchObject.minSwipe = _.listHeight / _.options 1986 .touchThreshold; 1987 } 1988 switch (event.data.action) { 1989 case 'start': 1990 _.swipeStart(event); 1991 break; 1992 case 'move': 1993 _.swipeMove(event); 1994 break; 1995 case 'end': 1996 _.swipeEnd(event); 1997 break; 1998 } 1999 }; 2000 Slick.prototype.swipeMove = function(event) { 2001 var _ = this, 2002 edgeWasHit = false, 2003 curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength; 2004 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 2005 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 2006 return false; 2007 } 2008 curLeft = _.getLeft(_.currentSlide); 2009 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 2010 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 2011 _.touchObject.swipeLength = Math.round(Math.sqrt( 2012 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 2013 verticalSwipeLength = Math.round(Math.sqrt( 2014 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 2015 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 2016 _.scrolling = true; 2017 return false; 2018 } 2019 if (_.options.verticalSwiping === true) { 2020 _.touchObject.swipeLength = verticalSwipeLength; 2021 } 2022 swipeDirection = _.swipeDirection(); 2023 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 2024 _.swiping = true; 2025 event.preventDefault(); 2026 } 2027 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 2028 if (_.options.verticalSwiping === true) { 2029 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 2030 } 2031 swipeLength = _.touchObject.swipeLength; 2032 _.touchObject.edgeHit = false; 2033 if (_.options.infinite === false) { 2034 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 2035 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 2036 _.touchObject.edgeHit = true; 2037 } 2038 } 2039 if (_.options.vertical === false) { 2040 _.swipeLeft = curLeft + swipeLength * positionOffset; 2041 } else { 2042 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 2043 } 2044 if (_.options.verticalSwiping === true) { 2045 _.swipeLeft = curLeft + swipeLength * positionOffset; 2046 } 2047 if (_.options.fade === true || _.options.touchMove === false) { 2048 return false; 2049 } 2050 if (_.animating === true) { 2051 _.swipeLeft = null; 2052 return false; 2053 } 2054 _.setCSS(_.swipeLeft); 2055 }; 2056 Slick.prototype.swipeStart = function(event) { 2057 var _ = this, 2058 touches; 2059 _.interrupted = true; 2060 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 2061 _.touchObject = {}; 2062 return false; 2063 } 2064 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 2065 touches = event.originalEvent.touches[0]; 2066 } 2067 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 2068 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 2069 _.dragging = true; 2070 }; 2071 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 2072 var _ = this; 2073 if (_.$slidesCache !== null) { 2074 _.unload(); 2075 _.$slideTrack.children(this.options.slide).detach(); 2076 _.$slidesCache.appendTo(_.$slideTrack); 2077 _.reinit(); 2078 } 2079 }; 2080 Slick.prototype.unload = function() { 2081 var _ = this; 2082 $('.slick-cloned', _.$slider).remove(); 2083 if (_.$dots) { 2084 _.$dots.remove(); 2085 } 2086 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 2087 _.$prevArrow.remove(); 2088 } 2089 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 2090 _.$nextArrow.remove(); 2091 } 2092 _.$slides 2093 .removeClass('slick-slide slick-active slick-visible slick-current') 2094 .attr('aria-hidden', 'true') 2095 .css('width', ''); 2096 }; 2097 Slick.prototype.unslick = function(fromBreakpoint) { 2098 var _ = this; 2099 _.$slider.trigger('unslick', [_, fromBreakpoint]); 2100 _.destroy(); 2101 }; 2102 Slick.prototype.updateArrows = function() { 2103 var _ = this, 2104 centerOffset; 2105 centerOffset = Math.floor(_.options.slidesToShow / 2); 2106 if ( _.options.arrows === true && 2107 _.slideCount > _.options.slidesToShow && 2108 !_.options.infinite ) { 2109 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2110 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2111 if (_.currentSlide === 0) { 2112 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2113 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2114 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 2115 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2116 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2117 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 2118 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2119 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2120 } 2121 } 2122 }; 2123 Slick.prototype.updateDots = function() { 2124 var _ = this; 2125 if (_.$dots !== null) { 2126 _.$dots 2127 .find('li') 2128 .removeClass('slick-active') 2129 .end(); 2130 _.$dots 2131 .find('li') 2132 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 2133 .addClass('slick-active'); 2134 } 2135 }; 2136 Slick.prototype.visibility = function() { 2137 var _ = this; 2138 if ( _.options.autoplay ) { 2139 if ( document[_.hidden] ) { 2140 _.interrupted = true; 2141 } else { 2142 _.interrupted = false; 2143 } 2144 } 2145 }; 2146 $.fn.slick = function() { 2147 var _ = this, 2148 opt = arguments[0], 2149 args = Array.prototype.slice.call(arguments, 1), 2150 l = _.length, 2151 i, 2152 ret; 2153 for (i = 0; i < l; i++) { 2154 if (typeof opt == 'object' || typeof opt == 'undefined') 2155 _[i].slick = new Slick(_[i], opt); 2156 else 2157 ret = _[i].slick[opt].apply(_[i].slick, args); 2158 if (typeof ret != 'undefined') return ret; 2159 } 2160 return _; 2161 }; 2162}));
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.