PageSourceSearch

https://globalnews.ca/wp-content/themes/shaw-globalnews/js/lib/slick.js?m=1764345767g

js globalnews.ca collected 2026-09-24 06:40:52 UTC 62,216 bytes, 2,107 lines download raw bytes

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

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.