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