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