slick_rails 1.2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4f2f4d5f8fe5ad7255a946c3cc36d6ff9027bd0f
4
+ data.tar.gz: 064cc666b9349f3fec6b0b92e85061d9b3a16fbc
5
+ SHA512:
6
+ metadata.gz: 55de4756b117d8308bdafa1731374b4893260968932c8a7b566fb8dcbac38c068798d167c44c3fd05e8b8418acbf0e410684b3c5e5d6dbb655d34d285fb4dcf2
7
+ data.tar.gz: b8f7d44838d166cbc6f777c0e71f74d88d5a158cdd22a058a7394ee41dec0e26dd9c5e955853cbfcb87644d5039ee8f579d587cde808fb9d13e61e82f0501e26
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in slick_rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Guy Israeli
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # SlickRails
2
+
3
+ Slick Carousel for Rails 3.1+ asset pipeline
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ gem 'slick_rails'
9
+
10
+ And then execute:
11
+
12
+ $ bundle
13
+
14
+ Or install it yourself as:
15
+
16
+ $ gem install slick_rails
17
+
18
+ ## Usage
19
+
20
+ add to js manifests
21
+
22
+ //= require slick
23
+
24
+ and to css manifest
25
+
26
+ *= require slick
27
+
28
+ Note: This plugin has custom fonts for dots and arrows and such. These are provided in /fonts (from the original repo) and are referred in the css.
29
+
30
+ If you want them make sure the asset pipeline will handle them with something like
31
+
32
+ config.assets.precompile += %w( .js .css *.css.scss .svg .eot .woff .ttf)
33
+
34
+ if you don't want them - ignore what I just wrote, and overwrite
35
+ .slick-prev:before
36
+ .slick-next:before
37
+ .slick-dots li a:before
38
+
39
+
40
+
41
+ see instruction and full info in https://github.com/kenwheeler/slick
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it ( http://github.com/<my-github-username>/slick_rails/fork )
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/app/.DS_Store ADDED
Binary file
Binary file
Binary file
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Generated by Fontastic.me</metadata>
5
+ <defs>
6
+ <font id="slick" horiz-adv-x="512">
7
+ <font-face font-family="slick" units-per-em="512" ascent="480" descent="-32"/>
8
+ <missing-glyph horiz-adv-x="512" />
9
+
10
+ <glyph unicode="&#34196;" d="M241 113l130 130c4 4 6 8 6 13 0 5-2 9-6 13l-130 130c-3 3-7 5-12 5-5 0-10-2-13-5l-29-30c-4-3-6-7-6-12 0-5 2-10 6-13l87-88-87-88c-4-3-6-8-6-13 0-5 2-9 6-12l29-30c3-3 8-5 13-5 5 0 9 2 12 5z m234 143c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
11
+ <glyph unicode="&#34194;" d="M296 113l29 30c4 3 6 7 6 12 0 5-2 10-6 13l-87 88 87 88c4 3 6 8 6 13 0 5-2 9-6 12l-29 30c-3 3-8 5-13 5-5 0-9-2-12-5l-130-130c-4-4-6-8-6-13 0-5 2-9 6-13l130-130c3-3 7-5 12-5 5 0 10 2 13 5z m179 143c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
12
+ <glyph unicode="&#33318;" d="M475 256c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
13
+ </font></defs></svg>
Binary file
Binary file
@@ -0,0 +1,1147 @@
1
+ /*
2
+ slick.js
3
+ Author: Ken Wheeler
4
+ Date: 03/23/14
5
+ */
6
+ /*global window, document, define, jQuery, setInterval, clearInterval */
7
+ (function (factory) {
8
+ 'use strict';
9
+ if (typeof define === 'function' && define.amd) {
10
+ define(['jquery'], factory);
11
+ } else {
12
+ factory(jQuery);
13
+ }
14
+
15
+ }(function ($) {
16
+ 'use strict';
17
+ var Slick = window.Slick || {}, functionBinder;
18
+
19
+ /************ Helpers ***********/
20
+
21
+ // Function Binder
22
+
23
+ functionBinder = function (fn, me) {
24
+ return function () {
25
+ return fn.apply(me, arguments);
26
+ };
27
+ };
28
+
29
+ /********** End Helpers *********/
30
+
31
+ Slick = (function () {
32
+
33
+ function Slick(element, settings) {
34
+
35
+ var _ = this, responsiveSettings, breakpoint;
36
+
37
+ _.defaults = {
38
+ autoplay: false,
39
+ autoplaySpeed: 3000,
40
+ dots: false,
41
+ draggable: true,
42
+ arrows: true,
43
+ infinite: true,
44
+ onBeforeChange: null,
45
+ onAfterChange: null,
46
+ pauseOnHover: true,
47
+ responsive: null,
48
+ slide: 'div',
49
+ slidesToShow: 1,
50
+ slidesToScroll: 1,
51
+ speed: 300,
52
+ swipe: true,
53
+ touchMove: true,
54
+ touchThreshold: 5
55
+ };
56
+
57
+ _.initials = {
58
+ animating : false,
59
+ autoPlayTimer : null,
60
+ currentSlide : 0,
61
+ currentLeft : null,
62
+ direction : 1,
63
+ dots : null,
64
+ listWidth : null,
65
+ loadIndex : 0,
66
+ nextArrow : null,
67
+ prevArrow : null,
68
+ slideCount : null,
69
+ slideWidth : null,
70
+ slideTrack : null,
71
+ slides : null,
72
+ sliding : false,
73
+ slideOffset : 0,
74
+ swipeLeft : null,
75
+ list : null,
76
+ touchObject : {},
77
+ transformsEnabled : false
78
+ };
79
+
80
+ $.extend(_, _.initials);
81
+
82
+ _.activeBreakpoint = null;
83
+ _.animType = null;
84
+ _.breakpoints = [];
85
+ _.breakpointSettings = [];
86
+ _.slider = $(element);
87
+
88
+ _.options = $.extend({}, _.defaults, settings);
89
+
90
+ _.originalSettings = _.options;
91
+ responsiveSettings = _.options.responsive ||
92
+ null;
93
+
94
+ if (responsiveSettings && responsiveSettings.length > -1) {
95
+ for (breakpoint in responsiveSettings) {
96
+ if (responsiveSettings.hasOwnProperty(breakpoint)) {
97
+ _.breakpoints.push(responsiveSettings[
98
+ breakpoint].breakpoint);
99
+ _.breakpointSettings[responsiveSettings[
100
+ breakpoint].breakpoint] =
101
+ responsiveSettings[breakpoint].settings;
102
+ }
103
+ }
104
+ _.breakpoints.sort(function (a, b) {
105
+ return b - a;
106
+ });
107
+ }
108
+
109
+ _.autoPlay = functionBinder(_.autoPlay,
110
+ _);
111
+ _.autoPlayClear = functionBinder(_.autoPlayClear,
112
+ _);
113
+ _.changeSlide = functionBinder(_.changeSlide,
114
+ _);
115
+ _.setPosition = functionBinder(_.setPosition,
116
+ _);
117
+ _.swipeHandler = functionBinder(_.swipeHandler,
118
+ _);
119
+ _.dragHandler = functionBinder(_.dragHandler,
120
+ _);
121
+ _.autoPlayIterator = functionBinder(_.autoPlayIterator,
122
+ _);
123
+
124
+ _.init();
125
+
126
+ }
127
+
128
+ return Slick;
129
+
130
+ }());
131
+
132
+ Slick.prototype.init = function () {
133
+
134
+ var _ = this;
135
+
136
+ if (!$(_.slider).hasClass('slick-initialized')) {
137
+
138
+ $(_.slider).addClass('slick-initialized');
139
+ _.buildOut();
140
+ _.getAnimType();
141
+ _.startLoad();
142
+ _.loadSlider();
143
+ _.initializeEvents();
144
+ _.checkResponsive();
145
+ }
146
+
147
+ };
148
+
149
+ Slick.prototype.getAnimType = function () {
150
+
151
+ var _ = this;
152
+
153
+ if (document.body.style.MozTransform !== undefined) {
154
+
155
+ _.animType = 'MozTransform';
156
+
157
+ } else if (document.body.style.webkitTransform !==
158
+ undefined) {
159
+
160
+ _.animType = "webkitTransform";
161
+
162
+ } else if (document.body.style.msTransform !==
163
+ undefined) {
164
+
165
+ _.animType = "msTransform";
166
+
167
+ }
168
+
169
+ if (_.animType !== null) {
170
+
171
+ _.transformsEnabled = true;
172
+
173
+ }
174
+
175
+ };
176
+
177
+ Slick.prototype.autoPlay = function () {
178
+
179
+ var _ = this;
180
+
181
+ if (_.autoPlayTimer) {
182
+
183
+ clearInterval(_.autoPlayTimer);
184
+
185
+ }
186
+
187
+ _.autoPlayTimer = setInterval(_.autoPlayIterator,
188
+ _.options.autoplaySpeed);
189
+
190
+ };
191
+
192
+ Slick.prototype.autoPlayClear = function () {
193
+
194
+ var _ = this;
195
+
196
+ if (_.autoPlayTimer) {
197
+ clearInterval(_.autoPlayTimer);
198
+ }
199
+
200
+ };
201
+
202
+ Slick.prototype.autoPlayIterator = function () {
203
+
204
+ var _ = this;
205
+
206
+ if (_.options.infinite === false) {
207
+
208
+ if (_.direction === 1) {
209
+
210
+ if ((_.currentSlide + 1) === _.slideCount -
211
+ 1) {
212
+ _.direction = 0;
213
+ }
214
+
215
+ _.slideHandler(_.currentSlide + _.options
216
+ .slidesToScroll);
217
+
218
+ } else {
219
+
220
+ if ((_.currentSlide - 1 === 0)) {
221
+
222
+ _.direction = 1;
223
+
224
+ }
225
+
226
+ _.slideHandler(_.currentSlide - _.options
227
+ .slidesToScroll);
228
+
229
+ }
230
+
231
+ } else {
232
+
233
+ _.slideHandler(_.currentSlide + _.options.slidesToScroll);
234
+
235
+ }
236
+
237
+ };
238
+
239
+ Slick.prototype.checkResponsive = function () {
240
+ var _ = this, breakpoint, targetBreakpoint;
241
+
242
+ if (_.originalSettings.responsive && _.originalSettings
243
+ .responsive.length > -1) {
244
+
245
+ targetBreakpoint = null;
246
+
247
+ for (breakpoint in _.breakpoints) {
248
+ if (_.breakpoints.hasOwnProperty(breakpoint)) {
249
+ if ($(window).width() < _.breakpoints[
250
+ breakpoint]) {
251
+ targetBreakpoint = _.breakpoints[
252
+ breakpoint];
253
+ }
254
+ }
255
+ }
256
+
257
+ if (targetBreakpoint !== null) {
258
+ if (_.activeBreakpoint !== null) {
259
+ if (targetBreakpoint !== _.activeBreakpoint) {
260
+ _.activeBreakpoint =
261
+ targetBreakpoint;
262
+ _.options = $.extend({}, _.defaults,
263
+ _.breakpointSettings[
264
+ targetBreakpoint]);
265
+ _.refresh();
266
+ }
267
+ } else {
268
+ _.activeBreakpoint = targetBreakpoint;
269
+ _.options = $.extend({}, _.defaults,
270
+ _.breakpointSettings[
271
+ targetBreakpoint]);
272
+ _.refresh();
273
+ }
274
+ } else {
275
+ if (_.activeBreakpoint !== null) {
276
+ _.activeBreakpoint = null;
277
+ _.options = $.extend({}, _.defaults,
278
+ _.originalSettings);
279
+ _.refresh();
280
+ }
281
+ }
282
+
283
+ }
284
+ };
285
+
286
+ Slick.prototype.startLoad = function () {
287
+
288
+ var _ = this;
289
+
290
+ if (_.options.arrows === true) {
291
+
292
+ _.prevArrow.hide();
293
+ _.nextArrow.hide();
294
+
295
+ }
296
+
297
+ if (_.options.dots === true) {
298
+
299
+ _.dots.hide();
300
+
301
+ }
302
+
303
+ _.slider.addClass('slick-loading');
304
+
305
+ };
306
+
307
+ Slick.prototype.initUI = function () {
308
+
309
+ var _ = this;
310
+
311
+ if (_.options.arrows === true) {
312
+
313
+ _.prevArrow.show();
314
+ _.nextArrow.show();
315
+
316
+ }
317
+
318
+ if (_.options.dots === true) {
319
+
320
+ _.dots.show();
321
+
322
+ }
323
+
324
+ if (_.options.autoplay === true) {
325
+
326
+ _.autoPlay();
327
+
328
+ }
329
+
330
+ };
331
+
332
+ Slick.prototype.loadSlider = function () {
333
+
334
+ var _ = this;
335
+
336
+ _.setPosition();
337
+
338
+ _.slideTrack.animate({
339
+ opacity: 1
340
+ }, _.options.speed, function () {
341
+ _.setPosition();
342
+ });
343
+
344
+ if (document.readyState !== "complete") {
345
+
346
+ $(window).load(function () {
347
+
348
+ _.slider.removeClass('slick-loading');
349
+
350
+ _.initUI();
351
+
352
+ });
353
+
354
+ } else {
355
+
356
+ _.slider.removeClass('slick-loading');
357
+
358
+ _.initUI();
359
+
360
+ }
361
+
362
+ };
363
+
364
+ Slick.prototype.setValues = function () {
365
+
366
+ var _ = this;
367
+
368
+ _.listWidth = _.list.width();
369
+ _.slideWidth = Math.ceil(_.listWidth / _.options
370
+ .slidesToShow);
371
+
372
+ };
373
+
374
+ Slick.prototype.buildArrows = function () {
375
+
376
+ var _ = this;
377
+
378
+ if (_.options.arrows === true) {
379
+
380
+ _.prevArrow = $(
381
+ '<a href="javascript:void(0)">Previous</a>').appendTo(
382
+ _.slider).addClass('slick-prev');
383
+ _.nextArrow = $(
384
+ '<a href="javascript:void(0)">Next</a>').appendTo(
385
+ _.slider).addClass('slick-next');
386
+
387
+ if (_.options.infinite !== true) {
388
+ _.prevArrow.addClass('slick-disabled');
389
+ }
390
+
391
+ }
392
+
393
+ };
394
+
395
+ Slick.prototype.buildDots = function () {
396
+
397
+ var _ = this, i, dotString;
398
+
399
+ if (_.options.dots === true) {
400
+
401
+ dotString = '<ul class="slick-dots">';
402
+
403
+ for (i = 1; i <= _.slideCount; i += 1) {
404
+
405
+ dotString += '<li><a href="javascript:void(0)">' + i +
406
+ '</a></li>';
407
+
408
+ }
409
+
410
+ dotString += "</ul>";
411
+
412
+ _.dots = $(dotString).appendTo(
413
+ _.slider);
414
+
415
+ if (_.options.slidesToScroll > 1) {
416
+ _.dots.find('li').hide();
417
+ i = 0;
418
+ while (i < _.slideCount) {
419
+ $(_.dots.find('li').get(i)).show();
420
+ i = i + _.options.slidesToScroll;
421
+ }
422
+ }
423
+
424
+ _.dots.find('li').first().addClass(
425
+ 'slick-active');
426
+
427
+ }
428
+
429
+ };
430
+
431
+ Slick.prototype.setupInfinite = function () {
432
+
433
+ var _ = this, i, slideIndex;
434
+
435
+ if (_.options.infinite === true) {
436
+
437
+ slideIndex = null;
438
+
439
+ for (i = _.slideCount; i > (_.slideCount -
440
+ _.options.slidesToShow); i -= 1) {
441
+ slideIndex = i - 1;
442
+ $(_.slides[slideIndex]).clone().prependTo(
443
+ _.slideTrack).addClass('slick-cloned');
444
+ }
445
+ for (i = 0; i < _.options.slidesToShow; i += 1) {
446
+ slideIndex = i;
447
+ $(_.slides[slideIndex]).clone().appendTo(
448
+ _.slideTrack).addClass('slick-cloned');
449
+ }
450
+
451
+ }
452
+
453
+ };
454
+
455
+ Slick.prototype.buildOut = function () {
456
+
457
+ var i, _ = this, placeholders;
458
+
459
+ _.slides = $(_.options.slide +
460
+ ':not(.slick-cloned)', _.slider).addClass(
461
+ 'slick-slide');
462
+ _.slideCount = _.slides.length;
463
+ if ((_.slideCount % _.options.slidesToScroll) !==
464
+ 0 && _.options.slidesToShow !== 1) {
465
+
466
+ placeholders = Math.abs(_.options.slidesToScroll -
467
+ (_.slideCount % _.options.slidesToScroll)
468
+ );
469
+ for (i = 0; i < placeholders; i += 1) {
470
+ $('<div/>').appendTo(_.slider).addClass(
471
+ 'slick-slide slick-placeholder');
472
+ }
473
+ _.slides = $('.slick-slide:not(.slick-cloned)',
474
+ _.slider);
475
+ _.slideCount = _.slides.length;
476
+
477
+ }
478
+
479
+ _.slider.addClass("slick-slider");
480
+ _.slideTrack = _.slides.wrapAll(
481
+ '<div class="slick-track"/>').parent();
482
+ _.list = _.slideTrack.wrap(
483
+ '<div class="slick-list"/>').parent();
484
+ _.slideTrack.css('opacity', 0);
485
+
486
+ _.buildArrows();
487
+
488
+ _.buildDots();
489
+
490
+ _.setupInfinite();
491
+
492
+ _.setSlideClasses(0);
493
+
494
+ if (_.options.draggable === true) {
495
+ _.list.addClass('draggable');
496
+ }
497
+
498
+ };
499
+
500
+ Slick.prototype.setDimensions = function () {
501
+ var _ = this;
502
+ _.slideWidth = Math.ceil(_.listWidth / _.options
503
+ .slidesToShow);
504
+ _.list.find('.slick-slide').width(_.slideWidth);
505
+ _.slideTrack.width(Math.ceil((_.slideWidth * _
506
+ .slider.find('.slick-slide').length)));
507
+ };
508
+
509
+ Slick.prototype.setPosition = function () {
510
+ var _ = this, animProps = {}, targetLeft;
511
+ _.setValues();
512
+ _.setDimensions();
513
+
514
+ if (_.options.infinite === true) {
515
+ _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
516
+ }
517
+
518
+ targetLeft = ((_.currentSlide *
519
+ _.slideWidth) * -1) + _.slideOffset;
520
+
521
+ if (_.transformsEnabled === false) {
522
+ _.slideTrack.css('left', targetLeft);
523
+ } else {
524
+ animProps[_.animType] = "translate(" +
525
+ targetLeft + "px, 0px)";
526
+ _.slideTrack.css(animProps);
527
+ }
528
+
529
+ };
530
+
531
+ Slick.prototype.initializeEvents = function () {
532
+
533
+ var _ = this;
534
+
535
+ if (_.options.arrows === true) {
536
+ _.prevArrow.on('click.slick', {
537
+ message: 'previous'
538
+ }, _.changeSlide);
539
+ _.nextArrow.on('click.slick', {
540
+ message: 'next'
541
+ }, _.changeSlide);
542
+ }
543
+
544
+ if (_.options.dots === true) {
545
+ $('li a', _.dots).on('click.slick', {
546
+ message: 'index'
547
+ }, _.changeSlide);
548
+ }
549
+
550
+ if (_.options.swipe === true) {
551
+ _.list.on('touchstart.slick', {
552
+ action: 'start',
553
+ kind: 'touch'
554
+ }, _.swipeHandler);
555
+ _.list.on('touchmove.slick', {
556
+ action: 'move',
557
+ kind: 'touch'
558
+ }, _.swipeHandler);
559
+ _.list.on('touchend.slick', {
560
+ action: 'end',
561
+ kind: 'touch'
562
+ }, _.swipeHandler);
563
+ }
564
+
565
+ if (_.options.draggable === true) {
566
+ _.list.on('mousedown.slick', {
567
+ action: 'start',
568
+ kind: 'drag'
569
+ }, _.swipeHandler);
570
+ _.list.on('mousemove.slick', {
571
+ action: 'move',
572
+ kind: 'drag'
573
+ }, _.swipeHandler);
574
+ _.list.on('mouseup.slick', {
575
+ action: 'end',
576
+ kind: 'drag'
577
+ }, _.swipeHandler);
578
+ _.list.on('mouseleave.slick', {
579
+ action: 'cancel',
580
+ kind: 'drag'
581
+ }, _.swipeHandler);
582
+ }
583
+
584
+ if (_.options.pauseOnHover === true && _.options.autoplay === true) {
585
+ _.list.on('mouseenter.slick', _.autoPlayClear);
586
+ _.list.on('mouseleave.slick', _.autoPlay);
587
+ }
588
+
589
+ $(window).on('orientationchange.slick', _.setPosition);
590
+
591
+ $(window).on('resize.slick', function () {
592
+ _.checkResponsive();
593
+ _.setPosition();
594
+ });
595
+
596
+ $(window).on('load.slick', _.setPosition);
597
+
598
+ };
599
+
600
+ Slick.prototype.changeSlide = function (event) {
601
+
602
+ var _ = this;
603
+
604
+ switch (event.data.message) {
605
+
606
+ case 'previous':
607
+ _.slideHandler(_.currentSlide - _.options
608
+ .slidesToScroll);
609
+ break;
610
+
611
+ case 'next':
612
+ _.slideHandler(_.currentSlide + _.options
613
+ .slidesToScroll);
614
+ break;
615
+
616
+ case 'index':
617
+ _.slideHandler($(event.target).parent().index());
618
+ break;
619
+
620
+ default:
621
+ return false;
622
+ }
623
+
624
+ };
625
+
626
+ Slick.prototype.updateDots = function () {
627
+
628
+ var _ = this;
629
+
630
+ if(_.dots !== null) {
631
+
632
+ _.dots.find('li').removeClass('slick-active');
633
+ $(_.dots.find('li').get(_.currentSlide)).addClass(
634
+ 'slick-active');
635
+
636
+ }
637
+
638
+ };
639
+
640
+ Slick.prototype.animateSlide = function (targetLeft,
641
+ callback) {
642
+
643
+ var animProps = {}, _ = this;
644
+
645
+ if (_.options.onBeforeChange !== null) {
646
+ _.options.onBeforeChange.call();
647
+ }
648
+
649
+ if (_.transformsEnabled === false) {
650
+
651
+ _.slideTrack.animate({
652
+ left: targetLeft
653
+ }, _.options.speed, callback);
654
+
655
+ } else {
656
+
657
+ $({
658
+ animStart: _.currentLeft
659
+ }).animate({
660
+ animStart: targetLeft
661
+ }, {
662
+ duration: _.options.speed,
663
+ step: function (now) {
664
+ animProps[_.animType] = "translate(" +
665
+ now + "px, 0px)";
666
+ _.slideTrack.css(animProps);
667
+ },
668
+ complete: function () {
669
+ if (callback) {
670
+ callback.call();
671
+ }
672
+ }
673
+ });
674
+
675
+ }
676
+
677
+ };
678
+
679
+ Slick.prototype.setSlideClasses = function (index) {
680
+ var _ = this;
681
+ _.slides.removeClass('slick-active');
682
+ $(_.slides.get(index)).addClass('slick-active');
683
+ };
684
+
685
+ Slick.prototype.postSlide = function (index) {
686
+
687
+ var _ = this;
688
+
689
+ _.animating = false;
690
+
691
+ _.currentSlide = index;
692
+
693
+ _.setPosition();
694
+
695
+ _.swipeLeft = null;
696
+
697
+ _.updateDots();
698
+
699
+ if (_.options.autoplay === true) {
700
+ _.autoPlay();
701
+ }
702
+
703
+ if (_.options.onAfterChange !== null) {
704
+ _.options.onAfterChange.call();
705
+ }
706
+
707
+ if (_.options.arrows === true && _.options.infinite !==
708
+ true) {
709
+ if (_.currentSlide === 0) {
710
+ _.prevArrow.addClass('slick-disabled');
711
+ _.nextArrow.removeClass('slick-disabled');
712
+ } else if (_.currentSlide >= (_.slideCount /
713
+ _.options.slidesToScroll * _.options.slidesToShow
714
+ ) - _.options.slidesToScroll) {
715
+ _.nextArrow.addClass('slick-disabled');
716
+ _.prevArrow.removeClass('slick-disabled');
717
+ } else {
718
+ _.prevArrow.removeClass('slick-disabled');
719
+ _.nextArrow.removeClass('slick-disabled');
720
+ }
721
+ }
722
+
723
+ _.setSlideClasses(_.currentSlide);
724
+
725
+ };
726
+
727
+ Slick.prototype.slideHandler = function (index) {
728
+
729
+ var targetSlide, slideLeft, targetLeft =
730
+ null,
731
+ _ = this;
732
+
733
+ if(_.animating === true) {
734
+ return false;
735
+ }
736
+
737
+ targetSlide = index;
738
+ targetLeft = ((targetSlide * _.slideWidth) * -1) +
739
+ _.slideOffset;
740
+ slideLeft = ((_.currentSlide * _.slideWidth) * -1) +
741
+ _.slideOffset;
742
+
743
+ if (_.options.autoplay === true) {
744
+ clearInterval(_.autoPlayTimer);
745
+ }
746
+
747
+ if (_.swipeLeft === null) {
748
+ _.currentLeft = slideLeft;
749
+ } else {
750
+ _.currentLeft = _.swipeLeft;
751
+ }
752
+
753
+ if (targetSlide < 0) {
754
+
755
+ if (_.options.infinite === true) {
756
+
757
+ _.animating = true;
758
+
759
+ _.animateSlide(targetLeft, function () {
760
+
761
+ _.postSlide(_.slideCount - _.options
762
+ .slidesToScroll);
763
+
764
+ });
765
+
766
+ } else {
767
+
768
+ _.animateSlide(slideLeft);
769
+
770
+ return false;
771
+
772
+ }
773
+
774
+ } else if (targetSlide > (_.slideCount - 1)) {
775
+
776
+ if (_.options.infinite === true) {
777
+
778
+ _.animating = true;
779
+
780
+ _.animateSlide(targetLeft, function () {
781
+
782
+ _.postSlide(0);
783
+
784
+ });
785
+
786
+ } else {
787
+
788
+ _.animateSlide(slideLeft);
789
+
790
+ return false;
791
+
792
+ }
793
+
794
+ } else {
795
+
796
+ _.animating = true;
797
+
798
+ _.animateSlide(targetLeft, function () {
799
+
800
+ _.postSlide(targetSlide);
801
+
802
+ });
803
+
804
+ }
805
+
806
+ };
807
+
808
+ Slick.prototype.swipeStart = function (event) {
809
+
810
+ var _ = this, touches;
811
+
812
+ touches = event.originalEvent.touches;
813
+
814
+ if (_.touchObject.fingerCount === 1 || event.data
815
+ .kind === 'drag') {
816
+
817
+ if (event.data.kind === 'touch') {
818
+ _.touchObject.startX = _.touchObject.
819
+ curX =touches[0].pageX;
820
+ _.touchObject.startY = _.touchObject.
821
+ curY =touches[0].pageY;
822
+ } else {
823
+ _.list.addClass('dragging');
824
+ _.touchObject.startX = _.touchObject.
825
+ curX = event.clientX;
826
+ _.touchObject.startY = _.touchObject.
827
+ curY = event.clientY;
828
+ }
829
+
830
+ } else {
831
+
832
+ _.touchObject = {};
833
+
834
+ }
835
+
836
+ };
837
+
838
+ Slick.prototype.swipeMove = function (event) {
839
+
840
+ var _ = this, animProps = {}, curLeft, newLeft = null, touches;
841
+
842
+ touches = event.originalEvent.touches;
843
+
844
+ curLeft = ((_.currentSlide * _.slideWidth) * -1) +
845
+ _.slideOffset;
846
+
847
+ if ((touches && touches.length === 1) || event.
848
+ data.kind ==='drag') {
849
+
850
+ if (event.data.kind === 'touch') {
851
+ _.touchObject.curX = touches[0].pageX;
852
+ _.touchObject.curY = touches[0].pageY;
853
+ } else {
854
+ _.touchObject.curX = event.clientX;
855
+ _.touchObject.curY = event.clientY;
856
+ }
857
+
858
+ _.touchObject.swipeLength = Math.round(Math.sqrt(
859
+ Math.pow(_.touchObject.curX - _.touchObject
860
+ .startX, 2)));
861
+
862
+ if (_.swipeDirection() !== 'up' && _.swipeDirection() !==
863
+ 'down') {
864
+
865
+ event.originalEvent.preventDefault();
866
+
867
+ if (_.touchObject.curX > _.touchObject
868
+ .startX) {
869
+
870
+ if (_.options.touchMove === true) {
871
+
872
+ newLeft = curLeft + _.touchObject
873
+ .swipeLength;
874
+ if (_.transformsEnabled ===
875
+ false) {
876
+ _.slideTrack.css('left',
877
+ newLeft);
878
+ } else {
879
+ animProps[_.animType] =
880
+ "translate(" + newLeft +
881
+ "px, 0px)";
882
+ _.slideTrack.css(animProps);
883
+ _.swipeLeft = newLeft;
884
+ }
885
+
886
+ }
887
+
888
+ } else {
889
+
890
+ if (_.options.touchMove === true) {
891
+
892
+ newLeft = curLeft - _.touchObject
893
+ .swipeLength;
894
+ if (_.transformsEnabled ===
895
+ false) {
896
+ _.slideTrack.css('left',
897
+ newLeft);
898
+ } else {
899
+ animProps[_.animType] =
900
+ "translate(" + newLeft +
901
+ "px, 0px)";
902
+ _.slideTrack.css(animProps);
903
+ _.swipeLeft = newLeft;
904
+ }
905
+
906
+ }
907
+
908
+ }
909
+
910
+ }
911
+
912
+ } else {
913
+
914
+ _.touchObject = {};
915
+
916
+ }
917
+
918
+ };
919
+
920
+ Slick.prototype.swipeEnd = function (event) {
921
+
922
+ var _ = this;
923
+
924
+ if ((_.touchObject.fingerCount === 0 && _.touchObject
925
+ .curX !== 0) || event.data.kind === 'drag') {
926
+
927
+ if (_.touchObject.swipeLength >= _.touchObject
928
+ .minSwipe) {
929
+
930
+ switch (_.swipeDirection()) {
931
+
932
+ case 'left':
933
+
934
+ _.slideHandler(_.currentSlide +
935
+ _.options.slidesToScroll);
936
+ _.touchObject = {};
937
+
938
+ break;
939
+
940
+ case 'right':
941
+
942
+ _.slideHandler(_.currentSlide -
943
+ _.options.slidesToScroll);
944
+ _.touchObject = {};
945
+
946
+ break;
947
+
948
+ }
949
+
950
+ } else {
951
+
952
+ _.slideHandler(_.currentSlide);
953
+ _.touchObject = {};
954
+
955
+ }
956
+
957
+ if (event.data.kind === 'drag') {
958
+ _.list.removeClass('dragging');
959
+ }
960
+
961
+ } else {
962
+
963
+ _.touchObject = {};
964
+
965
+ }
966
+
967
+ };
968
+
969
+ Slick.prototype.swipeCancel = function () {
970
+
971
+ var _ = this;
972
+
973
+ _.list.removeClass('dragging');
974
+
975
+ if (_.touchObject.startX) {
976
+ _.slideHandler(_.currentSlide);
977
+ _.touchObject = {};
978
+ }
979
+
980
+ };
981
+
982
+ Slick.prototype.swipeHandler = function (event) {
983
+
984
+ var _ = this;
985
+
986
+ if (event.data.kind === 'touch') {
987
+ _.touchObject.fingerCount = event.originalEvent.touches
988
+ .length;
989
+ }
990
+
991
+ _.touchObject.minSwipe = _.slideWidth / _.options
992
+ .touchThreshold;
993
+
994
+ switch (event.data.action) {
995
+
996
+ case 'start':
997
+
998
+ _.swipeStart(event);
999
+
1000
+ break;
1001
+
1002
+ case 'move':
1003
+
1004
+ _.swipeMove(event);
1005
+
1006
+ break;
1007
+
1008
+ case 'end':
1009
+
1010
+ _.swipeEnd(event);
1011
+
1012
+ break;
1013
+
1014
+ case 'cancel':
1015
+
1016
+ _.swipeCancel();
1017
+
1018
+ break;
1019
+
1020
+ }
1021
+
1022
+ };
1023
+
1024
+ Slick.prototype.swipeDirection = function () {
1025
+
1026
+ var xDist, yDist, r, swipeAngle, _ = this;
1027
+
1028
+ xDist = _.touchObject.startX - _.touchObject.curX;
1029
+ yDist = _.touchObject.startY - _.touchObject.curY;
1030
+ r = Math.atan2(yDist, xDist);
1031
+
1032
+ swipeAngle = Math.round(r * 180 / Math.PI);
1033
+ if (swipeAngle < 0) {
1034
+ swipeAngle = 360 - Math.abs(swipeAngle);
1035
+ }
1036
+
1037
+ if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
1038
+ return 'left';
1039
+ }
1040
+ if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
1041
+ return 'left';
1042
+ }
1043
+ if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
1044
+ return 'right';
1045
+ }
1046
+ if ((swipeAngle > 45) && (swipeAngle < 135)) {
1047
+ return 'down';
1048
+ }
1049
+
1050
+ return 'up';
1051
+
1052
+ };
1053
+
1054
+ Slick.prototype.refresh = function () {
1055
+
1056
+ var _ = this;
1057
+
1058
+ _.destroy();
1059
+
1060
+ $.extend(_, _.initials);
1061
+
1062
+ _.init();
1063
+
1064
+ };
1065
+
1066
+ Slick.prototype.destroy = function () {
1067
+ var _ = this;
1068
+ $('.slick-cloned', _.slider).remove();
1069
+ $('.slick-placeholder', _.slider).remove();
1070
+ if (_.dots) {
1071
+ _.dots.remove();
1072
+ }
1073
+ if (_.prevArrow) {
1074
+ _.prevArrow.remove();
1075
+ _.nextArrow.remove();
1076
+ }
1077
+ _.slides.unwrap().unwrap();
1078
+ _.slides.removeClass(
1079
+ 'slick-slide slick-active slick-visible').width('');
1080
+ _.slider.removeClass('slick-slider');
1081
+ _.slider.removeClass('slick-initialized');
1082
+ };
1083
+
1084
+ $.fn.slick = function (options) {
1085
+ var _ = this;
1086
+ return _.each(function (index, element) {
1087
+
1088
+ element.slick = new Slick(element, options);
1089
+
1090
+ });
1091
+ };
1092
+
1093
+ $.fn.slickGoTo = function (slide) {
1094
+ var _ = this;
1095
+ return _.each(function (index, element) {
1096
+
1097
+ element.slick.slideHandler(slide);
1098
+
1099
+ });
1100
+ };
1101
+
1102
+ $.fn.slickNext = function () {
1103
+ var _ = this;
1104
+ return _.each(function (index, element) {
1105
+
1106
+ element.slick.changeSlide({data: {message: 'next'}});
1107
+
1108
+ });
1109
+ };
1110
+
1111
+ $.fn.slickPrev = function () {
1112
+ var _ = this;
1113
+ return _.each(function (index, element) {
1114
+
1115
+ element.slick.changeSlide({data: {message: 'previous'}});
1116
+
1117
+ });
1118
+ };
1119
+
1120
+ $.fn.slickPause = function () {
1121
+ var _ = this;
1122
+ return _.each(function (index, element) {
1123
+
1124
+ element.slick.autoPlayClear();
1125
+
1126
+ });
1127
+ };
1128
+
1129
+ $.fn.slickPlay = function () {
1130
+ var _ = this;
1131
+ return _.each(function (index, element) {
1132
+
1133
+ element.slick.autoPlay();
1134
+
1135
+ });
1136
+ };
1137
+
1138
+ $.fn.unslick = function () {
1139
+ var _ = this;
1140
+ return _.each(function (index, element) {
1141
+
1142
+ element.slick.destroy();
1143
+
1144
+ });
1145
+ };
1146
+
1147
+ }));