PageSourceSearch

https://sierradonor.org/wp-content/themes/donor%20services/assets/js/slick.js

js sierradonor.org collected 2026-09-29 06:43:42 UTC 91,059 bytes, 3,038 lines download raw bytes

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

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.