PageSourceSearch

https://www.onwardaccessibility.com/wp-content/themes/understrap-child/js/accessible-slick.js?ver=20260424

js onwardaccessibility.com collected 2026-09-26 08:03:48 UTC 91,005 bytes, 3,037 lines download raw bytes

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

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.