PageSourceSearch

https://www.magnumforce.com/assets/js/slick.js

js magnumforce.com collected 2026-10-09 23:09:45 UTC 35,540 bytes, 1,104 lines download raw bytes

1// Slick
2/*
3
4 slick.js
5
6 Author: Ken Wheeler
7 Date: 03/23/14
8 Version: 1.0
9
10 */
11
12/*global window, document, $, setInterval, clearInterval */
13
14var slick = window.slick || {};
15
16/************ Helpers ***********/
17
18// Function Binder
19
20var functionBinder = function(fn, me) {
21    'use strict';
22    return function() {
23        return fn.apply(me, arguments);
24    };
25};
26
27// Mobile Detect
28
29var mobileDetect = function() {
30    var check = false;
31    (function(a) {
32        if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4)))
33            check = true;
34    })(navigator.userAgent || navigator.vendor || window.opera);
35    return check;
36};
37
38// Helpers
39
40    function throttle(fn, threshhold, scope) {
41        threshhold || (threshhold = 250);
42        var last,
43            deferTimer;
44        return function() {
45            var context = scope || this;
46
47            var now = +new Date,
48                args = arguments;
49            if (last && now < last + threshhold) {
50                // hold on to it
51                clearTimeout(deferTimer);
52                deferTimer = setTimeout(function() {
53                    last = now;
54                    fn.apply(context, args);
55                }, threshhold);
56            } else {
57                last = now;
58                fn.apply(context, args);
59            }
60        };
61    }
62
63    /********** End Helpers *********/
64
65    slick.slider = (function() {
66        'use strict';
67
68        function slider(element, settings) {
69
70            this.defaults = {
71                autoplay: false,
72                autoplaySpeed: 3000,
73                dots: false,
74                draggable: true,
75                arrows: true,
76                infinite: true,
77                onBeforeChange: null,
78                onAfterChange: null,
79                responsive: null,
80                slide: 'div.multiple',
81                slidesToShow: 1,
82                slidesToScroll: 1,
83                speed: 300,
84                swipe: true,
85                touchMove: true,
86                touchThreshold: 5
87            };
88
89            this.activeBreakpoint = null;
90            this.animating = false;
91            this.animType = null;
92            this.autoPlayTimer = null;
93            this.breakpoints = [];
94            this.breakpointSettings = [];
95            this.currentSlide = 0;
96            this.currentLeft = null;
97            this.direction = 1;
98            this.dots = null;
99            this.listWidth = null;
100            this.loadIndex = 0;
101            this.nextArrow = null;
102            this.prevArrow = null;
103            this.slideCount = null;
104            this.slideWidth = null;
105            this.slideTrack = null;
106            this.slides = null;
107            this.sliding = false;
108            this.slideOffset = 0;
109            this.slider = $(element);
110            this.swipeLeft = null;
111            this.list = null;
112            this.touchObject = {};
113            this.transformsEnabled = false;
114
115            this.options = $.extend({}, this.defaults, settings);
116
117            this.originalSettings = this.options;
118            var responsiveSettings = this.options.responsive || null;
119
120            if(responsiveSettings && responsiveSettings.length > -1) {
121                for(var breakpoint in responsiveSettings) {
122                    this.breakpoints.push(responsiveSettings[breakpoint].breakpoint);
123                    this.breakpointSettings[responsiveSettings[breakpoint].breakpoint] = responsiveSettings[breakpoint].settings;
124                }
125                this.breakpoints.sort(function(a,b){return b-a});
126            }
127
128            this.changeSlide = functionBinder(this.changeSlide, this);
129            this.setPosition = functionBinder(this.setPosition, this);
130            this.swipeHandler = functionBinder(this.swipeHandler, this);
131            this.dragHandler = functionBinder(this.dragHandler, this);
132            this.autoPlayIterator = functionBinder(this.autoPlayIterator, this);
133
134            this.init();
135
136        }
137
138
139        slider.prototype.init = function() {
140
141            if (!$(this.slider).hasClass('slick-initialized')) {
142
143                $(this.slider).addClass('slick-initialized');
144                this.buildOut();
145                this.setValues();
146                this.getAnimType();
147                this.setPosition();
148                this.startLoad();
149                this.loadSlider();
150                this.initializeEvents();
151                this.checkResponsive();
152            }
153
154        };
155
156        slider.prototype.getAnimType = function() {
157
158            if (document.body.style.MozTransform !== undefined) {
159
160                this.animType = 'MozTransform';
161
162            } else if (document.body.style.webkitTransform !== undefined) {
163
164                this.animType = "webkitTransform";
165
166            } else if (document.body.style.msTransform !== undefined) {
167
168                this.animType = "msTransform";
169
170            }
171
172            if (this.animType !== null) {
173
174                this.transformsEnabled = true;
175
176            }
177
178        };
179
180        slider.prototype.autoPlay = function() {
181
182            if (this.autoPlayTimer) {
183
184                clearInterval(this.autoPlayTimer);
185
186            }
187
188            this.autoPlayTimer = setInterval(this.autoPlayIterator, this.options.autoplaySpeed);
189
190        };
191
192        slider.prototype.autoPlayIterator = function() {
193
194            if (this.options.infinite === false) {
195
196                if (this.direction === 1) {
197
198                    if ((this.currentSlide + 1) === this.slideCount - 1) {
199                        this.direction = 0;
200                    }
201
202                    this.slideHandler(this.currentSlide + this.options.slidesToScroll);
203
204                } else {
205
206                    if ((this.currentSlide - 1 === 0)) {
207
208                        this.direction = 1;
209
210                    }
211
212                    this.slideHandler(this.currentSlide - this.options.slidesToScroll);
213
214                }
215
216            } else {
217
218                this.slideHandler(this.currentSlide + this.options.slidesToScroll);
219
220            }
221
222        };
223
224        slider.prototype.checkResponsive = function() {
225
226            if(this.originalSettings.responsive && this.originalSettings.responsive.length > -1) {
227
228                var targetBreakpoint = null;
229
230                for(var breakpoint in this.breakpoints) {
231                    if($(window).width() < this.breakpoints[breakpoint]) {
232                        targetBreakpoint = this.breakpoints[breakpoint];
233                    }
234                }
235
236                if(targetBreakpoint !== null) {
237                    if(this.activeBreakpoint !== null) {
238                        if(targetBreakpoint !== this.activeBreakpoint) {
239                            this.activeBreakpoint = targetBreakpoint;
240                            this.options = $.extend({}
240, this.defaults, this.breakpointSettings[targetBreakpoint]);
241                            this.refresh();
242                        }
243                    } else {
244                        this.activeBreakpoint = targetBreakpoint;
245                        this.options = $.extend({}, this.defaults, this.breakpointSettings[targetBreakpoint]);
246                        this.refresh();
247                    }
248                } else {
249                    if(this.activeBreakpoint !== null) {
250                        this.activeBreakpoint = null;
251                        this.options = $.extend({}, this.defaults, this.originalSettings);
252                        this.refresh();
253                    }
254                }
255
256            }
257        };
258
259        slider.prototype.startLoad = function() {
260
261            if (this.options.arrows === true) {
262
263                this.prevArrow.hide();
264                this.nextArrow.hide();
265
266            }
267
268            if (this.options.dots === true) {
269
270                this.dots.hide();
271
272            }
273
274            this.slider.addClass('slick-loading');
275
276        };
277
278        slider.prototype.loadSlider = function() {
279
280            var self = this;
281
282            self.setPosition();
283
284            self.slideTrack.animate({
285                opacity: 1
286            }, this.options.speed, function() {
287                self.setPosition();
288            });
289
290            if(document.readyState !== "complete") {
291
292                $(window).load(function() {
293
294                    if (self.options.arrows === true) {
295
296                        self.prevArrow.show();
297                        self.nextArrow.show();
298
299                    }
300
301                    if (self.options.dots === true) {
302
303                        self.dots.show();
304
305                    }
306
307                    self.slider.removeClass('slick-loading');
308
309                    if (self.options.autoplay === true) {
310
311                        self.autoPlay();
312
313                    }
314
315                });
316
317            } else {
318
319                if (self.options.arrows === true) {
320
321                    self.prevArrow.show();
322                    self.nextArrow.show();
323
324                }
325
326                if (self.options.dots === true) {
327
328                    self.dots.show();
329
330                }
331
332                self.slider.removeClass('slick-loading');
333
334                if (self.options.autoplay === true) {
335
336                    self.autoPlay();
337
338                }
339
340            }
341
342        };
343
344        slider.prototype.setValues = function() {
345
346            this.listWidth = this.list.innerWidth();
347            this.slideWidth = Math.ceil(this.listWidth / this.options.slidesToShow);
348
349        };
350
351        slider.prototype.buildOut = function() {
352
353            var i;
354
355            this.slides = $(this.options.slide + ':not(.cloned)', this.slider).addClass('slide');
356            this.slideCount = this.slides.length;
357            if((this.slideCount % this.options.slidesToScroll) !== 0 && this.options.slidesToShow !== 1) {
358
359                var placeholders = Math.abs(this.options.slidesToScroll - (this.slideCount % this.options.slidesToScroll));
360                for(i=0; i<placeholders; i++) {
361                    $('<div/>').appendTo(this.slider).addClass('slide placeholder');
362                }
363                this.slides = $('.slide:not(.cloned)', this.slider);
364                this.slideCount = this.slides.length;
365
366            }
367
368            this.slider.addClass("slick-slider");
369            this.slideTrack = this.slides.wrapAll('<div class="slick-track"/>').parent();
370            this.list = this.slideTrack.wrap('<div class="slick-list"/>').parent();
371            this.slideTrack.css('opacity', 0);
372
373            if (this.options.arrows === true) {
374
375                this.prevArrow = $('<a href="javascript:void(0)">Previous</a>').appendTo(this.slider).addClass('slick-prev');
376                this.nextArrow = $('<a href="javascript:void(0)">Next</a>').appendTo(this.slider).addClass('slick-next');
377
378                if (this.options.infinite !== true) {
379                    this.prevArrow.addClass('disabled');
380                }
381
382            }
383
384            if (this.options.dots === true) {
385
386                this.dots = $('<ul class="slick-dots"></ul>').appendTo(this.slider);
387
388                for (i = 1; i <= this.slideCount; i += 1) {
389
390                    $('<li><a href="javascript:void(0)">' + i + '</a></li>').appendTo(this.dots);
391
392                }
393
394                if(this.options.slidesToScroll > 1) {
395                    this.dots.find('li').hide();
396                    var i = 0;
397                    while(i < this.slideCount) {
398                        $(this.dots.find('li').get(i)).show();
399                        i = i + this.options.slidesToScroll;
400                    }
401                }
402
403                this.dots.find('li').first().addClass('active');
404
405            }
406
407            if (this.options.draggable == true) {
408                this.list.addClass('draggable');
409            }
410
411            if (this.options.infinite === true) {
412
413                var slideIndex = null;
414
415                for(i=this.slideCount; i>(this.slideCount - this.options.slidesToShow); i--) {
416                    slideIndex = i -1;
417                    $(this.slides[slideIndex]).clone().prependTo(this.slideTrack).addClass('cloned');
418                }
419                for(i=0; i<this.options.slidesToShow; i++) {
420                    slideIndex = i;
421                    $(this.slides[slideIndex]).clone().appendTo(this.slideTrack).addClass('cloned');
422                }
423
424            }
425
426        };
427
428        slider.prototype.setDimensions = function() {
429            this.slideWidth = Math.ceil(this.listWidth / this.options.slidesToShow);
430            this.list.find('.slide').width(this.slideWidth);
431            this.slideTrack.width(Math.ceil((this.slideWidth * this.slider.find('.slide').length)));
432        };
433
434        slider.prototype.setPosition = function() {
435
436            this.setValues();
437            this.setDimensions();
438
439            if (this.options.infinite === true) {
440                this.slideOffset = (this.slideWidth * this.options.slidesToShow) * -1;
441            }
442
443            var animProps = {}, targetLeft = ((this.currentSlide * this.slideWidth) * -1) + this.slideOffset;
444
445            if (this.transformsEnabled === false) {
446                this.slideTrack.css('left', targetLeft);
447            } else {
448                animProps[this.animType] = "translate(" + targetLeft + "px, 0px)";
449                this.slideTrack.css(animProps);
450            }
451
452        };
453
454        slider.prototype.initializeEvents = function() {
455
456            var self = this;
457
458            if (this.options.arrows === true) {
459
460                this.prevArrow.on('click', {
461                    message: 'previous'
462                }, this.changeSlide);
463                this.nextArrow.on('click', {
464                    message: 'next'
465                }, this.changeSlide);
466
467            }
468
469            if (this.options.dots === true) {
470
471                $('li a', this.dots).on('click', {
472                    message: 'index'
473                }, this.changeSlide);
474
475            }
476
477            if (this.options.swipe === true) {
478
479                this.list.on('touchstart', {
480                    action: 'start'
481                }, throttle(this.swipeHandler, 20));
482
483                this.list.on('touchmove', {
484                    action: 'move'
485                }, throttle(this.swipeHandler, 20));
486
487                this.list.on('touchend', {
488                    action: 'end'
489                }, throttle(this.swipeHandler, 20));
490
491            }
492
493            if (this.options.draggable === true) {
494                this.list.on('mousedown', {action: 'start'}, this.dragHandler);
495                this.list.on('mousemove', {action: 'move'}, this.dragHandler);
496                this.list.on('mouseup', {action: 'end'}, this.dragHandler);
497                this.list.on('mouseout', {action: 'cancel'}, this.dragHandler);
498            }
499
500            $(window).on('orientationchange', this.setPosition);
501
502            $(window).on('resize', function(){
503                self.checkResponsive();
504                self.setPosition();
505            });
506
507            $(window).on('load', this.setPosition);
508
509        };
510
511        slider.prototype.changeSlide = function(event) {
512
513            var self = this;
514
515            switch (event.data.message) {
516
517                case 'previous':
518                    if(this.animating == false) {
519                        self.slideHandler(self.currentSlide - self.options.slidesToScroll);
520                    } else {
521                        return false;
522                    }
523                    break;
524
525                case 'next':
526                    if(self.animating == false) {
527                        self.slideHandler(self.currentSlide + self.options.slidesToScroll);
528                    } else {
529                        return false;
530                    }
531                    break;
532
533                case 'index':
534                    if(self.animating == false) {
535                        self.slideHandler($(event.target).parent().index());
536                    } else {
537                        return false;
538                    }
539                    break;
540
541                default:
542                    return false;
543            }
544
545        };
546
547        slider.prototype.updateDots = function() {
548
549            this.dots.find('li').removeClass('active');
550            $(this.dots.find('li').get(this.currentSlide)).addClass('active');
551
552        };
553
554        slider.prototype.animateSlide = function(targetLeft, callback) {
555
556            var animProps = {}, self = this;
557
558            if(this.options.onBeforeChange !== null) {
559                this.options.onBeforeChange.call();
560            }
561
562            if (this.transformsEnabled === false) {
563
564                this.slideTrack.animate({
565                    left: targetLeft
566                }, self.options.speed, callback);
567
568            } else {
569
570                $({
571                    animStart: this.currentLeft
572                }).animate({
573                    animStart: targetLeft
574                }, {
575                    duration: self.options.speed,
576                    step: function(now) {
577                        animProps[self.animType] = "translate(" + now + "px, 0px)";
578                        self.slideTrack.css(animProps);
579                    },
580                    complete: function() {
581                        if(callback) {
582                            callback.call();
583                        }
584                    }
585                });
586
587            }
588
589        }
590
591        slider.prototype.slideHandler = function(index) {
592
593            var animProps = {}, targetSlide, slideLeft, targetLeft = null,
594                self = this;
595
596            targetSlide = index;
597            targetLeft = ((targetSlide * this.slideWidth) * -1) + this.slideOffset;
598            slideLeft = ((this.currentSlide * this.slideWidth) * -1) + this.slideOffset;
599
600            if (self.options.autoplay === true) {
601                clearInterval(this.autoPlayTimer);
602            }
603
604            if (this.swipeLeft === null) {
605                this.currentLeft = slideLeft;
606            } else {
607                this.currentLeft = this.swipeLeft;
608            }
609
610            if (targetSlide < 0) {
611
612                if (this.options.infinite === true) {
613
614                    this.animating = true;
615
616                    this.animateSlide(targetLeft, function(){
617
618                        self.animating = false;
619
620                        self.currentSlide = self.slideCount - self.options.slidesToScroll;
621
622                        self.setPosition();
623
624                        if (self.swipeLeft !== null) {
625                            self.swipeLeft = null;
626                        }
627
628                        if (self.options.dots) {
629                            self.updateDots();
630                        }
631
632                        if (self.options.autoplay === true) {
633                            self.autoPlay();
634                        }
635
636                        if(self.options.onAfterChange !== null) {
637                            self.options.onAfterChange.call();
638                        }
639
640                        self.slides.removeClass('active');
641                        $(self.slides.get(targetSlide)).addClass('active');
642
643                    });
644
645                } else {
646
647                    this.animateSlide(slideLeft);
648
649                    return false;
650
651                }
652
653            } else if (targetSlide > (this.slideCount - 1)) {
654
655                if (this.options.infinite === true) {
656
657                    this.animating = true;
658
659                    this.animateSlide(targetLeft, function(){
660
661                        self.animating = false;
662
663                        self.currentSlide = 0;
664
665                        self.setPosition();
666
667                        if (self.swipeLeft !== null) {
668                            self.swipeLeft = null;
669                        }
670
671                        if (self.options.dots) {
672                            self.updateDots();
673                        }
674
675                        if (self.options.autoplay === true) {
676                            self.autoPlay();
677                        }
678
679                        if(self.options.onAfterChange !== null) {
680                            self.options.onAfterChange.call();
681                        }
682
683                        self.slides.removeClass('active');
684                        $(self.slides.get(targetSlide)).addClass('active');
685
686                    });
687
688                } else {
689
690                    this.animateSlide(slideLeft);
691
692                    return false;
693
694                }
695
696            } else {
697
698                this.animating = true;
699
700                this.animateSlide(targetLeft, function(){
701
702                    self.animating = false;
703
704                    self.currentSlide = targetSlide;
705
706                    self.setPosition();
707
708                    if (self.swipeLeft !== null) {
709                        self.swipeLeft = null;
710                    }
711
712                    if (self.options.dots) {
713                        self.updateDots();
714                    }
715
716                    if (self.options.autoplay === true) {
717                        self.autoPlay();
718                    }
719
720                    if(self.options.onAfterChange !== null) {
721                        self.options.onAfterChange.call();
722                    }
723
724                    self.slides.removeClass('active');
725                    $(self.slides.get(targetSlide)).addClass('active');
726
727                    if (self.options.arrows === true && self.options.infinite !== true) {
728                        if (self.currentSlide === 0) {
729                            self.prevArrow.addClass('disabled');
730                            self.nextArrow.removeClass('disabled');
731                        } else if (self.currentSlide >= (self.slideCount / self.options.slidesToScroll * self.options.slidesToShow) - self.options.slidesToScroll) {
732                            self.nextArrow.addClass('disabled');
733                            self.prevArrow.removeClass('disabled');
734                        } else {
735                            self.prevArrow.removeClass('disabled');
736                            self.nextArrow.removeClass('disabled');
737                        }
738                    }
739
740                });
741
742            }
743
744        };
745
746        slider.prototype.dragHandler = function(event) {
747
748            var animProps = {}, curLeft, newLeft = null;
749
750            curLeft = ((this.currentSlide * this.slideWidth) * -1) + this.slideOffset;
751
752            this.touchObject.minSwipe = this.slideWidth / this.options.touchThreshold;
753
754            switch (event.data.action) {
755
756                case 'start':
757
758
759                    this.list.addClass('dragging');
760
761                    this.touchObject.startX = event.clientX;
762                    this.touchObject.startY = event.clientY;
763                    this.touchObject.curX = event.clientX;
764                    this.touchObject.curY = event.clientY;
765
766                    break;
767
768                case 'move':
769
770                    this.touchObject.curX = event.clientX;
771                    this.touchObject.curY = event.clientY;
772
773                    this.touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(this.touchObject.curX - this.touchObject.startX, 2)));
774
775                    if (this.swipeDirection() !== 'up' && this.swipeDirection() !== 'down') {
776
777                        event.originalEvent.preventDefault();
778
779                        if (this.touchObject.curX > this.touchObject.startX) {
780
781                            if(this.options.touchMove == true) {
782
783                                newLeft = curLeft + this.touchObject.swipeLength;
784                                if (this.transformsEnabled === false) {
785                                    this.slideTrack.css('left', newLeft);
786                                } else {
787                                    animProps[this.animType] = "translate(" + newLeft + "px, 0px)";
788                                    this.slideTrack.css(animProps);
789                                    this.swipeLeft = newLeft;
790                                }
791
792                            }
793
794                        } else {
795
796                            if(this.options.touchMove == true) {
797
798                                newLeft = curLeft - this.touchObject.swipeLength;
799                                if (this.transformsEnabled === false) {
800                                    this.slideTrack.css('left', newLeft);
801                                } else {
802                                    animProps[this.animType] = "translate(" + newLeft + "px, 0px)";
803                                    this.slideTrack.css(animProps);
804                                    this.swipeLeft = newLeft;
805                                }
806
807                            }
808
809                        }
810
811                    }
812
813                    break;
814
815                case 'end':
816
817                    this.list.removeClass('dragging');
818
819                    if (this.touchObject.curX !== 0) {
820
821                        if (this.touchObject.swipeLength >= this.touchObject.minSwipe) {
822
823                            switch (this.swipeDirection()) {
824
825                                case 'left':
826
827                                    this.slideHandler(this.currentSlide + this.options.slidesToScroll);
828                                    this.touchObject = {};
829
830                                    break;
831
832                                case 'right':
833
834                                    this.slideHandler(this.currentSlide - this.options.slidesToScroll);
835                                    this.touchObject = {};
836
837                                    break;
838
839                            }
840
841                        } else {
842
843                            this.slideHandler(this.currentSlide);
844                            this.touchObject = {};
845
846                        }
847
848                    } else {
849
850                        this.touchObject = {};
851
852                    }
853
854                    break;
855
856                case 'cancel':
857
858                    this.list.removeClass('dragging');
859
860                    if(this.touchObject.startX) {
861                        this.slideHandler(this.currentSlide);
862                        this.touchObject = {};
863                    }
864
865                    break;
866
867            }
868
869        }
870
871        slider.prototype.swipeHandler = function(event) {
872
873            var animProps = {}, curLeft, newLeft = null;
874
875            curLeft = ((this.currentSlide * this.slideWidth) * -1) + this.slideOffset;
876
877            this.touchObject.fingerCount = event.originalEvent.touches.length;
878
879            this.touchObject.minSwipe = this.slideWidth / this.options.touchThreshold;
880
881            switch (event.data.action) {
882
883                case 'start':
884
885                    if (this.touchObject.fingerCount === 1) {
886
887                        this.touchObject.startX = event.originalEvent.touches[0].pageX;
888                        this.touchObject.startY = event.originalEvent.touches[0].pageY;
889                        this.touchObject.curX = event.originalEvent.touches[0].pageX;
890                        this.touchObject.curY = event.originalEvent.touches[0].pageY;
891
892                    } else {
893
894                        this.touchObject = {};
895
896                    }
897
898                    break;
899
900                case 'move':
901
902                    if (event.originalEvent.touches.length === 1) {
903
904                        this.touchObject.curX = event.originalEvent.touches[0].pageX;
905                        this.touchObject.curY = event.originalEvent.touches[0].pageY;
906
907                        this.touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(this.touchObject.curX - this.touchObject.startX, 2)));
908
909                        if (this.swipeDirection() !== 'up' && this.swipeDirection() !== 'down') {
910
911                            event.originalEvent.preventDefault();
912
913                            if (this.touchObject.curX > this.touchObject.startX) {
914
915                                if(this.options.touchMove == true) {
916
917                                    newLeft = curLeft + this.touchObject.swipeLength;
918                                    if (this.transformsEnabled === false) {
919                                        this.slideTrack.css('left', newLeft);
920                                    } else {
921                                        animProps[this.animType] = "translate(" + newLeft + "px, 0px)";
922                                        this.slideTrack.css(animProps);
923                                        this.swipeLeft = newLeft;
924                                    }
925
926                                }
927
928                            } else {
929
930                                if(this.options.touchMove == true) {
931
932                                    newLeft = curLeft - this.touchObject.swipeLength;
933                                    if (this.transformsEnabled === false) {
934                                        this.slideTrack.css('left', newLeft);
935                                    } else {
936                                        animProps[this.animType] = "translate(" + newLeft + "px, 0px)";
937                                        this.slideTrack.css(animProps);
938                                        this.swipeLeft = newLeft;
939                                    }
940
941                                }
942
943                            }
944
945                        }
946
947                    } else {
948
949                        this.touchObject = {};
950
951                    }
952
953                    break;
954
955                case 'end':
956
957                    if (this.touchObject.fingerCount === 0 && this.touchObject.curX !== 0) {
958
959                        if (this.touchObject.swipeLength >= this.touchObject.minSwipe) {
960
961                            switch (this.swipeDirection()) {
962
963                                case 'left':
964
965                                    this.slideHandler(this.currentSlide + this.options.slidesToScroll);
966                                    this.touchObject = {};
967
968                                    break;
969
970                                case 'right':
971
972                                    this.slideHandler(this.currentSlide - this.options.slidesToScroll);
973                                    this.touchObject = {};
974
975                                    break;
976
977                            }
978
979                        } else {
980
981                            this.slideHandler(this.currentSlide);
982                            this.touchObject = {};
983
984                        }
985
986                    } else {
987
988                        this.touchObject = {};
989
990                    }
991
992                    break;
993
994                case 'cancel':
995
996                    break;
997
998            }
999
1000        };
1001
1002        slider.prototype.swipeDirection = function() {
1003
1004            var xDist, yDist, r, swipeAngle;
1005
1006            xDist = this.touchObject.startX - this.touchObject.curX;
1007            yDist = this.touchObject.startY - this.touchObject.curY;
1008            r = Math.atan2(yDist, xDist);
1009
1010            swipeAngle = Math.round(r * 180 / Math.PI);
1011            if (swipeAngle < 0) {
1012                swipeAngle = 360 - Math.abs(swipeAngle);
1013            }
1014
1015            if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
1016                return 'left';
1017            } else if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
1018                return 'left';
1019            } else if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
1020                return 'right';
1021            } else if ((swipeAngle > 45) && (swipeAngle < 135)) {
1022                return 'down';
1023            } else {
1024                return 'up';
1025            }
1026
1027        };
1028
1029        slider.prototype.refresh = function() {
1030
1031            this.destroy();
1032            this.autoPlayTimer = null;
1033            this.currentSlide = 0;
1034            this.currentLeft = null;
1035            this.direction = 1;
1036            this.dots = null;
1037            this.listWidth = null;
1038            this.loadIndex = 0;
1039            this.nextArrow = null;
1040            this.prevArrow = null;
1041            this.slideCount = null;
1042            this.slideWidth = null;
1043            this.slideTrack = null;
1044            this.slides = null;
1045            this.sliding = false;
1046            this.slideOffset = 0;
1047            this.swipeLeft = null;
1048            this.list = null;
1049            this.touchObject = {};
1050            this.transformsEnabled = false;
1051
1052            if (!$(this.slider).hasClass('slick-initialized')) {
1053
1054                $(this.slider).addClass('slick-initialized');
1055                this.buildOut();
1056                this.setValues();
1057                this.getAnimType();
1058                this.setPosition();
1059                this.startLoad();
1060                this.loadSlider();
1061                this.initializeEvents();
1062
1063            }
1064
1065        }
1066
1067        slider.prototype.destroy = function() {
1068            $('.cloned', this.slider).remove();
1069            $('.placeholder', this.slider).remove();
1070            if(this.dots) {
1071                this.dots.remove();
1072            }
1073            if(this.prevArrow) {
1074                this.prevArrow.remove();
1075                this.nextArrow.remove();
1076            }
1077            this.slides.unwrap().unwrap();
1078            this.slides.removeClass('slide').width('');
1079            this.slider.removeClass('slick-slider');
1080            this.slider.removeClass('slick-initialized');
1081        }
1082
1083        return slider;
1084
1085    }());
1086
1087$.fn.slick = function(options) {
1088
1089    'use strict';
1090
1091    return this.each(function(index) {
1092
1093        this.slider = new slick.slider(this, options);
1094
1095    });
1096}
1097
1098$.fn.unslick = function(){
1099    return this.each(function(index) {
1100
1101        this.slider.destroy();
1102
1103    });
1104}

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.