Shortcodes Ultimate - Version 4.8.0

Version Description

  • Minor UI fixes (compatibility with page builders)
  • Czech translation by Punc00
  • Added: full compatibility with multiple editors on same page - fourm topic
  • Fixed: extra CSS class for [menu] - forum topic
  • Fixed: Swiper click event, Swiper has been updated - forum topic
  • Fixed: [spoiler]'s content is now hidden until the page is loaded
  • New dashboard page: Cheatsheet
Download this release

Release Info

Developer gn_themes
Plugin Icon 128x128 Shortcodes Ultimate
Version 4.8.0
Comparing to
See all releases

Code changes from version 4.7.2 to 4.8.0

assets/css/cheatsheet.css ADDED
@@ -0,0 +1,88 @@
1
+ #su-cheatsheet-screen table {
2
+ margin: 30px 0;
3
+ margin-bottom: 1.11111rem;
4
+ border: solid 1px #ddd;
5
+ background: #fff;
6
+ }
7
+ #su-cheatsheet-screen table thead {
8
+ background: #f5f5f5;
9
+ }
10
+ #su-cheatsheet-screen table thead tr th,
11
+ #su-cheatsheet-screen table thead tr td {
12
+ padding: 0.44444rem 0.55556rem 0.55556rem;
13
+ color: #222;
14
+ font-weight: bold;
15
+ }
16
+ #su-cheatsheet-screen table tfoot {
17
+ background: #f5f5f5;
18
+ }
19
+ #su-cheatsheet-screen table tfoot tr th,
20
+ #su-cheatsheet-screen table tfoot tr td {
21
+ padding: 0.44444rem 0.55556rem 0.55556rem;
22
+ color: #222;
23
+ font-weight: bold;
24
+ }
25
+ #su-cheatsheet-screen table tr th,
26
+ #su-cheatsheet-screen table tr td {
27
+ padding: 0.5rem 0.55556rem;
28
+ color: #222;
29
+ text-align: left;
30
+ }
31
+ #su-cheatsheet-screen table tr.even,
32
+ #su-cheatsheet-screen table tr.alt,
33
+ #su-cheatsheet-screen table tr:nth-of-type(even) {
34
+ background: #f9f9f9;
35
+ }
36
+ #su-cheatsheet-screen table thead tr th,
37
+ #su-cheatsheet-screen table tfoot tr th,
38
+ #su-cheatsheet-screen table tfoot tr td,
39
+ #su-cheatsheet-screen table tbody tr th,
40
+ #su-cheatsheet-screen table tbody tr td,
41
+ #su-cheatsheet-screen table tr td {
42
+ display: table-cell;
43
+ vertical-align: top;
44
+ }
45
+
46
+ #su-cheatsheet-screen table .su-shortcode-icon {
47
+ display: inline-block;
48
+ width: 24px;
49
+ opacity: 0.5;
50
+ filter: alpha(opacity=50);
51
+ }
52
+ #su-cheatsheet-screen table .su-shortcode-desc {
53
+ font-size: 0.8em;
54
+ color: #777;
55
+ margin: 5px 0 0 0;
56
+ font-style: normal;
57
+ }
58
+
59
+ #su-cheatsheet-screen table .su-shortcode-attribute {
60
+ margin-top: 1.5em;
61
+ color: #666;
62
+ }
63
+ #su-cheatsheet-screen table .su-shortcode-attribute:first-child { margin-top: 0; }
64
+ #su-cheatsheet-screen table .su-shortcode-attribute p { margin: 5px; }
65
+ #su-cheatsheet-screen table .su-shortcode-attribute strong,
66
+ #su-cheatsheet-screen table .su-shortcode-attribute em {
67
+ color: #000;
68
+ font-style: normal;
69
+ }
70
+ #su-cheatsheet-screen table .su-shortcode-attribute strong em {
71
+ color: #666;
72
+ font-weight: normal;
73
+ font-style: normal;
74
+ }
75
+ #su-cheatsheet-screen table code {
76
+ display: block;
77
+ white-space: pre-wrap;
78
+ font-family: monospace;
79
+ }
80
+
81
+ body.su-print-cheatsheet #wpadminbar,
82
+ body.su-print-cheatsheet #adminmenuback,
83
+ body.su-print-cheatsheet #adminmenuwrap,
84
+ body.su-print-cheatsheet #wpfooter { display: none; }
85
+ body.su-print-cheatsheet #wpcontent { margin: 0 0 0 30px; }
86
+ #su-cheatsheet-print-head { display: none; }
87
+ body.su-print-cheatsheet #su-cheatsheet-print-head { display: inline-block; }
88
+ body.su-print-cheatsheet #su-cheatsheet-print { display: none; }
assets/css/generator.css CHANGED
@@ -622,9 +622,9 @@
622
color: #fff;
623
}
624
625
- body.su-mfp-shown .mfp-bg { z-index: 10000 !important; }
626
- body.su-mfp-shown .mfp-wrap { z-index: 10001 !important; }
627
- body.su-mfp-shown .mfp-preloader { z-index: 10002 !important; }
628
- body.su-mfp-shown .mfp-content { z-index: 10003 !important; }
629
body.su-mfp-shown button.mfp-close,
630
- body.su-mfp-shown button.mfp-arrow { z-index: 10004 !important; }
622
color: #fff;
623
}
624
625
+ body.su-mfp-shown .mfp-bg { z-index: 100000 !important; }
626
+ body.su-mfp-shown .mfp-wrap { z-index: 100001 !important; }
627
+ body.su-mfp-shown .mfp-preloader { z-index: 100002 !important; }
628
+ body.su-mfp-shown .mfp-content { z-index: 100003 !important; }
629
body.su-mfp-shown button.mfp-close,
630
+ body.su-mfp-shown button.mfp-arrow { z-index: 100004 !important; }
assets/images/banners/bundle.png ADDED
Binary file
assets/js/generator.js CHANGED
@@ -18,19 +18,19 @@ jQuery(document).ready(function ($) {
18
e.preventDefault();
19
// Save the target
20
window.su_generator_target = $(this).data('target');
21
- // Visual Composer
22
// if ($('#wpb_visual_composer').is(':visible')) {
23
- // $('body').addClass('su-generator-priority-mode');
24
// window.su_generator_target = 'wpb_tinymce_content';
25
// }
26
- // Elegant Themes page builder
27
// else if ($('.et_pb_modal_settings_container').is(':visible')) {
28
- // $('body').addClass('su-generator-priority-mode');
29
// window.su_generator_target = 'et_pb_content_new';
30
// }
31
- // SiteOrigin page builder
32
// else if ($('.panels-admin-dialog').is(':visible')) {
33
- // $('body').addClass('su-generator-priority-mode');
34
// }
35
// Get open shortcode
36
var shortcode = $(this).data('shortcode');
18
e.preventDefault();
19
// Save the target
20
window.su_generator_target = $(this).data('target');
21
+ // // Visual Composer
22
// if ($('#wpb_visual_composer').is(':visible')) {
23
+ // // $('body').addClass('su-generator-priority-mode');
24
// window.su_generator_target = 'wpb_tinymce_content';
25
// }
26
+ // // Elegant Themes page builder
27
// else if ($('.et_pb_modal_settings_container').is(':visible')) {
28
+ // // $('body').addClass('su-generator-priority-mode');
29
// window.su_generator_target = 'et_pb_content_new';
30
// }
31
+ // // SiteOrigin page builder
32
// else if ($('.panels-admin-dialog').is(':visible')) {
33
+ // // $('body').addClass('su-generator-priority-mode');
34
// }
35
// Get open shortcode
36
var shortcode = $(this).data('shortcode');
assets/js/options-page.js CHANGED
@@ -134,4 +134,10 @@ jQuery(document).ready(function ($) {
134
$(this).parent('.su-examples-code').children('textarea').slideDown(300);
135
e.preventDefault();
136
});
137
});
134
$(this).parent('.su-examples-code').children('textarea').slideDown(300);
135
e.preventDefault();
136
});
137
+
138
+ // ########## Cheatsheet screen ##########
139
+ $('.su-cheatsheet-switch').on('click', function (e) {
140
+ $('body').toggleClass('su-print-cheatsheet');
141
+ e.preventDefault();
142
+ });
143
});
assets/js/other-shortcodes.js CHANGED
@@ -16,6 +16,7 @@ jQuery(document).ready(function ($) {
16
if ($(window).scrollTop() > $title.offset().top) $(window).scrollTop($title.offset().top - $title.height() - bar);
17
e.preventDefault();
18
});
19
// Tabs
20
$('body:not(.su-other-shortcodes-loaded)').on('click', '.su-tabs-nav span', function (e) {
21
var $tab = $(this),
16
if ($(window).scrollTop() > $title.offset().top) $(window).scrollTop($title.offset().top - $title.height() - bar);
17
e.preventDefault();
18
});
19
+ $('.su-spoiler-content').attr('style', '');
20
// Tabs
21
$('body:not(.su-other-shortcodes-loaded)').on('click', '.su-tabs-nav span', function (e) {
22
var $tab = $(this),
assets/js/swiper.js CHANGED
@@ -1,2306 +1 @@
1
- /*
2
- * Swiper 2.0 - Mobile Touch Slider
3
- * http://www.idangero.us/sliders/swiper/
4
- *
5
- * Copyright 2012-2013, Vladimir Kharlampidi
6
- * The iDangero.us
7
- * http://www.idangero.us/
8
- *
9
- * Licensed under GPL & MIT
10
- *
11
- * Updated on: June 9, 2013
12
- */
13
- var Swiper = function (selector, params) {
14
- /*=========================
15
- A little bit dirty but required part for IE8 and old FF support
16
- ===========================*/
17
- if (document.body.__defineGetter__) {
18
- if (HTMLElement) {
19
- var element = HTMLElement.prototype;
20
- if (element.__defineGetter__) {
21
- element.__defineGetter__("outerHTML", function () {
22
- return new XMLSerializer().serializeToString(this);
23
- });
24
- }
25
- }
26
- }
27
-
28
- if (!window.getComputedStyle) {
29
- window.getComputedStyle = function (el, pseudo) {
30
- this.el = el;
31
- this.getPropertyValue = function (prop) {
32
- var re = /(\-([a-z]){1})/g;
33
- if (prop === 'float') prop = 'styleFloat';
34
- if (re.test(prop)) {
35
- prop = prop.replace(re, function () {
36
- return arguments[2].toUpperCase();
37
- });
38
- }
39
- return el.currentStyle[prop] ? el.currentStyle[prop] : null;
40
- }
41
- return this;
42
- }
43
- }
44
- if (!Array.prototype.indexOf) {
45
- Array.prototype.indexOf = function (obj, start) {
46
- for (var i = (start || 0), j = this.length; i < j; i++) {
47
- if (this[i] === obj) {
48
- return i;
49
- }
50
- }
51
- return -1;
52
- }
53
- }
54
- if (!document.querySelectorAll) {
55
- if (!window.jQuery) return;
56
- }
57
-
58
- function $(s) {
59
- if (document.querySelectorAll) return document.querySelectorAll(s);
60
- else return jQuery(s);
61
- }
62
-
63
- /*=========================
64
- Check for correct selector
65
- ===========================*/
66
- if (typeof selector === 'undefined') return;
67
-
68
- if (!(selector.nodeType)) {
69
- if ($(selector).length === 0) return;
70
- }
71
-
72
- /*=========================
73
- _this
74
- ===========================*/
75
- var _this = this;
76
-
77
- /*=========================
78
- Default Flags and vars
79
- ===========================*/
80
- _this.touches = {
81
- start: 0,
82
- startX: 0,
83
- startY: 0,
84
- current: 0,
85
- currentX: 0,
86
- currentY: 0,
87
- diff: 0,
88
- abs: 0
89
- };
90
- _this.positions = {
91
- start: 0,
92
- abs: 0,
93
- diff: 0,
94
- current: 0
95
- };
96
- _this.times = {
97
- start: 0,
98
- end: 0
99
- };
100
-
101
- _this.id = (new Date()).getTime();
102
- _this.container = (selector.nodeType) ? selector : $(selector)[0];
103
- _this.isTouched = false;
104
- _this.isMoved = false;
105
- _this.activeIndex = 0;
106
- _this.activeLoaderIndex = 0;
107
- _this.activeLoopIndex = 0;
108
- _this.previousIndex = null;
109
- _this.velocity = 0;
110
- _this.snapGrid = [];
111
- _this.slidesGrid = [];
112
- _this.imagesToLoad = [];
113
- _this.imagesLoaded = 0;
114
- _this.wrapperLeft = 0;
115
- _this.wrapperRight = 0;
116
- _this.wrapperTop = 0;
117
- _this.wrapperBottom = 0;
118
- var wrapper, slideSize, wrapperSize, direction, isScrolling, containerSize;
119
-
120
- /*=========================
121
- Default Parameters
122
- ===========================*/
123
- var defaults = {
124
- mode: 'horizontal',
125
- // or 'vertical'
126
- touchRatio: 1,
127
- speed: 300,
128
- freeMode: false,
129
- freeModeFluid: false,
130
- momentumRatio: 1,
131
- momentumBounce: true,
132
- momentumBounceRatio: 1,
133
- slidesPerView: 1,
134
- slidesPerGroup: 1,
135
- simulateTouch: true,
136
- followFinger: true,
137
- shortSwipes: true,
138
- moveStartThreshold: false,
139
- autoplay: false,
140
- onlyExternal: false,
141
- createPagination: true,
142
- pagination: false,
143
- paginationElement: 'span',
144
- paginationClickable: false,
145
- paginationAsRange: true,
146
- resistance: true,
147
- // or false or 100%
148
- scrollContainer: false,
149
- preventLinks: true,
150
- noSwiping: false,
151
- // or class
152
- noSwipingClass: 'swiper-no-swiping',
153
- //:)
154
- initialSlide: 0,
155
- keyboardControl: false,
156
- mousewheelControl: false,
157
- useCSS3Transforms: true,
158
- //Loop mode
159
- loop: false,
160
- loopAdditionalSlides: 0,
161
- //Auto Height
162
- calculateHeight: false,
163
- //Images Preloader
164
- updateOnImagesReady: true,
165
- //Form elements
166
- releaseFormElements: true,
167
- //Watch for active slide, useful when use effects on different slide states
168
- watchActiveIndex: false,
169
- //Slides Visibility Fit
170
- visibilityFullFit: false,
171
- //Slides Offset
172
- offsetPxBefore: 0,
173
- offsetPxAfter: 0,
174
- offsetSlidesBefore: 0,
175
- offsetSlidesAfter: 0,
176
- centeredSlides: false,
177
- //Queue callbacks
178
- queueStartCallbacks: false,
179
- queueEndCallbacks: false,
180
- //Auto Resize
181
- autoResize: true,
182
- resizeReInit: false,
183
- //DOMAnimation
184
- DOMAnimation: true,
185
- //Slides Loader
186
- loader: {
187
- slides: [],
188
- //array with slides
189
- slidesHTMLType: 'inner',
190
- // or 'outer'
191
- surroundGroups: 1,
192
- //keep preloaded slides groups around view
193
- logic: 'reload',
194
- //or 'change'
195
- loadAllSlides: false
196
- },
197
- //Namespace
198
- slideElement: 'div',
199
- slideClass: 'swiper-slide',
200
- slideActiveClass: 'swiper-slide-active',
201
- slideVisibleClass: 'swiper-slide-visible',
202
- wrapperClass: 'swiper-wrapper',
203
- paginationElementClass: 'swiper-pagination-switch',
204
- paginationActiveClass: 'swiper-active-switch',
205
- paginationVisibleClass: 'swiper-visible-switch'
206
- }
207
- params = params || {};
208
- for (var prop in defaults) {
209
- if (prop in params && typeof params[prop] === 'object') {
210
- for (var subProp in defaults[prop]) {
211
- if (!(subProp in params[prop])) {
212
- params[prop][subProp] = defaults[prop][subProp];
213
- }
214
- }
215
- } else if (!(prop in params)) {
216
- params[prop] = defaults[prop]
217
- }
218
- }
219
- _this.params = params;
220
- if (params.scrollContainer) {
221
- params.freeMode = true;
222
- params.freeModeFluid = true;
223
- }
224
- if (params.loop) {
225
- params.resistance = '100%';
226
- }
227
- var isH = params.mode === 'horizontal';
228
-
229
- /*=========================
230
- Define Touch Events
231
- ===========================*/
232
-
233
- _this.touchEvents = {
234
- touchStart: _this.support.touch || !params.simulateTouch ? 'touchstart' : (_this.browser.ie10 ? 'MSPointerDown' : 'mousedown'),
235
- touchMove: _this.support.touch || !params.simulateTouch ? 'touchmove' : (_this.browser.ie10 ? 'MSPointerMove' : 'mousemove'),
236
- touchEnd: _this.support.touch || !params.simulateTouch ? 'touchend' : (_this.browser.ie10 ? 'MSPointerUp' : 'mouseup')
237
- };
238
-
239
- /*=========================
240
- Wrapper
241
- ===========================*/
242
- for (var i = _this.container.childNodes.length - 1; i >= 0; i--) {
243
- if (_this.container.childNodes[i].className) {
244
- var _wrapperClasses = _this.container.childNodes[i].className.split(' ')
245
- for (var j = 0; j < _wrapperClasses.length; j++) {
246
- if (_wrapperClasses[j] === params.wrapperClass) {
247
- wrapper = _this.container.childNodes[i];
248
- }
249
- };
250
- }
251
- };
252
-
253
- _this.wrapper = wrapper;
254
- /*=========================
255
- Slide API
256
- ===========================*/
257
- _this._extendSwiperSlide = function (el) {
258
- el.append = function () {
259
- if (params.loop) {
260
- el.insertAfter(_this.slides.length - _this.loopedSlides);
261
- _this.removeLoopedSlides();
262
- _this.calcSlides();
263
- _this.createLoop();
264
- } else {
265
- _this.wrapper.appendChild(el);
266
- }
267
-
268
- _this.reInit();
269
- return el;
270
- }
271
- el.prepend = function () {
272
- if (params.loop) {
273
- _this.wrapper.insertBefore(el, _this.slides[_this.loopedSlides]);
274
- _this.removeLoopedSlides();
275
- _this.calcSlides();
276
- _this.createLoop();
277
- } else {
278
- _this.wrapper.insertBefore(el, _this.wrapper.firstChild);
279
- }
280
- _this.reInit();
281
- return el;
282
- }
283
- el.insertAfter = function (index) {
284
- if (typeof index === 'undefined') return false;
285
- var beforeSlide;
286
-
287
- if (params.loop) {
288
- beforeSlide = _this.slides[index + 1 + _this.loopedSlides];
289
- _this.wrapper.insertBefore(el, beforeSlide);
290
- _this.removeLoopedSlides();
291
- _this.calcSlides();
292
- _this.createLoop();
293
- } else {
294
- beforeSlide = _this.slides[index + 1];
295
- _this.wrapper.insertBefore(el, beforeSlide)
296
- }
297
- _this.reInit();
298
- return el;
299
- }
300
- el.clone = function () {
301
- return _this._extendSwiperSlide(el.cloneNode(true))
302
- }
303
- el.remove = function () {
304
- _this.wrapper.removeChild(el);
305
- _this.reInit();
306
- }
307
- el.html = function (html) {
308
- if (typeof html === 'undefined') {
309
- return el.innerHTML;
310
- } else {
311
- el.innerHTML = html;
312
- return el;
313
- }
314
- }
315
- el.index = function () {
316
- var index;
317
- for (var i = _this.slides.length - 1; i >= 0; i--) {
318
- if (el === _this.slides[i]) index = i;
319
- }
320
- return index;
321
- }
322
- el.isActive = function () {
323
- if (el.index() === _this.activeIndex) return true;
324
- else return false;
325
- }
326
- if (!el.swiperSlideDataStorage) el.swiperSlideDataStorage = {};
327
- el.getData = function (name) {
328
- return el.swiperSlideDataStorage[name];
329
- }
330
- el.setData = function (name, value) {
331
- el.swiperSlideDataStorage[name] = value;
332
- return el;
333
- }
334
- el.data = function (name, value) {
335
- if (!value) {
336
- return el.getAttribute('data-' + name);
337
- } else {
338
- el.setAttribute('data-' + name, value);
339
- return el;
340
- }
341
- }
342
- el.getWidth = function (outer) {
343
- return _this.h.getWidth(el, outer);
344
- }
345
- el.getHeight = function (outer) {
346
- return _this.h.getHeight(el, outer);
347
- }
348
- el.getOffset = function () {
349
- return _this.h.getOffset(el);
350
- }
351
- return el;
352
- }
353
-
354
- //Calculate information about number of slides
355
- _this.calcSlides = function (forceCalcSlides) {
356
- var oldNumber = _this.slides ? _this.slides.length : false;
357
- _this.slides = [];
358
- _this.displaySlides = [];
359
- for (var i = 0; i < _this.wrapper.childNodes.length; i++) {
360
- if (_this.wrapper.childNodes[i].className) {
361
- var _className = _this.wrapper.childNodes[i].className;
362
- var _slideClasses = _className.split(' ');
363
- for (var j = 0; j < _slideClasses.length; j++) {
364
- if (_slideClasses[j] === params.slideClass) {
365
- _this.slides.push(_this.wrapper.childNodes[i]);
366
- }
367
- }
368
- }
369
- }
370
- for (i = _this.slides.length - 1; i >= 0; i--) {
371
- _this._extendSwiperSlide(_this.slides[i]);
372
- }
373
- if (!oldNumber) return;
374
- if (oldNumber !== _this.slides.length || forceCalcSlides) {
375
- // Number of slides has been changed
376
- removeSlideEvents();
377
- addSlideEvents();
378
- _this.updateActiveSlide();
379
- if (params.createPagination && _this.params.pagination) _this.createPagination();
380
- _this.callPlugins('numberOfSlidesChanged');
381
- }
382
- }
383
-
384
- //Create Slide
385
- _this.createSlide = function (html, slideClassList, el) {
386
- var slideClassList = slideClassList || _this.params.slideClass;
387
- var el = el || params.slideElement;
388
- var newSlide = document.createElement(el);
389
- newSlide.innerHTML = html || '';
390
- newSlide.className = slideClassList;
391
- return _this._extendSwiperSlide(newSlide);
392
- }
393
-
394
- //Append Slide
395
- _this.appendSlide = function (html, slideClassList, el) {
396
- if (!html) return;
397
- if (html.nodeType) {
398
- return _this._extendSwiperSlide(html).append()
399
- } else {
400
- return _this.createSlide(html, slideClassList, el).append()
401
- }
402
- }
403
- _this.prependSlide = function (html, slideClassList, el) {
404
- if (!html) return;
405
- if (html.nodeType) {
406
- return _this._extendSwiperSlide(html).prepend()
407
- } else {
408
- return _this.createSlide(html, slideClassList, el).prepend()
409
- }
410
- }
411
- _this.insertSlideAfter = function (index, html, slideClassList, el) {
412
- if (typeof index === 'undefined') return false;
413
- if (html.nodeType) {
414
- return _this._extendSwiperSlide(html).insertAfter(index);
415
- } else {
416
- return _this.createSlide(html, slideClassList, el).insertAfter(index);
417
- }
418
- }
419
- _this.removeSlide = function (index) {
420
- if (_this.slides[index]) {
421
- if (params.loop) {
422
- if (!_this.slides[index + _this.loopedSlides]) return false;
423
- _this.slides[index + _this.loopedSlides].remove();
424
- _this.removeLoopedSlides();
425
- _this.calcSlides();
426
- _this.createLoop();
427
- } else _this.slides[index].remove();
428
- return true;
429
- } else return false;
430
- }
431
- _this.removeLastSlide = function () {
432
- if (_this.slides.length > 0) {
433
- if (params.loop) {
434
- _this.slides[_this.slides.length - 1 - _this.loopedSlides].remove();
435
- _this.removeLoopedSlides();
436
- _this.calcSlides();
437
- _this.createLoop();
438
- } else _this.slides[(_this.slides.length - 1)].remove();
439
- return true;
440
- } else {
441
- return false;
442
- }
443
- }
444
- _this.removeAllSlides = function () {
445
- for (var i = _this.slides.length - 1; i >= 0; i--) {
446
- _this.slides[i].remove()
447
- }
448
- }
449
- _this.getSlide = function (index) {
450
- return _this.slides[index]
451
- }
452
- _this.getLastSlide = function () {
453
- return _this.slides[_this.slides.length - 1]
454
- }
455
- _this.getFirstSlide = function () {
456
- return _this.slides[0]
457
- }
458
-
459
- //Currently Active Slide
460
- _this.activeSlide = function () {
461
- return _this.slides[_this.activeIndex]
462
- }
463
-
464
- /*=========================
465
- Plugins API
466
- ===========================*/
467
- var _plugins = [];
468
- for (var plugin in _this.plugins) {
469
- if (params[plugin]) {
470
- var p = _this.plugins[plugin](_this, params[plugin]);
471
- if (p) _plugins.push(p);
472
- }
473
- }
474
- _this.callPlugins = function (method, args) {
475
- if (!args) args = {}
476
- for (var i = 0; i < _plugins.length; i++) {
477
- if (method in _plugins[i]) {
478
- _plugins[i][method](args);
479
- }
480
- }
481
- }
482
-
483
- /*=========================
484
- WP8 Fix
485
- ===========================*/
486
- if (_this.browser.ie10 && !params.onlyExternal) {
487
- if (isH) _this.wrapper.classList.add('swiper-wp8-horizontal');
488
- else _this.wrapper.classList.add('swiper-wp8-vertical');
489
- }
490
-
491
- /*=========================
492
- Free Mode Class
493
- ===========================*/
494
- if (params.freeMode) {
495
- _this.container.className += ' swiper-free-mode';
496
- }
497
-
498
- /*==================================================
499
- Init/Re-init/Resize Fix
500
- ====================================================*/
501
- _this.initialized = false;
502
- _this.init = function (force, forceCalcSlides) {
503
- var _width = _this.h.getWidth(_this.container);
504
- var _height = _this.h.getHeight(_this.container);
505
- if (_width === _this.width && _height === _this.height && !force) return;
506
- _this.width = _width;
507
- _this.height = _height;
508
-
509
- containerSize = isH ? _width : _height;
510
- var wrapper = _this.wrapper;
511
-
512
- if (force) {
513
- _this.calcSlides(forceCalcSlides);
514
- }
515
-
516
- if (params.slidesPerView === 'auto') {
517
- //Auto mode
518
- var slidesWidth = 0;
519
- var slidesHeight = 0;
520
-
521
- //Unset Styles
522
- if (params.slidesOffset > 0) {
523
- wrapper.style.paddingLeft = '';
524
- wrapper.style.paddingRight = '';
525
- wrapper.style.paddingTop = '';
526
- wrapper.style.paddingBottom = '';
527
- }
528
- wrapper.style.width = '';
529
- wrapper.style.height = '';
530
- if (params.offsetPxBefore > 0) {
531
- if (isH) _this.wrapperLeft = params.offsetPxBefore;
532
- else _this.wrapperTop = params.offsetPxBefore;
533
- }
534
- if (params.offsetPxAfter > 0) {
535
- if (isH) _this.wrapperRight = params.offsetPxAfter;
536
- else _this.wrapperBottom = params.offsetPxAfter;
537
- }
538
-
539
- if (params.centeredSlides) {
540
- if (isH) {
541
- _this.wrapperLeft = (containerSize - this.slides[0].getWidth(true)) / 2;
542
- _this.wrapperRight = (containerSize - _this.slides[_this.slides.length - 1].getWidth(true)) / 2;
543
- } else {
544
- _this.wrapperTop = (containerSize - _this.slides[0].getHeight(true)) / 2;
545
- _this.wrapperBottom = (containerSize - _this.slides[_this.slides.length - 1].getHeight(true)) / 2;
546
- }
547
- }
548
-
549
- if (isH) {
550
- if (_this.wrapperLeft >= 0) wrapper.style.paddingLeft = _this.wrapperLeft + 'px';
551
- if (_this.wrapperRight >= 0) wrapper.style.paddingRight = _this.wrapperRight + 'px';
552
- } else {
553
- if (_this.wrapperTop >= 0) wrapper.style.paddingTop = _this.wrapperTop + 'px';
554
- if (_this.wrapperBottom >= 0) wrapper.style.paddingBottom = _this.wrapperBottom + 'px';
555
- }
556
- var slideLeft = 0;
557
- var centeredSlideLeft = 0;
558
- _this.snapGrid = [];
559
- _this.slidesGrid = [];
560
-
561
- var slideMaxHeight = 0;
562
- for (var i = 0; i < _this.slides.length; i++) {
563
- var slideWidth = _this.slides[i].getWidth(true);
564
- var slideHeight = _this.slides[i].getHeight(true);
565
- if (params.calculateHeight) {
566
- slideMaxHeight = Math.max(slideMaxHeight, slideHeight)
567
- }
568
- var _slideSize = isH ? slideWidth : slideHeight;
569
- if (params.centeredSlides) {
570
- var nextSlideWidth = i === _this.slides.length - 1 ? 0 : _this.slides[i + 1].getWidth(true);
571
- var nextSlideHeight = i === _this.slides.length - 1 ? 0 : _this.slides[i + 1].getHeight(true);
572
- var nextSlideSize = isH ? nextSlideWidth : nextSlideHeight;
573
- if (_slideSize > containerSize) {
574
- for (var j = 0; j <= Math.floor(_slideSize / (containerSize + _this.wrapperLeft)); j++) {
575
- if (j === 0) _this.snapGrid.push(slideLeft + _this.wrapperLeft);
576
- else _this.snapGrid.push(slideLeft + _this.wrapperLeft + containerSize * j);
577
- }
578
- _this.slidesGrid.push(slideLeft + _this.wrapperLeft);
579
- } else {
580
- _this.snapGrid.push(centeredSlideLeft);
581
- _this.slidesGrid.push(centeredSlideLeft);
582
- }
583
-
584
- centeredSlideLeft += _slideSize / 2 + nextSlideSize / 2;
585
-
586
- } else {
587
- if (_slideSize > containerSize) {
588
- for (var j = 0; j <= Math.floor(_slideSize / containerSize); j++) {
589
- _this.snapGrid.push(slideLeft + containerSize * j);
590
- }
591
- } else {
592
- _this.snapGrid.push(slideLeft);
593
- }
594
- _this.slidesGrid.push(slideLeft);
595
- }
596
-
597
- slideLeft += _slideSize;
598
-
599
- slidesWidth += slideWidth;
600
- slidesHeight += slideHeight;
601
- }
602
- if (params.calculateHeight) _this.height = slideMaxHeight;
603
- if (isH) {
604
- wrapperSize = slidesWidth + _this.wrapperRight + _this.wrapperLeft;
605
- wrapper.style.width = (slidesWidth) + 'px';
606
- wrapper.style.height = (_this.height) + 'px';
607
- } else {
608
- wrapperSize = slidesHeight + _this.wrapperTop + _this.wrapperBottom;
609
- wrapper.style.width = (_this.width) + 'px';
610
- wrapper.style.height = (slidesHeight) + 'px';
611
- }
612
-
613
- } else if (params.scrollContainer) {
614
- //Scroll Container
615
- wrapper.style.width = '';
616
- wrapper.style.height = '';
617
- var wrapperWidth = _this.slides[0].getWidth(true);
618
- var wrapperHeight = _this.slides[0].getHeight(true);
619
- wrapperSize = isH ? wrapperWidth : wrapperHeight;
620
- wrapper.style.width = wrapperWidth + 'px';
621
- wrapper.style.height = wrapperHeight + 'px';
622
- slideSize = isH ? wrapperWidth : wrapperHeight;
623
-
624
- } else {
625
- //For usual slides
626
- if (params.calculateHeight) {
627
- var slideMaxHeight = 0;
628
- var wrapperHeight = 0;
629
- //ResetWrapperSize
630
- if (!isH) _this.container.style.height = '';
631
- wrapper.style.height = '';
632
-
633
- for (var i = 0; i < _this.slides.length; i++) {
634
- //ResetSlideSize
635
- _this.slides[i].style.height = '';
636
- slideMaxHeight = Math.max(_this.slides[i].getHeight(true), slideMaxHeight);
637
- if (!isH) wrapperHeight += _this.slides[i].getHeight(true);
638
- }
639
- var slideHeight = slideMaxHeight;
640
- if (isH) var wrapperHeight = slideHeight;
641
- containerSize = _this.height = slideHeight;
642
- if (!isH) _this.container.style.height = containerSize + 'px';
643
- } else {
644
- var slideHeight = isH ? _this.height : _this.height / params.slidesPerView;
645
- var wrapperHeight = isH ? _this.height : _this.slides.length * slideHeight;
646
- }
647
- var slideWidth = isH ? _this.width / params.slidesPerView : _this.width;
648
- var wrapperWidth = isH ? _this.slides.length * slideWidth : _this.width;
649
- slideSize = isH ? slideWidth : slideHeight;
650
-
651
- if (params.offsetSlidesBefore > 0) {
652
- if (isH) _this.wrapperLeft = slideSize * params.offsetSlidesBefore;
653
- else _this.wrapperTop = slideSize * params.offsetSlidesBefore;
654
- }
655
- if (params.offsetSlidesAfter > 0) {
656
- if (isH) _this.wrapperRight = slideSize * params.offsetSlidesAfter;
657
- else _this.wrapperBottom = slideSize * params.offsetSlidesAfter;
658
- }
659
- if (params.offsetPxBefore > 0) {
660
- if (isH) _this.wrapperLeft = params.offsetPxBefore;
661
- else _this.wrapperTop = params.offsetPxBefore;
662
- }
663
- if (params.offsetPxAfter > 0) {
664
- if (isH) _this.wrapperRight = params.offsetPxAfter;
665
- else _this.wrapperBottom = params.offsetPxAfter;
666
- }
667
- if (params.centeredSlides) {
668
- if (isH) {
669
- _this.wrapperLeft = (containerSize - slideSize) / 2;
670
- _this.wrapperRight = (containerSize - slideSize) / 2;
671
- } else {
672
- _this.wrapperTop = (containerSize - slideSize) / 2;
673
- _this.wrapperBottom = (containerSize - slideSize) / 2;
674
- }
675
- }
676
- if (isH) {
677
- if (_this.wrapperLeft > 0) wrapper.style.paddingLeft = _this.wrapperLeft + 'px';
678
- if (_this.wrapperRight > 0) wrapper.style.paddingRight = _this.wrapperRight + 'px';
679
- } else {
680
- if (_this.wrapperTop > 0) wrapper.style.paddingTop = _this.wrapperTop + 'px';
681
- if (_this.wrapperBottom > 0) wrapper.style.paddingBottom = _this.wrapperBottom + 'px';
682
- }
683
-
684
- wrapperSize = isH ? wrapperWidth + _this.wrapperRight + _this.wrapperLeft : wrapperHeight + _this.wrapperTop + _this.wrapperBottom;
685
- wrapper.style.width = wrapperWidth + 'px';
686
- wrapper.style.height = wrapperHeight + 'px';
687
- var slideLeft = 0;
688
- _this.snapGrid = [];
689
- _this.slidesGrid = [];
690
- for (var i = 0; i < _this.slides.length; i++) {
691
- _this.snapGrid.push(slideLeft);
692
- _this.slidesGrid.push(slideLeft);
693
- slideLeft += slideSize;
694
- _this.slides[i].style.width = slideWidth + 'px';
695
- _this.slides[i].style.height = slideHeight + 'px';
696
- }
697
-
698
- }
699
-
700
- if (!_this.initialized) _this.callPlugins('onFirstInit');
701
- else _this.callPlugins('onInit');
702
- _this.initialized = true;
703
- }
704
- _this.reInit = function (forceCalcSlides) {
705
- _this.init(true, forceCalcSlides);
706
- }
707
- _this.resizeFix = function (reInit) {
708
- _this.callPlugins('beforeResizeFix');
709
- _this.init(params.resizeReInit || reInit);
710
- if (!params.freeMode) {
711
- if (params.loop) _this.swipeTo(_this.activeLoopIndex, 0, false);
712
- else _this.swipeTo(_this.activeIndex, 0, false);
713
- } else {
714
- var pos = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
715
- if (pos < -maxWrapperPosition()) {
716
- var x = isH ? -maxWrapperPosition() : 0;
717
- var y = isH ? 0 : -maxWrapperPosition();
718
- _this.setWrapperTransition(0);
719
- _this.setWrapperTranslate(x, y, 0);
720
- }
721
- }
722
- _this.callPlugins('afterResizeFix');
723
- }
724
-
725
- /*==========================================
726
- Max and Min Positions
727
- ============================================*/
728
- function maxWrapperPosition() {
729
- var a = (wrapperSize - containerSize);
730
- if (params.freeMode) {
731
- a = wrapperSize - containerSize;
732
- }
733
- // if (params.loop) a -= containerSize;
734
- if (params.slidesPerView > _this.slides.length) a = 0;
735
- if (a < 0) a = 0;
736
- return a;
737
- }
738
-
739
- function minWrapperPosition() {
740
- var a = 0;
741
- // if (params.loop) a = containerSize;
742
- return a;
743
- }
744
-
745
- /*==========================================
746
- Event Listeners
747
- ============================================*/
748
- function initEvents() {
749
- //Touch Events
750
- if (!_this.browser.ie10) {
751
- if (_this.support.touch) {
752
- _this.h.addEventListener(_this.wrapper, 'touchstart', onTouchStart, false);
753
- _this.h.addEventListener(_this.wrapper, 'touchmove', onTouchMove, false);
754
- _this.h.addEventListener(_this.wrapper, 'touchend', onTouchEnd, false);
755
- }
756
- if (params.simulateTouch) {
757
- _this.h.addEventListener(_this.wrapper, 'mousedown', onTouchStart, false);
758
- _this.h.addEventListener(document, 'mousemove', onTouchMove, false);
759
- _this.h.addEventListener(document, 'mouseup', onTouchEnd, false);
760
- }
761
- } else {
762
- _this.h.addEventListener(_this.wrapper, _this.touchEvents.touchStart, onTouchStart, false);
763
- _this.h.addEventListener(document, _this.touchEvents.touchMove, onTouchMove, false);
764
- _this.h.addEventListener(document, _this.touchEvents.touchEnd, onTouchEnd, false);
765
- }
766
- //Resize Event
767
- if (params.autoResize) {
768
- _this.h.addEventListener(window, 'resize', _this.resizeFix, false);
769
- }
770
- //Slide Events
771
- addSlideEvents();
772
- //Mousewheel
773
- _this._wheelEvent = false;
774
- if (params.mousewheelControl) {
775
- if (document.onmousewheel !== undefined) {
776
- _this._wheelEvent = "mousewheel";
777
- }
778
- try {
779
- WheelEvent("wheel");
780
- _this._wheelEvent = "wheel";
781
- } catch (e) {}
782
- if (!_this._wheelEvent) {
783
- _this._wheelEvent = "DOMMouseScroll";
784
- }
785
-
786
- if (_this._wheelEvent) {
787
- _this.h.addEventListener(_this.container, _this._wheelEvent, handleMousewheel, false);
788
- }
789
- }
790
-
791
- //Keyboard
792
- if (params.keyboardControl) {
793
- _this.h.addEventListener(document, 'keydown', handleKeyboardKeys, false);
794
- }
795
- if (params.updateOnImagesReady) {
796
- if (document.querySelectorAll) _this.imagesToLoad = _this.container.querySelectorAll('img');
797
- else if (window.jQuery) _this.imagesToLoad = $(_this.container).find('img');
798
-
799
- for (var i = 0; i < _this.imagesToLoad.length; i++) {
800
- _loadImage(_this.imagesToLoad[i].getAttribute('src'))
801
- }
802
- }
803
-
804
- function _loadImage(src) {
805
- var image = new Image();
806
- image.onload = function () {
807
- _this.imagesLoaded++;
808
- if (_this.imagesLoaded == _this.imagesToLoad.length) {
809
- _this.reInit();
810
- if (params.onImagesReady) params.onImagesReady(_this);
811
- }
812
- }
813
- image.src = src;
814
- }
815
- }
816
-
817
-
818
-
819
- //Remove Event Listeners
820
- _this.destroy = function (removeResizeFix) {
821
- //Touch Events
822
- if (!_this.browser.ie10) {
823
- if (_this.support.touch) {
824
- _this.h.removeEventListener(_this.wrapper, 'touchstart', onTouchStart, false);
825
- _this.h.removeEventListener(_this.wrapper, 'touchmove', onTouchMove, false);
826
- _this.h.removeEventListener(_this.wrapper, 'touchend', onTouchEnd, false);
827
- }
828
- if (params.simulateTouch) {
829
- _this.h.removeEventListener(_this.wrapper, 'mousedown', onTouchStart, false);
830
- _this.h.removeEventListener(document, 'mousemove', onTouchMove, false);
831
- _this.h.removeEventListener(document, 'mouseup', onTouchEnd, false);
832
- }
833
- } else {
834
- _this.h.removeEventListener(_this.wrapper, _this.touchEvents.touchStart, onTouchStart, false);
835
- _this.h.removeEventListener(document, _this.touchEvents.touchMove, onTouchMove, false);
836
- _this.h.removeEventListener(document, _this.touchEvents.touchEnd, onTouchEnd, false);
837
- }
838
- //Resize Event
839
- if (params.autoResize) {
840
- _this.h.removeEventListener(window, 'resize', _this.resizeFix, false);
841
- }
842
- //Init Slide Events
843
- removeSlideEvents();
844
-
845
- //Pagination
846
- if (params.paginationClickable) {
847
- removePaginationEvents();
848
- }
849
-
850
- //Mousewheel
851
- if (params.mousewheelControl && _this._wheelEvent) {
852
- _this.h.removeEventListener(_this.container, _this._wheelEvent, handleMousewheel, false);
853
- }
854
-
855
- //Keyboard
856
- if (params.keyboardControl) {
857
- _this.h.removeEventListener(document, 'keydown', handleKeyboardKeys, false);
858
- }
859
-
860
- //Stop autoplay
861
- if (params.autoplay) {
862
- _this.stopAutoplay();
863
- }
864
-
865
- _this.callPlugins('onDestroy');
866
- }
867
-
868
- function addSlideEvents() {
869
- //Prevent Links Events
870
- if (params.preventLinks) {
871
- var links = [];
872
- if (document.querySelectorAll) {
873
- links = _this.container.querySelectorAll('a');
874
- } else if (window.jQuery) {
875
- links = $(_this.container).find('a');
876
- }
877
- for (var i = 0; i < links.length; i++) {
878
- _this.h.addEventListener(links[i], 'click', preventClick, false);
879
- }
880
- }
881
- //Release Form Elements
882
- if (params.releaseFormElements) {
883
- var formElements = document.querySelectorAll ? _this.container.querySelectorAll('input, textarea, select') : $(_this.container).find('input, textarea, select');
884
- for (var i = 0; i < formElements.length; i++) {
885
- _this.h.addEventListener(formElements[i], _this.touchEvents.touchStart, releaseForms, true);
886
- }
887
- }
888
-
889
- //Slide Clicks & Touches
890
- if (params.onSlideClick) {
891
- for (var i = 0; i < _this.slides.length; i++) {
892
- _this.h.addEventListener(_this.slides[i], 'click', slideClick, false);
893
- }
894
- }
895
- if (params.onSlideTouch) {
896
- for (var i = 0; i < _this.slides.length; i++) {
897
- _this.h.addEventListener(_this.slides[i], _this.touchEvents.touchStart, slideTouch, false);
898
- }
899
- }
900
- }
901
-
902
- function removeSlideEvents() {
903
- //Slide Clicks & Touches
904
- if (params.onSlideClick) {
905
- for (var i = 0; i < _this.slides.length; i++) {
906
- _this.h.removeEventListener(_this.slides[i], 'click', slideClick, false);
907
- }
908
- }
909
- if (params.onSlideTouch) {
910
- for (var i = 0; i < _this.slides.length; i++) {
911
- _this.h.removeEventListener(_this.slides[i], _this.touchEvents.touchStart, slideTouch, false);
912
- }
913
- }
914
- //Release Form Elements
915
- if (params.releaseFormElements) {
916
- var formElements = document.querySelectorAll ? _this.container.querySelectorAll('input, textarea, select') : $(_this.container).find('input, textarea, select');
917
- for (var i = 0; i < formElements.length; i++) {
918
- _this.h.removeEventListener(formElements[i], _this.touchEvents.touchStart, releaseForms, true);
919
- }
920
- }
921
- //Prevent Links Events
922
- if (params.preventLinks) {
923
- var links = [];
924
- if (document.querySelectorAll) {
925
- links = _this.container.querySelectorAll('a');
926
- } else if (window.jQuery) {
927
- links = $(_this.container).find('a');
928
- }
929
- for (var i = 0; i < links.length; i++) {
930
- _this.h.removeEventListener(links[i], 'click', preventClick, false);
931
- }
932
- }
933
- }
934
- /*==========================================
935
- Keyboard Control
936
- ============================================*/
937
- function handleKeyboardKeys(e) {
938
- var kc = e.keyCode || e.charCode;
939
- if (kc == 37 || kc == 39 || kc == 38 || kc == 40) {
940
- var inView = false;
941
- //Check that swiper should be inside of visible area of window
942
- var swiperOffset = _this.h.getOffset(_this.container);
943
- var scrollLeft = _this.h.windowScroll().left;
944
- var scrollTop = _this.h.windowScroll().top;
945
- var windowWidth = _this.h.windowWidth();
946
- var windowHeight = _this.h.windowHeight();
947
- var swiperCoord = [
948
- [swiperOffset.left, swiperOffset.top],
949
- [swiperOffset.left + _this.width, swiperOffset.top],
950
- [swiperOffset.left, swiperOffset.top + _this.height],
951
- [swiperOffset.left + _this.width, swiperOffset.top + _this.height]
952
- ]
953
- for (var i = 0; i < swiperCoord.length; i++) {
954
- var point = swiperCoord[i];
955
- if (
956
- point[0] >= scrollLeft && point[0] <= scrollLeft + windowWidth && point[1] >= scrollTop && point[1] <= scrollTop + windowHeight) {
957
- inView = true;
958
- }
959
-
960
- }
961
- if (!inView) return;
962
- }
963
- if (isH) {
964
- if (kc == 37 || kc == 39) {
965
- if (e.preventDefault) e.preventDefault();
966
- else e.returnValue = false;
967
- }
968
- if (kc == 39) _this.swipeNext();
969
- if (kc == 37) _this.swipePrev();
970
- } else {
971
- if (kc == 38 || kc == 40) {
972
- if (e.preventDefault) e.preventDefault();
973
- else e.returnValue = false;
974
- }
975
- if (kc == 40) _this.swipeNext();
976
- if (kc == 38) _this.swipePrev();
977
- }
978
- }
979
-
980
- /*==========================================
981
- Mousewheel Control
982
- ============================================*/
983
- function handleMousewheel(e) {
984
- var we = _this._wheelEvent;
985
- var delta;
986
- //Opera & IE
987
- if (e.detail) delta = -e.detail;
988
- //WebKits
989
- else if (we == 'mousewheel') delta = e.wheelDelta;
990
- //Old FireFox
991
- else if (we == 'DOMMouseScroll') delta = -e.detail;
992
- //New FireFox
993
- else if (we == 'wheel') {
994
- delta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? -e.deltaX : -e.deltaY;
995
- }
996
- if (!params.freeMode) {
997
- if (delta < 0) _this.swipeNext();
998
- else _this.swipePrev();
999
- } else {
1000
- //Freemode or scrollContainer:
1001
- var currentTransform = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
1002
- var x, y;
1003
- if (isH) {
1004
- x = _this.getWrapperTranslate('x') + delta;
1005
- y = _this.getWrapperTranslate('y');
1006
- if (x > 0) x = 0;
1007
- if (x < -maxWrapperPosition()) x = -maxWrapperPosition();
1008
- } else {
1009
- x = _this.getWrapperTranslate('x');
1010
- y = _this.getWrapperTranslate('y') + delta;
1011
- if (y > 0) y = 0;
1012
- if (y < -maxWrapperPosition()) y = -maxWrapperPosition();
1013
- }
1014
- _this.setWrapperTransition(0);
1015
- _this.setWrapperTranslate(x, y, 0);
1016
- }
1017
- if (params.autoplay) _this.stopAutoplay();
1018
-
1019
- if (e.preventDefault) e.preventDefault();
1020
- else e.returnValue = false;
1021
- return false;
1022
- }
1023
-
1024
- /*=========================
1025
- Grab Cursor
1026
- ===========================*/
1027
- if (params.grabCursor) {
1028
- _this.container.style.cursor = 'move';
1029
- _this.container.style.cursor = 'grab';
1030
- _this.container.style.cursor = '-moz-grab';
1031
- _this.container.style.cursor = '-webkit-grab';
1032
- }
1033
-
1034
- /*=========================
1035
- Slides Events Handlers
1036
- ===========================*/
1037
- _this.allowSlideClick = true;
1038
-
1039
- function slideClick(e) {
1040
- if (_this.allowSlideClick) {
1041
- _this.clickedSlide = this;
1042
- _this.clickedSlideIndex = _this.slides.indexOf(this);
1043
- params.onSlideClick(_this);
1044
- }
1045
- }
1046
-
1047
- function slideTouch(e) {
1048
- _this.clickedSlide = this;
1049
- _this.clickedSlideIndex = _this.slides.indexOf(this);
1050
- params.onSlideTouch(_this);
1051
- }
1052
- _this.allowLinks = true;
1053
-
1054
- function preventClick(e) {
1055
- if (!_this.allowLinks) {
1056
- if (e.preventDefault) e.preventDefault();
1057
- else e.returnValue = false;
1058
- return false;
1059
- }
1060
- }
1061
-
1062
- function releaseForms(e) {
1063
- if (e.stopPropagation) e.stopPropagation();
1064
- else e.returnValue = false;
1065
- return false;
1066
- }
1067
-
1068
- /*==================================================
1069
- Event Handlers
1070
- ====================================================*/
1071
- var isTouchEvent = false;
1072
- var allowThresholdMove;
1073
- var allowMomentumBounce = true;
1074
-
1075
- function onTouchStart(event) {
1076
- if (params.preventLinks) _this.allowLinks = true;
1077
- //Exit if slider is already was touched
1078
- if (_this.isTouched || params.onlyExternal) {
1079
- return false;
1080
- }
1081
-
1082
- if (params.noSwiping && event.target && event.target.className && event.target.className.indexOf(params.noSwipingClass) > -1) return false;
1083
- allowMomentumBounce = false;
1084
-
1085
- //Check For Nested Swipers
1086
- _this.isTouched = true;
1087
- isTouchEvent = event.type == 'touchstart';
1088
-
1089
- if (!isTouchEvent || event.targetTouches.length == 1) {
1090
- if (params.loop) _this.fixLoop();
1091
- _this.callPlugins('onTouchStartBegin');
1092
-
1093
- if (!isTouchEvent) {
1094
- if (event.preventDefault) event.preventDefault();
1095
- else event.returnValue = false;
1096
- }
1097
-
1098
- var pageX = isTouchEvent ? event.targetTouches[0].pageX : (event.pageX || event.clientX);
1099
- var pageY = isTouchEvent ? event.targetTouches[0].pageY : (event.pageY || event.clientY);
1100
-
1101
- //Start Touches to check the scrolling
1102
- _this.touches.startX = _this.touches.currentX = pageX;
1103
- _this.touches.startY = _this.touches.currentY = pageY;
1104
-
1105
- _this.touches.start = _this.touches.current = isH ? pageX : pageY;
1106
-
1107
- //Set Transition Time to 0
1108
- _this.setWrapperTransition(0);
1109
-
1110
- //Get Start Translate Position
1111
- _this.positions.start = _this.positions.current = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
1112
-
1113
- //Set Transform
1114
- if (isH) {
1115
- _this.setWrapperTranslate(_this.positions.start, 0, 0);
1116
- } else {
1117
- _this.setWrapperTranslate(0, _this.positions.start, 0);
1118
- }
1119
-
1120
- //TouchStartTime
1121
- _this.times.start = (new Date()).getTime();
1122
-
1123
- //Unset Scrolling
1124
- isScrolling = undefined;
1125
-
1126
- //Set Treshold
1127
- if (params.moveStartThreshold > 0) allowThresholdMove = false;
1128
-
1129
- //CallBack
1130
- if (params.onTouchStart) params.onTouchStart(_this);
1131
- _this.callPlugins('onTouchStartEnd');
1132
-
1133
- }
1134
- }
1135
- var velocityPrevPosition, velocityPrevTime;
1136
-
1137
- function onTouchMove(event) {
1138
- // If slider is not touched - exit
1139
- if (!_this.isTouched || params.onlyExternal) return;
1140
- if (isTouchEvent && event.type == 'mousemove') return;
1141
-
1142
- var pageX = isTouchEvent ? event.targetTouches[0].pageX : (event.pageX || event.clientX);
1143
- var pageY = isTouchEvent ? event.targetTouches[0].pageY : (event.pageY || event.clientY);
1144
-
1145
- //check for scrolling
1146
- if (typeof isScrolling === 'undefined' && isH) {
1147
- isScrolling = !! (isScrolling || Math.abs(pageY - _this.touches.startY) > Math.abs(pageX - _this.touches.startX));
1148
- }
1149
- if (typeof isScrolling === 'undefined' && !isH) {
1150
- isScrolling = !! (isScrolling || Math.abs(pageY - _this.touches.startY) < Math.abs(pageX - _this.touches.startX));
1151
- }
1152
- if (isScrolling) {
1153
- _this.isTouched = false;
1154
- return
1155
- }
1156
-
1157
- //Check For Nested Swipers
1158
- if (event.assignedToSwiper) {
1159
- _this.isTouched = false;
1160
- return
1161
- }
1162
- event.assignedToSwiper = true;
1163
-
1164
- //Moved Flag
1165
- _this.isMoved = true;
1166
-
1167
- //Block inner links
1168
- if (params.preventLinks) {
1169
- _this.allowLinks = false;
1170
- }
1171
- if (params.onSlideClick) {
1172
- _this.allowSlideClick = false;
1173
- }
1174
-
1175
- //Stop AutoPlay if exist
1176
- if (params.autoplay) {
1177
- _this.stopAutoplay();
1178
- }
1179
- if (!isTouchEvent || event.touches.length == 1) {
1180
-
1181
- _this.callPlugins('onTouchMoveStart');
1182
-
1183
- if (event.preventDefault) event.preventDefault();
1184
- else event.returnValue = false;
1185
-
1186
- _this.touches.current = isH ? pageX : pageY;
1187
-
1188
- _this.positions.current = (_this.touches.current - _this.touches.start) * params.touchRatio + _this.positions.start;
1189
-
1190
- //Resistance Callbacks
1191
- if (_this.positions.current > 0 && params.onResistanceBefore) {
1192
- params.onResistanceBefore(_this, _this.positions.current);
1193
- }
1194
- if (_this.positions.current < -maxWrapperPosition() && params.onResistanceBefore) {
1195
- params.onResistanceAfter(_this, Math.abs(_this.positions.current + maxWrapperPosition()));
1196
- }
1197
- //Resistance
1198
- if (params.resistance && params.resistance != '100%') {
1199
- //Resistance for Negative-Back sliding
1200
- if (_this.positions.current > 0) {
1201
- var resistance = 1 - _this.positions.current / containerSize / 2;
1202
- if (resistance < 0.5) _this.positions.current = (containerSize / 2);
1203
- else _this.positions.current = _this.positions.current * resistance;
1204
- }
1205
- //Resistance for After-End Sliding
1206
- if (_this.positions.current < -maxWrapperPosition()) {
1207
-
1208
- var diff = (_this.touches.current - _this.touches.start) * params.touchRatio + (maxWrapperPosition() + _this.positions.start);
1209
- var resistance = (containerSize + diff) / (containerSize);
1210
- var newPos = _this.positions.current - diff * (1 - resistance) / 2;
1211
- var stopPos = -maxWrapperPosition() - containerSize / 2;
1212
-
1213
- if (newPos < stopPos || resistance <= 0) _this.positions.current = stopPos;
1214
- else _this.positions.current = newPos;
1215
- }
1216
- }
1217
- if (params.resistance && params.resistance == '100%') {
1218
- //Resistance for Negative-Back sliding
1219
- if (_this.positions.current > 0 && !(params.freeMode && !params.freeModeFluid)) {
1220
- _this.positions.current = 0;
1221
- }
1222
- //Resistance for After-End Sliding
1223
- if ((_this.positions.current) < -maxWrapperPosition() && !(params.freeMode && !params.freeModeFluid)) {
1224
- _this.positions.current = -maxWrapperPosition();
1225
- }
1226
- }
1227
- //Move Slides
1228
- if (!params.followFinger) return
1229
-
1230
- if (!params.moveStartThreshold) {
1231
- if (isH) _this.setWrapperTranslate(_this.positions.current, 0, 0);
1232
- else _this.setWrapperTranslate(0, _this.positions.current, 0);
1233
- } else {
1234
- if (Math.abs(_this.touches.current - _this.touches.start) > params.moveStartThreshold || allowThresholdMove) {
1235
- allowThresholdMove = true;
1236
- if (isH) _this.setWrapperTranslate(_this.positions.current, 0, 0);
1237
- else _this.setWrapperTranslate(0, _this.positions.current, 0);
1238
- } else {
1239
- _this.positions.current = _this.positions.start;
1240
- }
1241
- }
1242
-
1243
- if (params.freeMode || params.watchActiveIndex) {
1244
- _this.updateActiveSlide(_this.positions.current);
1245
- }
1246
-
1247
- //Grab Cursor
1248
- if (params.grabCursor) {
1249
- _this.container.style.cursor = 'move';
1250
- _this.container.style.cursor = 'grabbing';
1251
- _this.container.style.cursor = '-moz-grabbin';
1252
- _this.container.style.cursor = '-webkit-grabbing';
1253
- }
1254
- //Velocity
1255
- if (!velocityPrevPosition) velocityPrevPosition = _this.touches.current;
1256
- if (!velocityPrevTime) velocityPrevTime = (new Date).getTime();
1257
- _this.velocity = (_this.touches.current - velocityPrevPosition) / ((new Date).getTime() - velocityPrevTime) / 2;
1258
- if (Math.abs(_this.touches.current - velocityPrevPosition) < 2) _this.velocity = 0;
1259
- velocityPrevPosition = _this.touches.current;
1260
- velocityPrevTime = (new Date).getTime();
1261
- //Callbacks
1262
- _this.callPlugins('onTouchMoveEnd');
1263
- if (params.onTouchMove) params.onTouchMove(_this);
1264
-
1265
- return false;
1266
- }
1267
- }
1268
-
1269
- function onTouchEnd(event) {
1270
- //Check For scrolling
1271
- if (isScrolling) {
1272
- _this.swipeReset();
1273
- }
1274
- // If slider is not touched exit
1275
- if (params.onlyExternal || !_this.isTouched) return;
1276
- _this.isTouched = false
1277
-
1278
- //Return Grab Cursor
1279
- if (params.grabCursor) {
1280
- _this.container.style.cursor = 'move';
1281
- _this.container.style.cursor = 'grab';
1282
- _this.container.style.cursor = '-moz-grab';
1283
- _this.container.style.cursor = '-webkit-grab';
1284
- }
1285
-
1286
- //Check for Current Position
1287
- if (!_this.positions.current && _this.positions.current !== 0) {
1288
- _this.positions.current = _this.positions.start
1289
- }
1290
-
1291
- //For case if slider touched but not moved
1292
- if (params.followFinger) {
1293
- if (isH) _this.setWrapperTranslate(_this.positions.current, 0, 0)
1294
- else _this.setWrapperTranslate(0, _this.positions.current, 0)
1295
- }
1296
- //--
1297
-
1298
- // TouchEndTime
1299
- _this.times.end = (new Date()).getTime();
1300
-
1301
- //Difference
1302
- _this.touches.diff = _this.touches.current - _this.touches.start
1303
- _this.touches.abs = Math.abs(_this.touches.diff)
1304
-
1305
- _this.positions.diff = _this.positions.current - _this.positions.start
1306
- _this.positions.abs = Math.abs(_this.positions.diff)
1307
-
1308
- var diff = _this.positions.diff;
1309
- var diffAbs = _this.positions.abs;
1310
- var timeDiff = _this.times.end - _this.times.start
1311
-
1312
- if (diffAbs < 5 && (timeDiff) < 300 && _this.allowLinks == false) {
1313
- if (!params.freeMode && diffAbs != 0) _this.swipeReset()
1314
- //Release inner links
1315
- if (params.preventLinks) {
1316
- _this.allowLinks = true;
1317
- }
1318
- if (params.onSlideClick) {
1319
- _this.allowSlideClick = true;
1320
- }
1321
- }
1322
- setTimeout(function () {
1323
- //Release inner links
1324
- if (params.preventLinks) {
1325
- _this.allowLinks = true;
1326
- }
1327
- if (params.onSlideClick) {
1328
- _this.allowSlideClick = true;
1329
- }
1330
- }, 100)
1331
-
1332
-
1333
- //Exit if not moved
1334
- if (!_this.isMoved) {
1335
- _this.isMoved = false;
1336
- if (params.onTouchEnd) params.onTouchEnd(_this)
1337
- _this.callPlugins('onTouchEnd');
1338
- return;
1339
- }
1340
- _this.isMoved = false;
1341
-
1342
- var maxPosition = maxWrapperPosition();
1343
-
1344
- //Prevent Negative Back Sliding
1345
- if (_this.positions.current > 0) {
1346
- _this.swipeReset()
1347
- if (params.onTouchEnd) params.onTouchEnd(_this)
1348
- _this.callPlugins('onTouchEnd');
1349
- return;
1350
- }
1351
- //Prevent After-End Sliding
1352
- if (_this.positions.current < -maxPosition) {
1353
- _this.swipeReset()
1354
- if (params.onTouchEnd) params.onTouchEnd(_this)
1355
- _this.callPlugins('onTouchEnd');
1356
- return;
1357
- }
1358
-
1359
- //Free Mode
1360
- if (params.freeMode) {
1361
- if (params.freeModeFluid) {
1362
- var momentumDuration = 1000 * params.momentumRatio;
1363
- var momentumDistance = _this.velocity * momentumDuration;
1364
- var newPosition = _this.positions.current + momentumDistance
1365
- var doBounce = false;
1366
- var afterBouncePosition;
1367
- var bounceAmount = Math.abs(_this.velocity) * 20 * params.momentumBounceRatio;
1368
- if (newPosition < -maxPosition) {
1369
- if (params.momentumBounce && _this.support.transitions) {
1370
- if (newPosition + maxPosition < -bounceAmount) newPosition = -maxPosition - bounceAmount;
1371
- afterBouncePosition = -maxPosition;
1372
- doBounce = true;
1373
- allowMomentumBounce = true;
1374
- } else newPosition = -maxPosition;
1375
- }
1376
- if (newPosition > 0) {
1377
- if (params.momentumBounce && _this.support.transitions) {
1378
- if (newPosition > bounceAmount) newPosition = bounceAmount;
1379
- afterBouncePosition = 0
1380
- doBounce = true;
1381
- allowMomentumBounce = true;
1382
- } else newPosition = 0;
1383
- }
1384
- //Fix duration
1385
- if (_this.velocity != 0) momentumDuration = Math.abs((newPosition - _this.positions.current) / _this.velocity)
1386
-
1387
- if (isH) _this.setWrapperTranslate(newPosition, 0, 0);
1388
- else _this.setWrapperTranslate(0, newPosition, 0);
1389
-
1390
- _this.setWrapperTransition(momentumDuration);
1391
-
1392
- if (params.momentumBounce && doBounce) {
1393
- _this.wrapperTransitionEnd(function () {
1394
- if (!allowMomentumBounce) return;
1395
- if (params.onMomentumBounce) params.onMomentumBounce(_this);
1396
- if (isH) _this.setWrapperTranslate(afterBouncePosition, 0, 0);
1397
- else _this.setWrapperTranslate(0, afterBouncePosition, 0);
1398
- _this.setWrapperTransition(300);
1399
- })
1400
- }
1401
-
1402
- _this.updateActiveSlide(newPosition)
1403
- }
1404
- if (!params.freeModeFluid || timeDiff >= 300) _this.updateActiveSlide(_this.positions.current)
1405
-
1406
- if (params.onTouchEnd) params.onTouchEnd(_this)
1407
- _this.callPlugins('onTouchEnd');
1408
- return;
1409
- }
1410
-
1411
- //Direction
1412
- direction = diff < 0 ? "toNext" : "toPrev"
1413
-
1414
- //Short Touches
1415
- if (direction == "toNext" && (timeDiff <= 300)) {
1416
- if (diffAbs < 30 || !params.shortSwipes) _this.swipeReset()
1417
- else _this.swipeNext(true);
1418
- }
1419
-
1420
- if (direction == "toPrev" && (timeDiff <= 300)) {
1421
- if (diffAbs < 30 || !params.shortSwipes) _this.swipeReset()
1422
- else _this.swipePrev(true);
1423
- }
1424
-
1425
- //Long Touches
1426
- var targetSlideSize = 0;
1427
- if (params.slidesPerView == 'auto') {
1428
- //Define current slide's width
1429
- var currentPosition = Math.abs(isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y'));
1430
- var slidesOffset = 0;
1431
- var _slideSize;
1432
- for (var i = 0; i < _this.slides.length; i++) {
1433
- _slideSize = isH ? _this.slides[i].getWidth(true) : _this.slides[i].getHeight(true);
1434
- slidesOffset += _slideSize;
1435
- if (slidesOffset > currentPosition) {
1436
- targetSlideSize = _slideSize;
1437
- break;
1438
- }
1439
- }
1440
- if (targetSlideSize > containerSize) targetSlideSize = containerSize;
1441
- } else {
1442
- targetSlideSize = slideSize * params.slidesPerView;
1443
- }
1444
- if (direction == "toNext" && (timeDiff > 300)) {
1445
- if (diffAbs >= targetSlideSize * 0.5) {
1446
- _this.swipeNext(true)
1447
- } else {
1448
- _this.swipeReset()
1449
- }
1450
- }
1451
- if (direction == "toPrev" && (timeDiff > 300)) {
1452
- if (diffAbs >= targetSlideSize * 0.5) {
1453
- _this.swipePrev(true);
1454
- } else {
1455
- _this.swipeReset()
1456
- }
1457
- }
1458
- if (params.onTouchEnd) params.onTouchEnd(_this)
1459
- _this.callPlugins('onTouchEnd');
1460
- }
1461
-
1462
- /*==================================================
1463
- Swipe Functions
1464
- ====================================================*/
1465
- _this.swipeNext = function (internal) {
1466
- if (!internal && params.loop) _this.fixLoop();
1467
- _this.callPlugins('onSwipeNext');
1468
- var currentPosition = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
1469
- var newPosition = currentPosition;
1470
- if (params.slidesPerView == 'auto') {
1471
- for (var i = 0; i < _this.snapGrid.length; i++) {
1472
- if (-currentPosition >= _this.snapGrid[i] && -currentPosition < _this.snapGrid[i + 1]) {
1473
- newPosition = -_this.snapGrid[i + 1]
1474
- break;
1475
- }
1476
- }
1477
- } else {
1478
- var groupSize = slideSize * params.slidesPerGroup;
1479
- newPosition = -(Math.floor(Math.abs(currentPosition) / Math.floor(groupSize)) * groupSize + groupSize);
1480
- }
1481
- if (newPosition < -maxWrapperPosition()) {
1482
- newPosition = -maxWrapperPosition()
1483
- };
1484
-
1485
- if (newPosition == currentPosition) return false;
1486
-
1487
- swipeToPosition(newPosition, 'next');
1488
- return true
1489
- }
1490
- _this.swipePrev = function (internal) {
1491
- if (!internal && params.loop) _this.fixLoop();
1492
- if (!internal && params.autoplay) _this.stopAutoplay();
1493
- _this.callPlugins('onSwipePrev');
1494
-
1495
- var currentPosition = Math.ceil(isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y'));
1496
- var newPosition;
1497
- if (params.slidesPerView == 'auto') {
1498
- newPosition = 0;
1499
- for (var i = 1; i < _this.snapGrid.length; i++) {
1500
- if (-currentPosition == _this.snapGrid[i]) {
1501
- newPosition = -_this.snapGrid[i - 1]
1502
- break;
1503
- }
1504
- if (-currentPosition > _this.snapGrid[i] && -currentPosition < _this.snapGrid[i + 1]) {
1505
- newPosition = -_this.snapGrid[i]
1506
- break;
1507
- }
1508
- }
1509
- } else {
1510
- var groupSize = slideSize * params.slidesPerGroup;
1511
- newPosition = -(Math.ceil(-currentPosition / groupSize) - 1) * groupSize;
1512
- }
1513
-
1514
- if (newPosition > 0) newPosition = 0;
1515
-
1516
- if (newPosition == currentPosition) return false;
1517
- swipeToPosition(newPosition, 'prev');
1518
- return true;
1519
-
1520
- }
1521
- _this.swipeReset = function () {
1522
- _this.callPlugins('onSwipeReset');
1523
- var currentPosition = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
1524
- var groupSize = slideSize * params.slidesPerGroup;
1525
- var newPosition;
1526
- var maxPosition = -maxWrapperPosition();
1527
- if (params.slidesPerView == 'auto') {
1528
- newPosition = 0;
1529
- for (var i = 0; i < _this.snapGrid.length; i++) {
1530
- if (-currentPosition === _this.snapGrid[i]) return;
1531
- if (-currentPosition >= _this.snapGrid[i] && -currentPosition < _this.snapGrid[i + 1]) {
1532
- if (_this.positions.diff > 0) newPosition = -_this.snapGrid[i + 1]
1533
- else newPosition = -_this.snapGrid[i]
1534
- break;
1535
- }
1536
- }
1537
- if (-currentPosition >= _this.snapGrid[_this.snapGrid.length - 1]) newPosition = -_this.snapGrid[_this.snapGrid.length - 1];
1538
- if (currentPosition <= -maxWrapperPosition()) newPosition = -maxWrapperPosition()
1539
- } else {
1540
- newPosition = currentPosition < 0 ? Math.round(currentPosition / groupSize) * groupSize : 0
1541
- }
1542
- if (params.scrollContainer) {
1543
- newPosition = currentPosition < 0 ? currentPosition : 0;
1544
- }
1545
- if (newPosition < -maxWrapperPosition()) {
1546
- newPosition = -maxWrapperPosition()
1547
- }
1548
- if (params.scrollContainer && (containerSize > slideSize)) {
1549
- newPosition = 0;
1550
- }
1551
-
1552
- if (newPosition == currentPosition) return false;
1553
-
1554
- swipeToPosition(newPosition, 'reset');
1555
- return true;
1556
- }
1557
- _this.swipeTo = function (index, speed, runCallbacks) {
1558
- index = parseInt(index, 10);
1559
- _this.callPlugins('onSwipeTo', {
1560
- index: index,
1561
- speed: speed
1562
- });
1563
- if (params.loop) index = index + _this.loopedSlides;
1564
- var currentPosition = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
1565
- if (index > (_this.slides.length - 1)) return;
1566
- if (index < 0) return;
1567
- var newPosition
1568
- if (params.slidesPerView == 'auto') {
1569
- newPosition = -_this.slidesGrid[index];
1570
- } else {
1571
- newPosition = -index * slideSize;
1572
- }
1573
- if (newPosition < -maxWrapperPosition()) {
1574
- newPosition = -maxWrapperPosition();
1575
- };
1576
-
1577
- if (newPosition == currentPosition) return false;
1578
-
1579
- runCallbacks = runCallbacks === false ? false : true;
1580
- swipeToPosition(newPosition, 'to', {
1581
- index: index,
1582
- speed: speed,
1583
- runCallbacks: runCallbacks
1584
- });
1585
- return true;
1586
- }
1587
-
1588
- function swipeToPosition(newPosition, action, toOptions) {
1589
- if (_this.support.transitions || !params.DOMAnimation) {
1590
- if (isH) _this.setWrapperTranslate(newPosition, 0, 0);
1591
- else _this.setWrapperTranslate(0, newPosition, 0);
1592
- var speed = (action == 'to' && toOptions.speed >= 0) ? toOptions.speed : params.speed;
1593
- _this.setWrapperTransition(speed);
1594
- } else {
1595
- //Try the DOM animation
1596
- var currentPosition = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
1597
- var speed = (action == 'to' && toOptions.speed >= 0) ? toOptions.speed : params.speed;
1598
- var animationStep = Math.ceil((newPosition - currentPosition) / speed * (1000 / 60));
1599
- var direction = currentPosition > newPosition ? 'toNext' : 'toPrev';
1600
- var condition = direction == 'toNext' ? currentPosition > newPosition : currentPosition < newPosition;
1601
- if (_this._DOMAnimating) return;
1602
-
1603
- anim()
1604
- }
1605
-
1606
- function anim() {
1607
- currentPosition += animationStep;
1608
- condition = direction == 'toNext' ? currentPosition > newPosition : currentPosition < newPosition;
1609
- if (condition) {
1610
- if (isH) _this.setWrapperTranslate(Math.round(currentPosition), 0)
1611
- else _this.setWrapperTranslate(0, Math.round(currentPosition))
1612
- _this._DOMAnimating = true
1613
- window.setTimeout(function () {
1614
- anim()
1615
- }, 1000 / 60)
1616
- } else {
1617
- if (params.onSlideChangeEnd) params.onSlideChangeEnd(_this)
1618
- if (isH) _this.setWrapperTranslate(newPosition, 0);
1619
- else _this.setWrapperTranslate(0, newPosition);
1620
- _this._DOMAnimating = false;
1621
- }
1622
- }
1623
-
1624
- //Update Active Slide Index
1625
- _this.updateActiveSlide(newPosition);
1626
-
1627
- //Callbacks
1628
- if (params.onSlideNext && action == 'next') {
1629
- params.onSlideNext(_this, newPosition)
1630
- }
1631
- if (params.onSlidePrev && action == 'prev') {
1632
- params.onSlidePrev(_this, newPosition)
1633
- }
1634
- //"Reset" Callback
1635
- if (params.onSlideReset && action == 'reset') {
1636
- params.onSlideReset(_this, newPosition)
1637
- }
1638
-
1639
- //"Next", "Prev" and "To" Callbacks
1640
- if (action == 'next' || action == 'prev' || (action == 'to' && toOptions.runCallbacks == true)) slideChangeCallbacks()
1641
- }
1642
- /*==================================================
1643
- Transition Callbacks
1644
- ====================================================*/
1645
- //Prevent Multiple Callbacks
1646
- _this._queueStartCallbacks = false;
1647
- _this._queueEndCallbacks = false;
1648
-
1649
- function slideChangeCallbacks() {
1650
- //Transition Start Callback
1651
- _this.callPlugins('onSlideChangeStart');
1652
- if (params.onSlideChangeStart) {
1653
- if (params.queueStartCallbacks && _this.support.transitions) {
1654
- if (_this._queueStartCallbacks) return;
1655
- _this._queueStartCallbacks = true;
1656
- params.onSlideChangeStart(_this)
1657
- _this.wrapperTransitionEnd(function () {
1658
- _this._queueStartCallbacks = false;
1659
- })
1660
- } else params.onSlideChangeStart(_this)
1661
- }
1662
- //Transition End Callback
1663
- if (params.onSlideChangeEnd) {
1664
- if (_this.support.transitions) {
1665
- if (params.queueEndCallbacks) {
1666
- if (_this._queueEndCallbacks) return;
1667
- _this._queueEndCallbacks = true;
1668
- _this.wrapperTransitionEnd(params.onSlideChangeEnd)
1669
- } else _this.wrapperTransitionEnd(params.onSlideChangeEnd)
1670
- } else {
1671
- if (!params.DOMAnimation) {
1672
- setTimeout(function () {
1673
- params.onSlideChangeEnd(_this)
1674
- }, 10)
1675
- }
1676
- }
1677
- }
1678
- }
1679
- /*==================================================
1680
- Update Active Slide Index
1681
- ====================================================*/
1682
- _this.updateActiveSlide = function (position) {
1683
- if (!_this.initialized) return;
1684
- if (_this.slides.length == 0) return;
1685
- _this.previousIndex = _this.activeIndex;
1686
- if (position > 0) position = 0;
1687
- if (typeof position == 'undefined') position = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
1688
-
1689
- if (params.slidesPerView == 'auto') {
1690
- var slidesOffset = 0;
1691
- _this.activeIndex = _this.slidesGrid.indexOf(-position);
1692
- if (_this.activeIndex < 0) {
1693
- for (var i = 0; i < _this.slidesGrid.length - 1; i++) {
1694
- if (-position > _this.slidesGrid[i] && -position < _this.slidesGrid[i + 1]) {
1695
- break;
1696
- }
1697
- }
1698
- var leftDistance = Math.abs(_this.slidesGrid[i] + position)
1699
- var rightDistance = Math.abs(_this.slidesGrid[i + 1] + position)
1700
- if (leftDistance <= rightDistance) _this.activeIndex = i;
1701
- else _this.activeIndex = i + 1;
1702
- }
1703
- } else {
1704
- if (params.visibilityFullFit) _this.activeIndex = Math.ceil(-position / slideSize);
1705
- else _this.activeIndex = Math.round(-position / slideSize);
1706
- }
1707
- if (_this.activeIndex == _this.slides.length) _this.activeIndex = _this.slides.length - 1;
1708
- if (_this.activeIndex < 0) _this.activeIndex = 0;
1709
- // Check for slide
1710
- if (!_this.slides[_this.activeIndex]) return;
1711
- // Calc Visible slides
1712
- _this.calcVisibleSlides(position);
1713
-
1714
- // Mark visible and active slides with additonal classes
1715
- var activeClassRegexp = new RegExp("\\s*" + params.slideActiveClass);
1716
- var inViewClassRegexp = new RegExp("\\s*" + params.slideVisibleClass);
1717
-
1718
- for (var i = 0; i < _this.slides.length; i++) {
1719
- _this.slides[i].className = _this.slides[i].className.replace(activeClassRegexp, '').replace(inViewClassRegexp, '');
1720
- if (_this.visibleSlides.indexOf(_this.slides[i]) >= 0) {
1721
- _this.slides[i].className += ' ' + params.slideVisibleClass;
1722
- }
1723
-
1724
- }
1725
- _this.slides[_this.activeIndex].className += ' ' + params.slideActiveClass;
1726
-
1727
- //Update loop index
1728
- if (params.loop) {
1729
- var ls = _this.loopedSlides;
1730
- _this.activeLoopIndex = _this.activeIndex - ls;
1731
- if (_this.activeLoopIndex >= _this.slides.length - ls * 2) {
1732
- _this.activeLoopIndex = _this.slides.length - ls * 2 - _this.activeLoopIndex;
1733
- }
1734
- if (_this.activeLoopIndex < 0) {
1735
- _this.activeLoopIndex = _this.slides.length - ls * 2 + _this.activeLoopIndex;
1736
- }
1737
- } else {
1738
- _this.activeLoopIndex = _this.activeIndex;
1739
- }
1740
- //Update Pagination
1741
- if (params.pagination) {
1742
- _this.updatePagination(position);
1743
- }
1744
- }
1745
- /*==================================================
1746
- Pagination
1747
- ====================================================*/
1748
- _this.createPagination = function (firstInit) {
1749
- if (params.paginationClickable && _this.paginationButtons) {
1750
- removePaginationEvents();
1751
- }
1752
- var paginationHTML = "";
1753
- var numOfSlides = _this.slides.length;
1754
- var numOfButtons = numOfSlides;
1755
- if (params.loop) numOfButtons -= _this.loopedSlides * 2
1756
- for (var i = 0; i < numOfButtons; i++) {
1757
- paginationHTML += '<' + params.paginationElement + ' class="' + params.paginationElementClass + '"></' + params.paginationElement + '>'
1758
- }
1759
- _this.paginationContainer = params.pagination.nodeType ? params.pagination : $(params.pagination)[0];
1760
- _this.paginationContainer.innerHTML = paginationHTML;
1761
- _this.paginationButtons = []
1762
- if (document.querySelectorAll) _this.paginationButtons = _this.paginationContainer.querySelectorAll('.' + params.paginationElementClass);
1763
- else if (window.jQuery) _this.paginationButtons = $(_this.paginationContainer).find('.' + params.paginationElementClass);
1764
-
1765
- if (!firstInit) _this.updatePagination()
1766
- _this.callPlugins('onCreatePagination');
1767
- if (params.paginationClickable) {
1768
- addPaginationEvents();
1769
- }
1770
- }
1771
-
1772
- function removePaginationEvents() {
1773
- var pagers = _this.paginationButtons;
1774
- for (var i = 0; i < pagers.length; i++) {
1775
- _this.h.removeEventListener(pagers[i], 'click', paginationClick, false)
1776
- }
1777
- }
1778
-
1779
- function addPaginationEvents() {
1780
- var pagers = _this.paginationButtons;
1781
- for (var i = 0; i < pagers.length; i++) {
1782
- _this.h.addEventListener(pagers[i], 'click', paginationClick, false)
1783
- }
1784
- }
1785
-
1786
- function paginationClick(e) {
1787
- var index;
1788
- var target = e.target || e.srcElement;
1789
- var pagers = _this.paginationButtons;
1790
- for (var i = 0; i < pagers.length; i++) {
1791
- if (target === pagers[i]) index = i;
1792
- }
1793
- _this.swipeTo(index)
1794
- }
1795
- _this.updatePagination = function (position) {
1796
- if (_this.slides.length < 1) return;
1797
-
1798
- if (document.querySelectorAll) var activePagers = _this.paginationContainer.querySelectorAll('.' + params.paginationActiveClass)
1799
- else if (window.jQuery) var activePagers = $(_this.paginationContainer).find('.' + params.paginationActiveClass);
1800
-
1801
- if (!activePagers) return
1802
- //Reset all Buttons' class to not active
1803
- var pagers = _this.paginationButtons;
1804
- for (var i = 0; i < pagers.length; i++) {
1805
- pagers[i].className = params.paginationElementClass
1806
- }
1807
- var indexOffset = params.loop ? _this.loopedSlides : 0;
1808
- if (params.paginationAsRange) {
1809
- if (!_this.visibleSlides) _this.calcVisibleSlides(position)
1810
- //Get Visible Indexes
1811
- var visibleIndexes = [];
1812
- for (var i = 0; i < _this.visibleSlides.length; i++) {
1813
- var visIndex = _this.slides.indexOf(_this.visibleSlides[i]) - indexOffset
1814
-
1815
- if (params.loop && visIndex < 0) {
1816
- visIndex = _this.slides.length - _this.loopedSlides * 2 + visIndex;
1817
- }
1818
- if (params.loop && visIndex >= _this.slides.length - _this.loopedSlides * 2) {
1819
- visIndex = _this.slides.length - _this.loopedSlides * 2 - visIndex;
1820
- visIndex = Math.abs(visIndex)
1821
- }
1822
- visibleIndexes.push(visIndex)
1823
- }
1824
- for (i = 0; i < visibleIndexes.length; i++) {
1825
- if (pagers[visibleIndexes[i]]) pagers[visibleIndexes[i]].className += ' ' + params.paginationVisibleClass;
1826
- }
1827
- if (params.loop) {
1828
- pagers[_this.activeLoopIndex].className += ' ' + params.paginationActiveClass;
1829
- } else {
1830
- pagers[_this.activeIndex].className += ' ' + params.paginationActiveClass;
1831
- }
1832
- } else {
1833
- if (params.loop) {
1834
- pagers[_this.activeLoopIndex].className += ' ' + params.paginationActiveClass + ' ' + params.paginationVisibleClass;
1835
- } else {
1836
- pagers[_this.activeIndex].className += ' ' + params.paginationActiveClass + ' ' + params.paginationVisibleClass;
1837
- }
1838
-
1839
- }
1840
-
1841
- }
1842
- _this.calcVisibleSlides = function (position) {
1843
- var visibleSlides = [];
1844
- var _slideLeft = 0,
1845
- _slideSize = 0,
1846
- _slideRight = 0;
1847
- if (isH && _this.wrapperLeft > 0) position = position + _this.wrapperLeft;
1848
- if (!isH && _this.wrapperTop > 0) position = position + _this.wrapperTop;
1849
-
1850
- for (var i = 0; i < _this.slides.length; i++) {
1851
- _slideLeft += _slideSize;
1852
- if (params.slidesPerView == 'auto') _slideSize = isH ? _this.h.getWidth(_this.slides[i], true) : _this.h.getHeight(_this.slides[i], true);
1853
- else _slideSize = slideSize;
1854
-
1855
- _slideRight = _slideLeft + _slideSize;
1856
- var isVisibile = false;
1857
- if (params.visibilityFullFit) {
1858
- if (_slideLeft >= -position && _slideRight <= -position + containerSize) isVisibile = true;
1859
- if (_slideLeft <= -position && _slideRight >= -position + containerSize) isVisibile = true;
1860
- } else {
1861
-
1862
- if (_slideRight > -position && _slideRight <= ((-position + containerSize))) isVisibile = true;
1863
- if (_slideLeft >= -position && _slideLeft < ((-position + containerSize))) isVisibile = true;
1864
- if (_slideLeft < -position && _slideRight > ((-position + containerSize))) isVisibile = true;
1865
- }
1866
-
1867
- if (isVisibile) visibleSlides.push(_this.slides[i])
1868
-
1869
- }
1870
- if (visibleSlides.length == 0) visibleSlides = [_this.slides[_this.activeIndex]]
1871
-
1872
- _this.visibleSlides = visibleSlides;
1873
- }
1874
-
1875
- /*==========================================
1876
- Autoplay
1877
- ============================================*/
1878
- _this.autoPlayIntervalId = undefined;
1879
- _this.startAutoplay = function () {
1880
- if (typeof _this.autoPlayIntervalId !== 'undefined') return false;
1881
- if (params.autoplay && !params.loop) {
1882
- _this.autoPlayIntervalId = setInterval(function () {
1883
- if (!_this.swipeNext(true)) _this.swipeTo(0);
1884
- }, params.autoplay)
1885
- }
1886
- if (params.autoplay && params.loop) {
1887
- _this.autoPlayIntervalId = setInterval(function () {
1888
- _this.swipeNext();
1889
- }, params.autoplay)
1890
- }
1891
- _this.callPlugins('onAutoplayStart');
1892
- }
1893
- _this.stopAutoplay = function () {
1894
- if (_this.autoPlayIntervalId) clearInterval(_this.autoPlayIntervalId);
1895
- _this.autoPlayIntervalId = undefined;
1896
- _this.callPlugins('onAutoplayStop');
1897
- }
1898
- /*==================================================
1899
- Loop
1900
- ====================================================*/
1901
- _this.loopCreated = false;
1902
- _this.removeLoopedSlides = function () {
1903
- if (_this.loopCreated) {
1904
- for (var i = 0; i < _this.slides.length; i++) {
1905
- if (_this.slides[i].getData('looped') === true) _this.wrapper.removeChild(_this.slides[i]);
1906
- }
1907
- }
1908
- }
1909
- _this.createLoop = function () {
1910
- if (_this.slides.length == 0) return;
1911
- _this.loopedSlides = params.slidesPerView + params.loopAdditionalSlides;
1912
-
1913
- var slideFirstHTML = '';
1914
- var slideLastHTML = '';
1915
-
1916
- //Grab First Slides
1917
- for (var i = 0; i < _this.loopedSlides; i++) {
1918
- slideFirstHTML += _this.slides[i].outerHTML
1919
- }
1920
- //Grab Last Slides
1921
- for (i = _this.slides.length - _this.loopedSlides; i < _this.slides.length; i++) {
1922
- slideLastHTML += _this.slides[i].outerHTML
1923
- }
1924
- wrapper.innerHTML = slideLastHTML + wrapper.innerHTML + slideFirstHTML;
1925
-
1926
- _this.loopCreated = true;
1927
- _this.calcSlides();
1928
-
1929
- //Update Looped Slides with special class
1930
- for (i = 0; i < _this.slides.length; i++) {
1931
- if (i < _this.loopedSlides || i >= _this.slides.length - _this.loopedSlides) _this.slides[i].setData('looped', true);
1932
- }
1933
- _this.callPlugins('onCreateLoop');
1934
-
1935
- }
1936
- _this.fixLoop = function () {
1937
- //Fix For Negative Oversliding
1938
- if (_this.activeIndex < _this.loopedSlides) {
1939
- var newIndex = _this.slides.length - _this.loopedSlides * 3 + _this.activeIndex;
1940
- _this.swipeTo(newIndex, 0, false)
1941
- }
1942
- //Fix For Positive Oversliding
1943
- else if (_this.activeIndex > _this.slides.length - params.slidesPerView * 2) {
1944
- var newIndex = -_this.slides.length + _this.activeIndex + _this.loopedSlides
1945
- _this.swipeTo(newIndex, 0, false)
1946
- }
1947
- }
1948
- /*==================================================
1949
- Slides Loader
1950
- ====================================================*/
1951
- _this.loadSlides = function () {
1952
- var slidesHTML = '';
1953
- _this.activeLoaderIndex = 0;
1954
- var slides = params.loader.slides;
1955
- var slidesToLoad = params.loader.loadAllSlides ? slides.length : params.slidesPerView * (1 + params.loader.surroundGroups);
1956
- for (var i = 0; i < slidesToLoad; i++) {
1957
- if (params.loader.slidesHTMLType == 'outer') slidesHTML += slides[i];
1958
- else {
1959
- slidesHTML += '<' + params.slideElement + ' class="' + params.slideClass + '" data-swiperindex="' + i + '">' + slides[i] + '</' + params.slideElement + '>';
1960
- }
1961
- }
1962
- _this.wrapper.innerHTML = slidesHTML;
1963
- _this.calcSlides(true);
1964
- //Add permanent transitionEnd callback
1965
- if (!params.loader.loadAllSlides) {
1966
- _this.wrapperTransitionEnd(_this.reloadSlides, true);
1967
- }
1968
- }
1969
- _this.reloadSlides = function () {
1970
- var slides = params.loader.slides;
1971
- var newActiveIndex = parseInt(_this.activeSlide().data('swiperindex'), 10)
1972
- if (newActiveIndex < 0 || newActiveIndex > slides.length - 1) return //<-- Exit
1973
- _this.activeLoaderIndex = newActiveIndex;
1974
- var firstIndex = Math.max(0, newActiveIndex - params.slidesPerView * params.loader.surroundGroups)
1975
- var lastIndex = Math.min(newActiveIndex + params.slidesPerView * (1 + params.loader.surroundGroups) - 1, slides.length - 1)
1976
- //Update Transforms
1977
- if (newActiveIndex > 0) {
1978
- var newTransform = -slideSize * (newActiveIndex - firstIndex)
1979
- if (isH) _this.setWrapperTranslate(newTransform, 0, 0)
1980
- else _this.setWrapperTranslate(0, newTransform, 0)
1981
- _this.setWrapperTransition(0)
1982
- }
1983
- //New Slides
1984
- if (params.loader.logic === 'reload') {
1985
- _this.wrapper.innerHTML = '';
1986
- var slidesHTML = '';
1987
- for (var i = firstIndex; i <= lastIndex; i++) {
1988
- slidesHTML += params.loader.slidesHTMLType == 'outer' ? slides[i] : '<' + params.slideElement + ' class="' + params.slideClass + '" data-swiperindex="' + i + '">' + slides[i] + '</' + params.slideElement + '>';
1989
- }
1990
- _this.wrapper.innerHTML = slidesHTML;
1991
- } else {
1992
- var minExistIndex = 1000;
1993
- var maxExistIndex = 0;
1994
- for (var i = 0; i < _this.slides.length; i++) {
1995
- var index = _this.slides[i].data('swiperindex');
1996
- if (index < firstIndex || index > lastIndex) {
1997
- _this.wrapper.removeChild(_this.slides[i]);
1998
- } else {
1999
- minExistIndex = Math.min(index, minExistIndex)
2000
- maxExistIndex = Math.max(index, maxExistIndex)
2001
- }
2002
- }
2003
- for (var i = firstIndex; i <= lastIndex; i++) {
2004
- if (i < minExistIndex) {
2005
- var newSlide = document.createElement(params.slideElement);
2006
- newSlide.className = params.slideClass;
2007
- newSlide.setAttribute('data-swiperindex', i);
2008
- newSlide.innerHTML = slides[i];
2009
- _this.wrapper.insertBefore(newSlide, _this.wrapper.firstChild);
2010
- }
2011
- if (i > maxExistIndex) {
2012
- var newSlide = document.createElement(params.slideElement);
2013
- newSlide.className = params.slideClass;
2014
- newSlide.setAttribute('data-swiperindex', i);
2015
- newSlide.innerHTML = slides[i];
2016
- _this.wrapper.appendChild(newSlide);
2017
- }
2018
- }
2019
- }
2020
- //reInit
2021
- _this.reInit(true);
2022
- }
2023
- /*==================================================
2024
- Make Swiper
2025
- ====================================================*/
2026
- function makeSwiper() {
2027
- _this.calcSlides();
2028
- if (params.loader.slides.length > 0 && _this.slides.length == 0) {
2029
- _this.loadSlides();
2030
- }
2031
- if (params.loop) {
2032
- _this.createLoop();
2033
- }
2034
- _this.init();
2035
- initEvents();
2036
- if (params.pagination && params.createPagination) {
2037
- _this.createPagination(true);
2038
- }
2039
- if (params.loop || params.initialSlide > 0) {
2040
- _this.swipeTo(params.initialSlide, 0, false);
2041
- } else {
2042
- _this.updateActiveSlide(0);
2043
- }
2044
- if (params.autoplay) {
2045
- _this.startAutoplay();
2046
- }
2047
-
2048
- }
2049
- makeSwiper();
2050
- }
2051
-
2052
- Swiper.prototype = {
2053
- plugins: {},
2054
- /*==================================================
2055
- Wrapper Operations
2056
- ====================================================*/
2057
- wrapperTransitionEnd: function (callback, permanent) {
2058
- var a = this
2059
- var el = a.wrapper
2060
- var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
2061
-
2062
- function fireCallBack() {
2063
- callback(a)
2064
- if (a.params.queueEndCallbacks) a._queueEndCallbacks = false
2065
- if (!permanent) {
2066
- for (var i = 0; i < events.length; i++) {
2067
- el.removeEventListener(events[i], fireCallBack, false)
2068
- }
2069
- }
2070
- }
2071
- if (callback) {
2072
- for (var i = 0; i < events.length; i++) {
2073
- el.addEventListener(events[i], fireCallBack, false)
2074
- }
2075
- }
2076
- },
2077
-
2078
- getWrapperTranslate: function (axis) {
2079
- var el = this.wrapper
2080
- var matrix;
2081
- var curTransform;
2082
- if (window.WebKitCSSMatrix) {
2083
- var transformMatrix = new WebKitCSSMatrix(window.getComputedStyle(el, null).webkitTransform)
2084
- matrix = transformMatrix.toString().split(',');
2085
- } else {
2086
- var transformMatrix = window.getComputedStyle(el, null).MozTransform || window.getComputedStyle(el, null).OTransform || window.getComputedStyle(el, null).MsTransform || window.getComputedStyle(el, null).msTransform || window.getComputedStyle(el, null).transform || window.getComputedStyle(el, null).getPropertyValue("transform").replace("translate(", "matrix(1, 0, 0, 1,");
2087
- matrix = transformMatrix.toString().split(',');
2088
-
2089
- }
2090
- if (this.params.useCSS3Transforms) {
2091
- if (axis == 'x') {
2092
- //Crazy IE10 Matrix
2093
- if (matrix.length == 16) curTransform = parseFloat(matrix[12])
2094
- //Latest Chrome and webkits Fix
2095
- else if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41
2096
- //Normal Browsers
2097
- else curTransform = parseFloat(matrix[4])
2098
- }
2099
- if (axis == 'y') {
2100
- //Crazy IE10 Matrix
2101
- if (matrix.length == 16) curTransform = parseFloat(matrix[13])
2102
- //Latest Chrome and webkits Fix
2103
- else if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42
2104
- //Normal Browsers
2105
- else curTransform = parseFloat(matrix[5])
2106
- }
2107
- } else {
2108
- if (axis == 'x') curTransform = parseFloat(el.style.left, 10) || 0
2109
- if (axis == 'y') curTransform = parseFloat(el.style.top, 10) || 0
2110
- }
2111
- return curTransform || 0;
2112
- },
2113
-
2114
- setWrapperTranslate: function (x, y, z) {
2115
- var es = this.wrapper.style
2116
- x = x || 0;
2117
- y = y || 0;
2118
- z = z || 0;
2119
- if (this.params.useCSS3Transforms) {
2120
- if (this.support.transforms3d) {
2121
- es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = 'translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)'
2122
- } else {
2123
-
2124
- es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = 'translate(' + x + 'px, ' + y + 'px)'
2125
- if (!this.support.transforms) {
2126
- es.left = x + 'px'
2127
- es.top = y + 'px'
2128
- }
2129
- }
2130
- } else {
2131
- es.left = x + 'px';
2132
- es.top = y + 'px';
2133
- }
2134
- this.callPlugins('onSetWrapperTransform', {
2135
- x: x,
2136
- y: y,
2137
- z: z
2138
- })
2139
- },
2140
-
2141
- setWrapperTransition: function (duration) {
2142
- var es = this.wrapper.style
2143
- es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = duration / 1000 + 's';
2144
- this.callPlugins('onSetWrapperTransition', {
2145
- duration: duration
2146
- })
2147
- },
2148
-
2149
- /*==================================================
2150
- Helpers
2151
- ====================================================*/
2152
- h: {
2153
- getWidth: function (el, outer) {
2154
- var width = window.getComputedStyle(el, null).getPropertyValue('width')
2155
- var returnWidth = parseFloat(width);
2156
- //IE Fixes
2157
- if (isNaN(returnWidth) || width.indexOf('%') > 0) {
2158
- returnWidth = el.offsetWidth - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-left')) - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-right'));
2159
- }
2160
- if (outer) returnWidth += parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-left')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-right'))
2161
-
2162
- return returnWidth;
2163
- },
2164
- getHeight: function (el, outer) {
2165
- if (outer) return el.offsetHeight;
2166
-
2167
- var height = window.getComputedStyle(el, null).getPropertyValue('height')
2168
- var returnHeight = parseFloat(height);
2169
- //IE Fixes
2170
- if (isNaN(returnHeight) || height.indexOf('%') > 0) {
2171
- returnHeight = el.offsetHeight - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-top')) - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-bottom'));
2172
- }
2173
- if (outer) returnHeight += parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-bottom'))
2174
- return returnHeight;
2175
- },
2176
- getOffset: function (el) {
2177
- var box = el.getBoundingClientRect();
2178
- var body = document.body;
2179
- var clientTop = el.clientTop || body.clientTop || 0;
2180
- var clientLeft = el.clientLeft || body.clientLeft || 0;
2181
- var scrollTop = window.pageYOffset || el.scrollTop;
2182
- var scrollLeft = window.pageXOffset || el.scrollLeft;
2183
- if (document.documentElement && !window.pageYOffset) {
2184
- //IE7-8
2185
- scrollTop = document.documentElement.scrollTop;
2186
- scrollLeft = document.documentElement.scrollLeft;
2187
- }
2188
- return {
2189
- top: box.top + scrollTop - clientTop,
2190
- left: box.left + scrollLeft - clientLeft
2191
- };
2192
- },
2193
- windowWidth: function () {
2194
- if (window.innerWidth) return window.innerWidth
2195
- else if (document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth;
2196
- },
2197
- windowHeight: function () {
2198
- if (window.innerHeight) return window.innerHeight
2199
- else if (document.documentElement && document.documentElement.clientHeight) return document.documentElement.clientHeight;
2200
- },
2201
- windowScroll: function () {
2202
- var left = 0,
2203
- top = 0;
2204
- if (typeof pageYOffset != 'undefined') {
2205
- return {
2206
- left: window.pageXOffset,
2207
- top: window.pageYOffset
2208
- }
2209
- } else if (document.documentElement) {
2210
- return {
2211
- left: document.documentElement.scrollLeft,
2212
- top: document.documentElement.scrollTop
2213
- }
2214
- }
2215
- },
2216
-
2217
- addEventListener: function (el, event, listener, useCapture) {
2218
- if (el.addEventListener) {
2219
- el.addEventListener(event, listener, useCapture)
2220
- } else if (el.attachEvent) {
2221
- el.attachEvent('on' + event, listener)
2222
- }
2223
- },
2224
- removeEventListener: function (el, event, listener, useCapture) {
2225
- if (el.removeEventListener) {
2226
- el.removeEventListener(event, listener, useCapture)
2227
- } else if (el.detachEvent) {
2228
- el.detachEvent('on' + event, listener)
2229
- }
2230
- }
2231
- },
2232
- setTransform: function (el, transform) {
2233
- var es = el.style
2234
- es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transform
2235
- },
2236
- setTranslate: function (el, translate) {
2237
- var es = el.style
2238
- var pos = {
2239
- x: translate.x || 0,
2240
- y: translate.y || 0,
2241
- z: translate.z || 0
2242
- };
2243
- var transformString = this.support.transforms3d ? 'translate3d(' + (pos.x) + 'px,' + (pos.y) + 'px,' + (pos.z) + 'px)' : 'translate(' + (pos.x) + 'px,' + (pos.y) + 'px)';
2244
- es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transformString;
2245
- if (!this.support.transforms) {
2246
- es.left = pos.x + 'px'
2247
- es.top = pos.y + 'px'
2248
- }
2249
- },
2250
- setTransition: function (el, duration) {
2251
- var es = el.style
2252
- es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = duration + 'ms';
2253
- },
2254
- /*==================================================
2255
- Feature Detection
2256
- ====================================================*/
2257
- support: {
2258
-
2259
- touch: (window.Modernizr && Modernizr.touch === true) || (function () {
2260
- return !!(("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch);
2261
- })(),
2262
-
2263
- transforms3d: (window.Modernizr && Modernizr.csstransforms3d === true) || (function () {
2264
- var div = document.createElement('div');
2265
- return ("webkitPerspective" in div.style || "MozPerspective" in div.style || "OPerspective" in div.style || "MsPerspective" in div.style || "perspective" in div.style);
2266
- })(),
2267
-
2268
- transforms: (window.Modernizr && Modernizr.csstransforms === true) || (function () {
2269
- var div = document.createElement('div').style
2270
- return ('transform' in div) || ('WebkitTransform' in div) || ('MozTransform' in div) || ('msTransform' in div) || ('MsTransform' in div) || ('OTransform' in div);
2271
- })(),
2272
-
2273
- transitions: (window.Modernizr && Modernizr.csstransitions === true) || (function () {
2274
- var div = document.createElement('div').style
2275
- return ('transition' in div) || ('WebkitTransition' in div) || ('MozTransition' in div) || ('msTransition' in div) || ('MsTransition' in div) || ('OTransition' in div);
2276
- })()
2277
- },
2278
-
2279
- browser: {
2280
-
2281
- ie8: (function () {
2282
- var rv = -1; // Return value assumes failure.
2283
- if (navigator.appName == 'Microsoft Internet Explorer') {
2284
- var ua = navigator.userAgent;
2285
- var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
2286
- if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
2287
- }
2288
- return rv != -1 && rv < 9;
2289
- })(),
2290
-
2291
- ie10: window.navigator.msPointerEnabled
2292
- }
2293
- }
2294
-
2295
- /*=========================
2296
- jQuery & Zepto Plugins
2297
- ===========================*/
2298
- if (window.jQuery || window.Zepto) {
2299
- (function ($) {
2300
- $.fn.swiper = function (params) {
2301
- var s = new Swiper($(this)[0], params)
2302
- $(this).data('swiper', s);
2303
- return s;
2304
- }
2305
- })(window.jQuery || window.Zepto);
2306
- }
1
+ var Swiper=function(e,t){"use strict";function r(e,t){if(document.querySelectorAll)return(t||document).querySelectorAll(e);else return jQuery(e,t)}function b(e){if(Object.prototype.toString.apply(e)==="[object Array]")return true;return false}function x(){var e=u-l;if(t.freeMode){e=u-l}if(t.slidesPerView>i.slides.length&&!t.centeredSlides){e=0}if(e<0)e=0;return e}function T(){function o(e){var n=new Image;n.onload=function(){if(i&&i.imagesLoaded!==undefined)i.imagesLoaded++;if(i.imagesLoaded===i.imagesToLoad.length){i.reInit();if(t.onImagesReady)i.fireCallback(t.onImagesReady,i)}};n.src=e}var e=i.h.addEventListener;var n=t.eventTarget==="wrapper"?i.wrapper:i.container;if(!(i.browser.ie10||i.browser.ie11)){if(i.support.touch){e(n,"touchstart",I);e(n,"touchmove",U);e(n,"touchend",z)}if(t.simulateTouch){e(n,"mousedown",I);e(document,"mousemove",U);e(document,"mouseup",z)}}else{e(n,i.touchEvents.touchStart,I);e(document,i.touchEvents.touchMove,U);e(document,i.touchEvents.touchEnd,z)}if(t.autoResize){e(window,"resize",i.resizeFix)}N();i._wheelEvent=false;if(t.mousewheelControl){if(document.onmousewheel!==undefined){i._wheelEvent="mousewheel"}if(!i._wheelEvent){try{new WheelEvent("wheel");i._wheelEvent="wheel"}catch(s){}}if(!i._wheelEvent){i._wheelEvent="DOMMouseScroll"}if(i._wheelEvent){e(i.container,i._wheelEvent,A)}}if(t.keyboardControl){e(document,"keydown",k)}if(t.updateOnImagesReady){i.imagesToLoad=r("img",i.container);for(var u=0;u<i.imagesToLoad.length;u++){o(i.imagesToLoad[u].getAttribute("src"))}}}function N(){var e=i.h.addEventListener,n;if(t.preventLinks){var s=r("a",i.container);for(n=0;n<s.length;n++){e(s[n],"click",P)}}if(t.releaseFormElements){var o=r("input, textarea, select",i.container);for(n=0;n<o.length;n++){e(o[n],i.touchEvents.touchStart,H,true)}}if(t.onSlideClick){for(n=0;n<i.slides.length;n++){e(i.slides[n],"click",M)}}if(t.onSlideTouch){for(n=0;n<i.slides.length;n++){e(i.slides[n],i.touchEvents.touchStart,_)}}}function C(){var e=i.h.removeEventListener,n;if(t.onSlideClick){for(n=0;n<i.slides.length;n++){e(i.slides[n],"click",M)}}if(t.onSlideTouch){for(n=0;n<i.slides.length;n++){e(i.slides[n],i.touchEvents.touchStart,_)}}if(t.releaseFormElements){var s=r("input, textarea, select",i.container);for(n=0;n<s.length;n++){e(s[n],i.touchEvents.touchStart,H,true)}}if(t.preventLinks){var o=r("a",i.container);for(n=0;n<o.length;n++){e(o[n],"click",P)}}}function k(e){var t=e.keyCode||e.charCode;if(e.shiftKey||e.altKey||e.ctrlKey||e.metaKey)return;if(t===37||t===39||t===38||t===40){var n=false;var r=i.h.getOffset(i.container);var s=i.h.windowScroll().left;var o=i.h.windowScroll().top;var u=i.h.windowWidth();var a=i.h.windowHeight();var f=[[r.left,r.top],[r.left+i.width,r.top],[r.left,r.top+i.height],[r.left+i.width,r.top+i.height]];for(var l=0;l<f.length;l++){var c=f[l];if(c[0]>=s&&c[0]<=s+u&&c[1]>=o&&c[1]<=o+a){n=true}}if(!n)return}if(d){if(t===37||t===39){if(e.preventDefault)e.preventDefault();else e.returnValue=false}if(t===39)i.swipeNext();if(t===37)i.swipePrev()}else{if(t===38||t===40){if(e.preventDefault)e.preventDefault();else e.returnValue=false}if(t===40)i.swipeNext();if(t===38)i.swipePrev()}}function A(e){var n=i._wheelEvent;var r=0;if(e.detail)r=-e.detail;else if(n==="mousewheel"){if(t.mousewheelControlForceToAxis){if(d){if(Math.abs(e.wheelDeltaX)>Math.abs(e.wheelDeltaY))r=e.wheelDeltaX;else return}else{if(Math.abs(e.wheelDeltaY)>Math.abs(e.wheelDeltaX))r=e.wheelDeltaY;else return}}else{r=e.wheelDelta}}else if(n==="DOMMouseScroll")r=-e.detail;else if(n==="wheel"){if(t.mousewheelControlForceToAxis){if(d){if(Math.abs(e.deltaX)>Math.abs(e.deltaY))r=-e.deltaX;else return}else{if(Math.abs(e.deltaY)>Math.abs(e.deltaX))r=-e.deltaY;else return}}else{r=Math.abs(e.deltaX)>Math.abs(e.deltaY)?-e.deltaX:-e.deltaY}}if(!t.freeMode){if((new Date).getTime()-L>60){if(r<0)i.swipeNext();else i.swipePrev()}L=(new Date).getTime()}else{var s=i.getWrapperTranslate()+r;if(s>0)s=0;if(s<-x())s=-x();i.setWrapperTransition(0);i.setWrapperTranslate(s);i.updateActiveSlide(s);if(s===0||s===-x())return}if(t.autoplay)i.stopAutoplay(true);if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false}function M(e){if(i.allowSlideClick){D(e);i.fireCallback(t.onSlideClick,i,e)}}function _(e){D(e);i.fireCallback(t.onSlideTouch,i,e)}function D(e){if(!e.currentTarget){var n=e.srcElement;do{if(n.className.indexOf(t.slideClass)>-1){break}n=n.parentNode}while(n);i.clickedSlide=n}else{i.clickedSlide=e.currentTarget}i.clickedSlideIndex=i.slides.indexOf(i.clickedSlide);i.clickedSlideLoopIndex=i.clickedSlideIndex-(i.loopedSlides||0)}function P(e){if(!i.allowLinks){if(e.preventDefault)e.preventDefault();else e.returnValue=false;if(t.preventLinksPropagation&&"stopPropagation"in e){e.stopPropagation()}return false}}function H(e){if(e.stopPropagation)e.stopPropagation();else e.returnValue=false;return false}function I(e){if(t.preventLinks)i.allowLinks=true;if(i.isTouched||t.onlyExternal){return false}if(t.noSwiping&&(e.target||e.srcElement)&&W(e.target||e.srcElement))return false;F=false;i.isTouched=true;B=e.type==="touchstart";if(!B||e.targetTouches.length===1){i.callPlugins("onTouchStartBegin");if(!B&&!i.isAndroid){if(e.preventDefault)e.preventDefault();else e.returnValue=false}var n=B?e.targetTouches[0].pageX:e.pageX||e.clientX;var r=B?e.targetTouches[0].pageY:e.pageY||e.clientY;i.touches.startX=i.touches.currentX=n;i.touches.startY=i.touches.currentY=r;i.touches.start=i.touches.current=d?n:r;i.setWrapperTransition(0);i.positions.start=i.positions.current=i.getWrapperTranslate();i.setWrapperTranslate(i.positions.start);i.times.start=(new Date).getTime();f=undefined;if(t.moveStartThreshold>0){j=false}if(t.onTouchStart)i.fireCallback(t.onTouchStart,i,e);i.callPlugins("onTouchStartEnd")}}function U(e){if(!i.isTouched||t.onlyExternal)return;if(B&&e.type==="mousemove")return;var n=B?e.targetTouches[0].pageX:e.pageX||e.clientX;var r=B?e.targetTouches[0].pageY:e.pageY||e.clientY;if(typeof f==="undefined"&&d){f=!!(f||Math.abs(r-i.touches.startY)>Math.abs(n-i.touches.startX))}if(typeof f==="undefined"&&!d){f=!!(f||Math.abs(r-i.touches.startY)<Math.abs(n-i.touches.startX))}if(f){i.isTouched=false;return}if(e.assignedToSwiper){i.isTouched=false;return}e.assignedToSwiper=true;if(t.preventLinks){i.allowLinks=false}if(t.onSlideClick){i.allowSlideClick=false}if(t.autoplay){i.stopAutoplay(true)}if(!B||e.touches.length===1){if(!i.isMoved){i.callPlugins("onTouchMoveStart");if(t.loop){i.fixLoop();i.positions.start=i.getWrapperTranslate()}if(t.onTouchMoveStart)i.fireCallback(t.onTouchMoveStart,i)}i.isMoved=true;if(e.preventDefault)e.preventDefault();else e.returnValue=false;i.touches.current=d?n:r;i.positions.current=(i.touches.current-i.touches.start)*t.touchRatio+i.positions.start;if(i.positions.current>0&&t.onResistanceBefore){i.fireCallback(t.onResistanceBefore,i,i.positions.current)}if(i.positions.current<-x()&&t.onResistanceAfter){i.fireCallback(t.onResistanceAfter,i,Math.abs(i.positions.current+x()))}if(t.resistance&&t.resistance!=="100%"){var s;if(i.positions.current>0){s=1-i.positions.current/l/2;if(s<.5)i.positions.current=l/2;else i.positions.current=i.positions.current*s}if(i.positions.current<-x()){var o=(i.touches.current-i.touches.start)*t.touchRatio+(x()+i.positions.start);s=(l+o)/l;var u=i.positions.current-o*(1-s)/2;var a=-x()-l/2;if(u<a||s<=0)i.positions.current=a;else i.positions.current=u}}if(t.resistance&&t.resistance==="100%"){if(i.positions.current>0&&!(t.freeMode&&!t.freeModeFluid)){i.positions.current=0}if(i.positions.current<-x()&&!(t.freeMode&&!t.freeModeFluid)){i.positions.current=-x()}}if(!t.followFinger)return;if(!t.moveStartThreshold){i.setWrapperTranslate(i.positions.current)}else{if(Math.abs(i.touches.current-i.touches.start)>t.moveStartThreshold||j){if(!j){j=true;i.touches.start=i.touches.current;return}i.setWrapperTranslate(i.positions.current)}else{i.positions.current=i.positions.start}}if(t.freeMode||t.watchActiveIndex){i.updateActiveSlide(i.positions.current)}if(t.grabCursor){i.container.style.cursor="move";i.container.style.cursor="grabbing";i.container.style.cursor="-moz-grabbin";i.container.style.cursor="-webkit-grabbing"}if(!q)q=i.touches.current;if(!R)R=(new Date).getTime();i.velocity=(i.touches.current-q)/((new Date).getTime()-R)/2;if(Math.abs(i.touches.current-q)<2)i.velocity=0;q=i.touches.current;R=(new Date).getTime();i.callPlugins("onTouchMoveEnd");if(t.onTouchMove)i.fireCallback(t.onTouchMove,i,e);return false}}function z(e){if(f){i.swipeReset()}if(t.onlyExternal||!i.isTouched)return;i.isTouched=false;if(t.grabCursor){i.container.style.cursor="move";i.container.style.cursor="grab";i.container.style.cursor="-moz-grab";i.container.style.cursor="-webkit-grab"}if(!i.positions.current&&i.positions.current!==0){i.positions.current=i.positions.start}if(t.followFinger){i.setWrapperTranslate(i.positions.current)}i.times.end=(new Date).getTime();i.touches.diff=i.touches.current-i.touches.start;i.touches.abs=Math.abs(i.touches.diff);i.positions.diff=i.positions.current-i.positions.start;i.positions.abs=Math.abs(i.positions.diff);var n=i.positions.diff;var r=i.positions.abs;var s=i.times.end-i.times.start;if(r<5&&s<300&&i.allowLinks===false){if(!t.freeMode&&r!==0)i.swipeReset();if(t.preventLinks){i.allowLinks=true}if(t.onSlideClick){i.allowSlideClick=true}}setTimeout(function(){if(t.preventLinks){i.allowLinks=true}if(t.onSlideClick){i.allowSlideClick=true}},100);var u=x();if(!i.isMoved&&t.freeMode){i.isMoved=false;if(t.onTouchEnd)i.fireCallback(t.onTouchEnd,i,e);i.callPlugins("onTouchEnd");return}if(!i.isMoved||i.positions.current>0||i.positions.current<-u){i.swipeReset();if(t.onTouchEnd)i.fireCallback(t.onTouchEnd,i,e);i.callPlugins("onTouchEnd");return}i.isMoved=false;if(t.freeMode){if(t.freeModeFluid){var c=1e3*t.momentumRatio;var h=i.velocity*c;var p=i.positions.current+h;var v=false;var m;var g=Math.abs(i.velocity)*20*t.momentumBounceRatio;if(p<-u){if(t.momentumBounce&&i.support.transitions){if(p+u<-g)p=-u-g;m=-u;v=true;F=true}else p=-u}if(p>0){if(t.momentumBounce&&i.support.transitions){if(p>g)p=g;m=0;v=true;F=true}else p=0}if(i.velocity!==0)c=Math.abs((p-i.positions.current)/i.velocity);i.setWrapperTranslate(p);i.setWrapperTransition(c);if(t.momentumBounce&&v){i.wrapperTransitionEnd(function(){if(!F)return;if(t.onMomentumBounce)i.fireCallback(t.onMomentumBounce,i);i.callPlugins("onMomentumBounce");i.setWrapperTranslate(m);i.setWrapperTransition(300)})}i.updateActiveSlide(p)}if(!t.freeModeFluid||s>=300)i.updateActiveSlide(i.positions.current);if(t.onTouchEnd)i.fireCallback(t.onTouchEnd,i,e);i.callPlugins("onTouchEnd");return}a=n<0?"toNext":"toPrev";if(a==="toNext"&&s<=300){if(r<30||!t.shortSwipes)i.swipeReset();else i.swipeNext(true)}if(a==="toPrev"&&s<=300){if(r<30||!t.shortSwipes)i.swipeReset();else i.swipePrev(true)}var y=0;if(t.slidesPerView==="auto"){var b=Math.abs(i.getWrapperTranslate());var w=0;var E;for(var S=0;S<i.slides.length;S++){E=d?i.slides[S].getWidth(true,t.roundLengths):i.slides[S].getHeight(true,t.roundLengths);w+=E;if(w>b){y=E;break}}if(y>l)y=l}else{y=o*t.slidesPerView}if(a==="toNext"&&s>300){if(r>=y*t.longSwipesRatio){i.swipeNext(true)}else{i.swipeReset()}}if(a==="toPrev"&&s>300){if(r>=y*t.longSwipesRatio){i.swipePrev(true)}else{i.swipeReset()}}if(t.onTouchEnd)i.fireCallback(t.onTouchEnd,i,e);i.callPlugins("onTouchEnd")}function W(e){var n=false;do{if(e.className.indexOf(t.noSwipingClass)>-1){n=true}e=e.parentElement}while(!n&&e.parentElement&&e.className.indexOf(t.wrapperClass)===-1);if(!n&&e.className.indexOf(t.wrapperClass)>-1&&e.className.indexOf(t.noSwipingClass)>-1)n=true;return n}function X(e,t){var n=document.createElement("div");var r;n.innerHTML=t;r=n.firstChild;r.className+=" "+e;return r.outerHTML}function V(e,n,r){function u(){var s=+(new Date);var h=s-o;a+=f*h/(1e3/60);c=l==="toNext"?a>e:a<e;if(c){i.setWrapperTranslate(Math.ceil(a));i._DOMAnimating=true;window.setTimeout(function(){u()},1e3/60)}else{if(t.onSlideChangeEnd){if(n==="to"){if(r.runCallbacks===true)i.fireCallback(t.onSlideChangeEnd,i)}else{i.fireCallback(t.onSlideChangeEnd,i)}}i.setWrapperTranslate(e);i._DOMAnimating=false}}var s=n==="to"&&r.speed>=0?r.speed:t.speed;var o=+(new Date);if(i.support.transitions||!t.DOMAnimation){i.setWrapperTranslate(e);i.setWrapperTransition(s)}else{var a=i.getWrapperTranslate();var f=Math.ceil((e-a)/s*(1e3/60));var l=a>e?"toNext":"toPrev";var c=l==="toNext"?a>e:a<e;if(i._DOMAnimating)return;u()}i.updateActiveSlide(e);if(t.onSlideNext&&n==="next"){i.fireCallback(t.onSlideNext,i,e)}if(t.onSlidePrev&&n==="prev"){i.fireCallback(t.onSlidePrev,i,e)}if(t.onSlideReset&&n==="reset"){i.fireCallback(t.onSlideReset,i,e)}if(n==="next"||n==="prev"||n==="to"&&r.runCallbacks===true)$(n)}function $(e){i.callPlugins("onSlideChangeStart");if(t.onSlideChangeStart){if(t.queueStartCallbacks&&i.support.transitions){if(i._queueStartCallbacks)return;i._queueStartCallbacks=true;i.fireCallback(t.onSlideChangeStart,i,e);i.wrapperTransitionEnd(function(){i._queueStartCallbacks=false})}else i.fireCallback(t.onSlideChangeStart,i,e)}if(t.onSlideChangeEnd){if(i.support.transitions){if(t.queueEndCallbacks){if(i._queueEndCallbacks)return;i._queueEndCallbacks=true;i.wrapperTransitionEnd(function(n){i.fireCallback(t.onSlideChangeEnd,n,e)})}else{i.wrapperTransitionEnd(function(n){i.fireCallback(t.onSlideChangeEnd,n,e)})}}else{if(!t.DOMAnimation){setTimeout(function(){i.fireCallback(t.onSlideChangeEnd,i,e)},10)}}}}function J(){var e=i.paginationButtons;if(e){for(var t=0;t<e.length;t++){i.h.removeEventListener(e[t],"click",Q)}}}function K(){var e=i.paginationButtons;if(e){for(var t=0;t<e.length;t++){i.h.addEventListener(e[t],"click",Q)}}}function Q(e){var t;var n=e.target||e.srcElement;var r=i.paginationButtons;for(var s=0;s<r.length;s++){if(n===r[s])t=s}i.swipeTo(t)}function Z(){G=setTimeout(function(){if(t.loop){i.fixLoop();i.swipeNext(true)}else if(!i.swipeNext(true)){if(!t.autoplayStopOnLast)i.swipeTo(0);else{clearTimeout(G);G=undefined}}i.wrapperTransitionEnd(function(){if(typeof G!=="undefined")Z()})},t.autoplay)}function et(){i.calcSlides();if(t.loader.slides.length>0&&i.slides.length===0){i.loadSlides()}if(t.loop){i.createLoop()}i.init();T();if(t.pagination){i.createPagination(true)}if(t.loop||t.initialSlide>0){i.swipeTo(t.initialSlide,0,false)}else{i.updateActiveSlide(0)}if(t.autoplay){i.startAutoplay()}i.centerIndex=i.activeIndex;if(t.onSwiperCreated)i.fireCallback(t.onSwiperCreated,i);i.callPlugins("onSwiperCreated")}if(document.body.__defineGetter__){if(HTMLElement){var n=HTMLElement.prototype;if(n.__defineGetter__){n.__defineGetter__("outerHTML",function(){return(new XMLSerializer).serializeToString(this)})}}}if(!window.getComputedStyle){window.getComputedStyle=function(e,t){this.el=e;this.getPropertyValue=function(t){var n=/(\-([a-z]){1})/g;if(t==="float")t="styleFloat";if(n.test(t)){t=t.replace(n,function(){return arguments[2].toUpperCase()})}return e.currentStyle[t]?e.currentStyle[t]:null};return this}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(e,t){for(var n=t||0,r=this.length;n<r;n++){if(this[n]===e){return n}}return-1}}if(!document.querySelectorAll){if(!window.jQuery)return}if(typeof e==="undefined")return;if(!e.nodeType){if(r(e).length===0)return}var i=this;i.touches={start:0,startX:0,startY:0,current:0,currentX:0,currentY:0,diff:0,abs:0};i.positions={start:0,abs:0,diff:0,current:0};i.times={start:0,end:0};i.id=(new Date).getTime();i.container=e.nodeType?e:r(e)[0];i.isTouched=false;i.isMoved=false;i.activeIndex=0;i.centerIndex=0;i.activeLoaderIndex=0;i.activeLoopIndex=0;i.previousIndex=null;i.velocity=0;i.snapGrid=[];i.slidesGrid=[];i.imagesToLoad=[];i.imagesLoaded=0;i.wrapperLeft=0;i.wrapperRight=0;i.wrapperTop=0;i.wrapperBottom=0;i.isAndroid=navigator.userAgent.toLowerCase().indexOf("android")>=0;var s,o,u,a,f,l;var c={eventTarget:"wrapper",mode:"horizontal",touchRatio:1,speed:300,freeMode:false,freeModeFluid:false,momentumRatio:1,momentumBounce:true,momentumBounceRatio:1,slidesPerView:1,slidesPerGroup:1,slidesPerViewFit:true,simulateTouch:true,followFinger:true,shortSwipes:true,longSwipesRatio:.5,moveStartThreshold:false,onlyExternal:false,createPagination:true,pagination:false,paginationElement:"span",paginationClickable:false,paginationAsRange:true,resistance:true,scrollContainer:false,preventLinks:true,preventLinksPropagation:false,noSwiping:false,noSwipingClass:"swiper-no-swiping",initialSlide:0,keyboardControl:false,mousewheelControl:false,mousewheelControlForceToAxis:false,useCSS3Transforms:true,autoplay:false,autoplayDisableOnInteraction:true,autoplayStopOnLast:false,loop:false,loopAdditionalSlides:0,roundLengths:false,calculateHeight:false,cssWidthAndHeight:false,updateOnImagesReady:true,releaseFormElements:true,watchActiveIndex:false,visibilityFullFit:false,offsetPxBefore:0,offsetPxAfter:0,offsetSlidesBefore:0,offsetSlidesAfter:0,centeredSlides:false,queueStartCallbacks:false,queueEndCallbacks:false,autoResize:true,resizeReInit:false,DOMAnimation:true,loader:{slides:[],slidesHTMLType:"inner",surroundGroups:1,logic:"reload",loadAllSlides:false},slideElement:"div",slideClass:"swiper-slide",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideDuplicateClass:"swiper-slide-duplicate",wrapperClass:"swiper-wrapper",paginationElementClass:"swiper-pagination-switch",paginationActiveClass:"swiper-active-switch",paginationVisibleClass:"swiper-visible-switch"};t=t||{};for(var h in c){if(h in t&&typeof t[h]==="object"){for(var p in c[h]){if(!(p in t[h])){t[h][p]=c[h][p]}}}else if(!(h in t)){t[h]=c[h]}}i.params=t;if(t.scrollContainer){t.freeMode=true;t.freeModeFluid=true}if(t.loop){t.resistance="100%"}var d=t.mode==="horizontal";var v=["mousedown","mousemove","mouseup"];if(i.browser.ie10)v=["MSPointerDown","MSPointerMove","MSPointerUp"];if(i.browser.ie11)v=["pointerdown","pointermove","pointerup"];i.touchEvents={touchStart:i.support.touch||!t.simulateTouch?"touchstart":v[0],touchMove:i.support.touch||!t.simulateTouch?"touchmove":v[1],touchEnd:i.support.touch||!t.simulateTouch?"touchend":v[2]};for(var m=i.container.childNodes.length-1;m>=0;m--){if(i.container.childNodes[m].className){var g=i.container.childNodes[m].className.split(/\s+/);for(var y=0;y<g.length;y++){if(g[y]===t.wrapperClass){s=i.container.childNodes[m]}}}}i.wrapper=s;i._extendSwiperSlide=function(e){e.append=function(){if(t.loop){e.insertAfter(i.slides.length-i.loopedSlides)}else{i.wrapper.appendChild(e);i.reInit()}return e};e.prepend=function(){if(t.loop){i.wrapper.insertBefore(e,i.slides[i.loopedSlides]);i.removeLoopedSlides();i.calcSlides();i.createLoop()}else{i.wrapper.insertBefore(e,i.wrapper.firstChild)}i.reInit();return e};e.insertAfter=function(n){if(typeof n==="undefined")return false;var r;if(t.loop){r=i.slides[n+1+i.loopedSlides];if(r){i.wrapper.insertBefore(e,r)}else{i.wrapper.appendChild(e)}i.removeLoopedSlides();i.calcSlides();i.createLoop()}else{r=i.slides[n+1];i.wrapper.insertBefore(e,r)}i.reInit();return e};e.clone=function(){return i._extendSwiperSlide(e.cloneNode(true))};e.remove=function(){i.wrapper.removeChild(e);i.reInit()};e.html=function(t){if(typeof t==="undefined"){return e.innerHTML}else{e.innerHTML=t;return e}};e.index=function(){var t;for(var n=i.slides.length-1;n>=0;n--){if(e===i.slides[n])t=n}return t};e.isActive=function(){if(e.index()===i.activeIndex)return true;else return false};if(!e.swiperSlideDataStorage)e.swiperSlideDataStorage={};e.getData=function(t){return e.swiperSlideDataStorage[t]};e.setData=function(t,n){e.swiperSlideDataStorage[t]=n;return e};e.data=function(t,n){if(typeof n==="undefined"){return e.getAttribute("data-"+t)}else{e.setAttribute("data-"+t,n);return e}};e.getWidth=function(t,n){return i.h.getWidth(e,t,n)};e.getHeight=function(t,n){return i.h.getHeight(e,t,n)};e.getOffset=function(){return i.h.getOffset(e)};return e};i.calcSlides=function(e){var n=i.slides?i.slides.length:false;i.slides=[];i.displaySlides=[];for(var r=0;r<i.wrapper.childNodes.length;r++){if(i.wrapper.childNodes[r].className){var s=i.wrapper.childNodes[r].className;var o=s.split(/\s+/);for(var u=0;u<o.length;u++){if(o[u]===t.slideClass){i.slides.push(i.wrapper.childNodes[r])}}}}for(r=i.slides.length-1;r>=0;r--){i._extendSwiperSlide(i.slides[r])}if(n===false)return;if(n!==i.slides.length||e){C();N();i.updateActiveSlide();if(i.params.pagination)i.createPagination();i.callPlugins("numberOfSlidesChanged")}};i.createSlide=function(e,n,r){n=n||i.params.slideClass;r=r||t.slideElement;var s=document.createElement(r);s.innerHTML=e||"";s.className=n;return i._extendSwiperSlide(s)};i.appendSlide=function(e,t,n){if(!e)return;if(e.nodeType){return i._extendSwiperSlide(e).append()}else{return i.createSlide(e,t,n).append()}};i.prependSlide=function(e,t,n){if(!e)return;if(e.nodeType){return i._extendSwiperSlide(e).prepend()}else{return i.createSlide(e,t,n).prepend()}};i.insertSlideAfter=function(e,t,n,r){if(typeof e==="undefined")return false;if(t.nodeType){return i._extendSwiperSlide(t).insertAfter(e)}else{return i.createSlide(t,n,r).insertAfter(e)}};i.removeSlide=function(e){if(i.slides[e]){if(t.loop){if(!i.slides[e+i.loopedSlides])return false;i.slides[e+i.loopedSlides].remove();i.removeLoopedSlides();i.calcSlides();i.createLoop()}else i.slides[e].remove();return true}else return false};i.removeLastSlide=function(){if(i.slides.length>0){if(t.loop){i.slides[i.slides.length-1-i.loopedSlides].remove();i.removeLoopedSlides();i.calcSlides();i.createLoop()}else i.slides[i.slides.length-1].remove();return true}else{return false}};i.removeAllSlides=function(){for(var e=i.slides.length-1;e>=0;e--){i.slides[e].remove()}};i.getSlide=function(e){return i.slides[e]};i.getLastSlide=function(){return i.slides[i.slides.length-1]};i.getFirstSlide=function(){return i.slides[0]};i.activeSlide=function(){return i.slides[i.activeIndex]};i.fireCallback=function(){var e=arguments[0];if(Object.prototype.toString.call(e)==="[object Array]"){for(var n=0;n<e.length;n++){if(typeof e[n]==="function"){e[n](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}}}else if(Object.prototype.toString.call(e)==="[object String]"){if(t["on"+e])i.fireCallback(t["on"+e],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}else{e(arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}};i.addCallback=function(e,t){var n=this,r;if(n.params["on"+e]){if(b(this.params["on"+e])){return this.params["on"+e].push(t)}else if(typeof this.params["on"+e]==="function"){r=this.params["on"+e];this.params["on"+e]=[];this.params["on"+e].push(r);return this.params["on"+e].push(t)}}else{this.params["on"+e]=[];return this.params["on"+e].push(t)}};i.removeCallbacks=function(e){if(i.params["on"+e]){i.params["on"+e]=null}};var w=[];for(var E in i.plugins){if(t[E]){var S=i.plugins[E](i,t[E]);if(S)w.push(S)}}i.callPlugins=function(e,t){if(!t)t={};for(var n=0;n<w.length;n++){if(e in w[n]){w[n][e](t)}}};if((i.browser.ie10||i.browser.ie11)&&!t.onlyExternal){i.wrapper.classList.add("swiper-wp8-"+(d?"horizontal":"vertical"))}if(t.freeMode){i.container.className+=" swiper-free-mode"}i.initialized=false;i.init=function(e,n){var r=i.h.getWidth(i.container,false,t.roundLengths);var s=i.h.getHeight(i.container,false,t.roundLengths);if(r===i.width&&s===i.height&&!e)return;i.width=r;i.height=s;var a,f,c,h,p,v;var m;l=d?r:s;var g=i.wrapper;if(e){i.calcSlides(n)}if(t.slidesPerView==="auto"){var y=0;var b=0;if(t.slidesOffset>0){g.style.paddingLeft="";g.style.paddingRight="";g.style.paddingTop="";g.style.paddingBottom=""}g.style.width="";g.style.height="";if(t.offsetPxBefore>0){if(d)i.wrapperLeft=t.offsetPxBefore;else i.wrapperTop=t.offsetPxBefore}if(t.offsetPxAfter>0){if(d)i.wrapperRight=t.offsetPxAfter;else i.wrapperBottom=t.offsetPxAfter}if(t.centeredSlides){if(d){i.wrapperLeft=(l-this.slides[0].getWidth(true,t.roundLengths))/2;i.wrapperRight=(l-i.slides[i.slides.length-1].getWidth(true,t.roundLengths))/2}else{i.wrapperTop=(l-i.slides[0].getHeight(true,t.roundLengths))/2;i.wrapperBottom=(l-i.slides[i.slides.length-1].getHeight(true,t.roundLengths))/2}}if(d){if(i.wrapperLeft>=0)g.style.paddingLeft=i.wrapperLeft+"px";if(i.wrapperRight>=0)g.style.paddingRight=i.wrapperRight+"px"}else{if(i.wrapperTop>=0)g.style.paddingTop=i.wrapperTop+"px";if(i.wrapperBottom>=0)g.style.paddingBottom=i.wrapperBottom+"px"}v=0;var w=0;i.snapGrid=[];i.slidesGrid=[];c=0;for(m=0;m<i.slides.length;m++){a=i.slides[m].getWidth(true,t.roundLengths);f=i.slides[m].getHeight(true,t.roundLengths);if(t.calculateHeight){c=Math.max(c,f)}var E=d?a:f;if(t.centeredSlides){var S=m===i.slides.length-1?0:i.slides[m+1].getWidth(true,t.roundLengths);var x=m===i.slides.length-1?0:i.slides[m+1].getHeight(true,t.roundLengths);var T=d?S:x;if(E>l){if(t.slidesPerViewFit){i.snapGrid.push(v+i.wrapperLeft);i.snapGrid.push(v+E-l+i.wrapperLeft)}else{for(var N=0;N<=Math.floor(E/(l+i.wrapperLeft));N++){if(N===0)i.snapGrid.push(v+i.wrapperLeft);else i.snapGrid.push(v+i.wrapperLeft+l*N)}}i.slidesGrid.push(v+i.wrapperLeft)}else{i.snapGrid.push(w);i.slidesGrid.push(w)}w+=E/2+T/2}else{if(E>l){if(t.slidesPerViewFit){i.snapGrid.push(v);i.snapGrid.push(v+E-l)}else{if(l!==0){for(var C=0;C<=Math.floor(E/l);C++){i.snapGrid.push(v+l*C)}}else{i.snapGrid.push(v)}}}else{i.snapGrid.push(v)}i.slidesGrid.push(v)}v+=E;y+=a;b+=f}if(t.calculateHeight)i.height=c;if(d){u=y+i.wrapperRight+i.wrapperLeft;g.style.width=y+"px";g.style.height=i.height+"px"}else{u=b+i.wrapperTop+i.wrapperBottom;g.style.width=i.width+"px";g.style.height=b+"px"}}else if(t.scrollContainer){g.style.width="";g.style.height="";h=i.slides[0].getWidth(true,t.roundLengths);p=i.slides[0].getHeight(true,t.roundLengths);u=d?h:p;g.style.width=h+"px";g.style.height=p+"px";o=d?h:p}else{if(t.calculateHeight){c=0;p=0;if(!d)i.container.style.height="";g.style.height="";for(m=0;m<i.slides.length;m++){i.slides[m].style.height="";c=Math.max(i.slides[m].getHeight(true),c);if(!d)p+=i.slides[m].getHeight(true)}f=c;i.height=f;if(d)p=f;else{l=f;i.container.style.height=l+"px"}}else{f=d?i.height:i.height/t.slidesPerView;if(t.roundLengths)f=Math.ceil(f);p=d?i.height:i.slides.length*f}a=d?i.width/t.slidesPerView:i.width;if(t.roundLengths)a=Math.ceil(a);h=d?i.slides.length*a:i.width;o=d?a:f;if(t.offsetSlidesBefore>0){if(d)i.wrapperLeft=o*t.offsetSlidesBefore;else i.wrapperTop=o*t.offsetSlidesBefore}if(t.offsetSlidesAfter>0){if(d)i.wrapperRight=o*t.offsetSlidesAfter;else i.wrapperBottom=o*t.offsetSlidesAfter}if(t.offsetPxBefore>0){if(d)i.wrapperLeft=t.offsetPxBefore;else i.wrapperTop=t.offsetPxBefore}if(t.offsetPxAfter>0){if(d)i.wrapperRight=t.offsetPxAfter;else i.wrapperBottom=t.offsetPxAfter}if(t.centeredSlides){if(d){i.wrapperLeft=(l-o)/2;i.wrapperRight=(l-o)/2}else{i.wrapperTop=(l-o)/2;i.wrapperBottom=(l-o)/2}}if(d){if(i.wrapperLeft>0)g.style.paddingLeft=i.wrapperLeft+"px";if(i.wrapperRight>0)g.style.paddingRight=i.wrapperRight+"px"}else{if(i.wrapperTop>0)g.style.paddingTop=i.wrapperTop+"px";if(i.wrapperBottom>0)g.style.paddingBottom=i.wrapperBottom+"px"}u=d?h+i.wrapperRight+i.wrapperLeft:p+i.wrapperTop+i.wrapperBottom;if(!t.cssWidthAndHeight){if(parseFloat(h)>0){g.style.width=h+"px"}if(parseFloat(p)>0){g.style.height=p+"px"}}v=0;i.snapGrid=[];i.slidesGrid=[];for(m=0;m<i.slides.length;m++){i.snapGrid.push(v);i.slidesGrid.push(v);v+=o;if(!t.cssWidthAndHeight){if(parseFloat(a)>0){i.slides[m].style.width=a+"px"}if(parseFloat(f)>0){i.slides[m].style.height=f+"px"}}}}if(!i.initialized){i.callPlugins("onFirstInit");if(t.onFirstInit)i.fireCallback(t.onFirstInit,i)}else{i.callPlugins("onInit");if(t.onInit)i.fireCallback(t.onInit,i)}i.initialized=true};i.reInit=function(e){i.init(true,e)};i.resizeFix=function(e){i.callPlugins("beforeResizeFix");i.init(t.resizeReInit||e);if(!t.freeMode){i.swipeTo(t.loop?i.activeLoopIndex:i.activeIndex,0,false);if(t.autoplay){if(i.support.transitions&&typeof G!=="undefined"){if(typeof G!=="undefined"){clearTimeout(G);G=undefined;i.startAutoplay()}}else{if(typeof Y!=="undefined"){clearInterval(Y);Y=undefined;i.startAutoplay()}}}}else if(i.getWrapperTranslate()<-x()){i.setWrapperTransition(0);i.setWrapperTranslate(-x())}i.callPlugins("afterResizeFix")};i.destroy=function(){var e=i.h.removeEventListener;var n=t.eventTarget==="wrapper"?i.wrapper:i.container;if(!(i.browser.ie10||i.browser.ie11)){if(i.support.touch){e(n,"touchstart",I);e(n,"touchmove",U);e(n,"touchend",z)}if(t.simulateTouch){e(n,"mousedown",I);e(document,"mousemove",U);e(document,"mouseup",z)}}else{e(n,i.touchEvents.touchStart,I);e(document,i.touchEvents.touchMove,U);e(document,i.touchEvents.touchEnd,z)}if(t.autoResize){e(window,"resize",i.resizeFix)}C();if(t.paginationClickable){J()}if(t.mousewheelControl&&i._wheelEvent){e(i.container,i._wheelEvent,A)}if(t.keyboardControl){e(document,"keydown",k)}if(t.autoplay){i.stopAutoplay()}i.callPlugins("onDestroy");i=null};i.disableKeyboardControl=function(){t.keyboardControl=false;i.h.removeEventListener(document,"keydown",k)};i.enableKeyboardControl=function(){t.keyboardControl=true;i.h.addEventListener(document,"keydown",k)};var L=(new Date).getTime();i.disableMousewheelControl=function(){if(!i._wheelEvent)return false;t.mousewheelControl=false;i.h.removeEventListener(i.container,i._wheelEvent,A);return true};i.enableMousewheelControl=function(){if(!i._wheelEvent)return false;t.mousewheelControl=true;i.h.addEventListener(i.container,i._wheelEvent,A);return true};if(t.grabCursor){var O=i.container.style;O.cursor="move";O.cursor="grab";O.cursor="-moz-grab";O.cursor="-webkit-grab"}i.allowSlideClick=true;i.allowLinks=true;var B=false;var j;var F=true;var q,R;i.swipeNext=function(e){if(!e&&t.loop)i.fixLoop();if(!e&&t.autoplay)i.stopAutoplay(true);i.callPlugins("onSwipeNext");var n=i.getWrapperTranslate();var r=n;if(t.slidesPerView==="auto"){for(var s=0;s<i.snapGrid.length;s++){if(-n>=i.snapGrid[s]&&-n<i.snapGrid[s+1]){r=-i.snapGrid[s+1];break}}}else{var u=o*t.slidesPerGroup;r=-(Math.floor(Math.abs(n)/Math.floor(u))*u+u)}if(r<-x()){r=-x()}if(r===n)return false;V(r,"next");return true};i.swipePrev=function(e){if(!e&&t.loop)i.fixLoop();if(!e&&t.autoplay)i.stopAutoplay(true);i.callPlugins("onSwipePrev");var n=Math.ceil(i.getWrapperTranslate());var r;if(t.slidesPerView==="auto"){r=0;for(var s=1;s<i.snapGrid.length;s++){if(-n===i.snapGrid[s]){r=-i.snapGrid[s-1];break}if(-n>i.snapGrid[s]&&-n<i.snapGrid[s+1]){r=-i.snapGrid[s];break}}}else{var u=o*t.slidesPerGroup;r=-(Math.ceil(-n/u)-1)*u}if(r>0)r=0;if(r===n)return false;V(r,"prev");return true};i.swipeReset=function(){i.callPlugins("onSwipeReset");var e=i.getWrapperTranslate();var n=o*t.slidesPerGroup;var r;var s=-x();if(t.slidesPerView==="auto"){r=0;for(var u=0;u<i.snapGrid.length;u++){if(-e===i.snapGrid[u])return;if(-e>=i.snapGrid[u]&&-e<i.snapGrid[u+1]){if(i.positions.diff>0)r=-i.snapGrid[u+1];else r=-i.snapGrid[u];break}}if(-e>=i.snapGrid[i.snapGrid.length-1])r=-i.snapGrid[i.snapGrid.length-1];if(e<=-x())r=-x()}else{r=e<0?Math.ceil(e/n)*n:0}if(t.scrollContainer){r=e<0?e:0}if(r<-x()){r=-x()}if(t.scrollContainer&&l>o){r=0}if(r===e)return false;V(r,"reset");return true};i.swipeTo=function(e,n,r){e=parseInt(e,10);i.callPlugins("onSwipeTo",{index:e,speed:n});if(t.loop)e=e+i.loopedSlides;var s=i.getWrapperTranslate();if(e>i.slides.length-1||e<0)return;var u;if(t.slidesPerView==="auto"){u=-i.slidesGrid[e]}else{u=-e*o}if(u<-x()){u=-x()}if(u===s)return false;r=r===false?false:true;V(u,"to",{index:e,speed:n,runCallbacks:r});return true};i._queueStartCallbacks=false;i._queueEndCallbacks=false;i.updateActiveSlide=function(e){if(!i.initialized)return;if(i.slides.length===0)return;i.previousIndex=i.activeIndex;if(typeof e==="undefined")e=i.getWrapperTranslate();if(e>0)e=0;var n;if(t.slidesPerView==="auto"){var r=0;i.activeIndex=i.slidesGrid.indexOf(-e);if(i.activeIndex<0){for(n=0;n<i.slidesGrid.length-1;n++){if(-e>i.slidesGrid[n]&&-e<i.slidesGrid[n+1]){break}}var s=Math.abs(i.slidesGrid[n]+e);var u=Math.abs(i.slidesGrid[n+1]+e);if(s<=u)i.activeIndex=n;else i.activeIndex=n+1}}else{i.activeIndex=Math[t.visibilityFullFit?"ceil":"round"](-e/o)}if(i.activeIndex===i.slides.length)i.activeIndex=i.slides.length-1;if(i.activeIndex<0)i.activeIndex=0;if(!i.slides[i.activeIndex])return;i.calcVisibleSlides(e);if(i.support.classList){var a;for(n=0;n<i.slides.length;n++){a=i.slides[n];a.classList.remove(t.slideActiveClass);if(i.visibleSlides.indexOf(a)>=0){a.classList.add(t.slideVisibleClass)}else{a.classList.remove(t.slideVisibleClass)}}i.slides[i.activeIndex].classList.add(t.slideActiveClass)}else{var f=new RegExp("\\s*"+t.slideActiveClass);var l=new RegExp("\\s*"+t.slideVisibleClass);for(n=0;n<i.slides.length;n++){i.slides[n].className=i.slides[n].className.replace(f,"").replace(l,"");if(i.visibleSlides.indexOf(i.slides[n])>=0){i.slides[n].className+=" "+t.slideVisibleClass}}i.slides[i.activeIndex].className+=" "+t.slideActiveClass}if(t.loop){var c=i.loopedSlides;i.activeLoopIndex=i.activeIndex-c;if(i.activeLoopIndex>=i.slides.length-c*2){i.activeLoopIndex=i.slides.length-c*2-i.activeLoopIndex}if(i.activeLoopIndex<0){i.activeLoopIndex=i.slides.length-c*2+i.activeLoopIndex}if(i.activeLoopIndex<0)i.activeLoopIndex=0}else{i.activeLoopIndex=i.activeIndex}if(t.pagination){i.updatePagination(e)}};i.createPagination=function(e){if(t.paginationClickable&&i.paginationButtons){J()}i.paginationContainer=t.pagination.nodeType?t.pagination:r(t.pagination)[0];if(t.createPagination){var n="";var s=i.slides.length;var o=s;if(t.loop)o-=i.loopedSlides*2;for(var u=0;u<o;u++){n+="<"+t.paginationElement+' class="'+t.paginationElementClass+'"></'+t.paginationElement+">"}i.paginationContainer.innerHTML=n}i.paginationButtons=r("."+t.paginationElementClass,i.paginationContainer);if(!e)i.updatePagination();i.callPlugins("onCreatePagination");if(t.paginationClickable){K()}};i.updatePagination=function(e){if(!t.pagination)return;if(i.slides.length<1)return;var n=r("."+t.paginationActiveClass,i.paginationContainer);if(!n)return;var s=i.paginationButtons;if(s.length===0)return;for(var o=0;o<s.length;o++){s[o].className=t.paginationElementClass}var u=t.loop?i.loopedSlides:0;if(t.paginationAsRange){if(!i.visibleSlides)i.calcVisibleSlides(e);var a=[];var f;for(f=0;f<i.visibleSlides.length;f++){var l=i.slides.indexOf(i.visibleSlides[f])-u;if(t.loop&&l<0){l=i.slides.length-i.loopedSlides*2+l}if(t.loop&&l>=i.slides.length-i.loopedSlides*2){l=i.slides.length-i.loopedSlides*2-l;l=Math.abs(l)}a.push(l)}for(f=0;f<a.length;f++){if(s[a[f]])s[a[f]].className+=" "+t.paginationVisibleClass}if(t.loop){if(s[i.activeLoopIndex]!==undefined){s[i.activeLoopIndex].className+=" "+t.paginationActiveClass}}else{s[i.activeIndex].className+=" "+t.paginationActiveClass}}else{if(t.loop){if(s[i.activeLoopIndex])s[i.activeLoopIndex].className+=" "+t.paginationActiveClass+" "+t.paginationVisibleClass}else{s[i.activeIndex].className+=" "+t.paginationActiveClass+" "+t.paginationVisibleClass}}};i.calcVisibleSlides=function(e){var n=[];var r=0,s=0,u=0;if(d&&i.wrapperLeft>0)e=e+i.wrapperLeft;if(!d&&i.wrapperTop>0)e=e+i.wrapperTop;for(var a=0;a<i.slides.length;a++){r+=s;if(t.slidesPerView==="auto")s=d?i.h.getWidth(i.slides[a],true,t.roundLengths):i.h.getHeight(i.slides[a],true,t.roundLengths);else s=o;u=r+s;var f=false;if(t.visibilityFullFit){if(r>=-e&&u<=-e+l)f=true;if(r<=-e&&u>=-e+l)f=true}else{if(u>-e&&u<=-e+l)f=true;if(r>=-e&&r<-e+l)f=true;if(r<-e&&u>-e+l)f=true}if(f)n.push(i.slides[a])}if(n.length===0)n=[i.slides[i.activeIndex]];i.visibleSlides=n};var G,Y;i.startAutoplay=function(){if(i.support.transitions){if(typeof G!=="undefined")return false;if(!t.autoplay)return;i.callPlugins("onAutoplayStart");if(t.onAutoplayStart)i.fireCallback(t.onAutoplayStart,i);Z()}else{if(typeof Y!=="undefined")return false;if(!t.autoplay)return;i.callPlugins("onAutoplayStart");if(t.onAutoplayStart)i.fireCallback(t.onAutoplayStart,i);Y=setInterval(function(){if(t.loop){i.fixLoop();i.swipeNext(true)}else if(!i.swipeNext(true)){if(!t.autoplayStopOnLast)i.swipeTo(0);else{clearInterval(Y);Y=undefined}}},t.autoplay)}};i.stopAutoplay=function(e){if(i.support.transitions){if(!G)return;if(G)clearTimeout(G);G=undefined;if(e&&!t.autoplayDisableOnInteraction){i.wrapperTransitionEnd(function(){Z()})}i.callPlugins("onAutoplayStop");if(t.onAutoplayStop)i.fireCallback(t.onAutoplayStop,i)}else{if(Y)clearInterval(Y);Y=undefined;i.callPlugins("onAutoplayStop");if(t.onAutoplayStop)i.fireCallback(t.onAutoplayStop,i)}};i.loopCreated=false;i.removeLoopedSlides=function(){if(i.loopCreated){for(var e=0;e<i.slides.length;e++){if(i.slides[e].getData("looped")===true)i.wrapper.removeChild(i.slides[e])}}};i.createLoop=function(){if(i.slides.length===0)return;if(t.slidesPerView==="auto"){i.loopedSlides=t.loopedSlides||1}else{i.loopedSlides=t.slidesPerView+t.loopAdditionalSlides}if(i.loopedSlides>i.slides.length){i.loopedSlides=i.slides.length}var e="",n="",r;var o="";var u=i.slides.length;var a=Math.floor(i.loopedSlides/u);var f=i.loopedSlides%u;for(r=0;r<a*u;r++){var l=r;if(r>=u){var c=Math.floor(r/u);l=r-u*c}o+=i.slides[l].outerHTML}for(r=0;r<f;r++){n+=X(t.slideDuplicateClass,i.slides[r].outerHTML)}for(r=u-f;r<u;r++){e+=X(t.slideDuplicateClass,i.slides[r].outerHTML)}var h=e+o+s.innerHTML+o+n;s.innerHTML=h;i.loopCreated=true;i.calcSlides();for(r=0;r<i.slides.length;r++){if(r<i.loopedSlides||r>=i.slides.length-i.loopedSlides)i.slides[r].setData("looped",true)}i.callPlugins("onCreateLoop")};i.fixLoop=function(){var e;if(i.activeIndex<i.loopedSlides){e=i.slides.length-i.loopedSlides*3+i.activeIndex;i.swipeTo(e,0,false)}else if(t.slidesPerView==="auto"&&i.activeIndex>=i.loopedSlides*2||i.activeIndex>i.slides.length-t.slidesPerView*2){e=-i.slides.length+i.activeIndex+i.loopedSlides;i.swipeTo(e,0,false)}};i.loadSlides=function(){var e="";i.activeLoaderIndex=0;var n=t.loader.slides;var r=t.loader.loadAllSlides?n.length:t.slidesPerView*(1+t.loader.surroundGroups);for(var s=0;s<r;s++){if(t.loader.slidesHTMLType==="outer")e+=n[s];else{e+="<"+t.slideElement+' class="'+t.slideClass+'" data-swiperindex="'+s+'">'+n[s]+"</"+t.slideElement+">"}}i.wrapper.innerHTML=e;i.calcSlides(true);if(!t.loader.loadAllSlides){i.wrapperTransitionEnd(i.reloadSlides,true)}};i.reloadSlides=function(){var e=t.loader.slides;var n=parseInt(i.activeSlide().data("swiperindex"),10);if(n<0||n>e.length-1)return;i.activeLoaderIndex=n;var r=Math.max(0,n-t.slidesPerView*t.loader.surroundGroups);var s=Math.min(n+t.slidesPerView*(1+t.loader.surroundGroups)-1,e.length-1);if(n>0){var u=-o*(n-r);i.setWrapperTranslate(u);i.setWrapperTransition(0)}var a;if(t.loader.logic==="reload"){i.wrapper.innerHTML="";var f="";for(a=r;a<=s;a++){f+=t.loader.slidesHTMLType==="outer"?e[a]:"<"+t.slideElement+' class="'+t.slideClass+'" data-swiperindex="'+a+'">'+e[a]+"</"+t.slideElement+">"}i.wrapper.innerHTML=f}else{var l=1e3;var c=0;for(a=0;a<i.slides.length;a++){var h=i.slides[a].data("swiperindex");if(h<r||h>s){i.wrapper.removeChild(i.slides[a])}else{l=Math.min(h,l);c=Math.max(h,c)}}for(a=r;a<=s;a++){var p;if(a<l){p=document.createElement(t.slideElement);p.className=t.slideClass;p.setAttribute("data-swiperindex",a);p.innerHTML=e[a];i.wrapper.insertBefore(p,i.wrapper.firstChild)}if(a>c){p=document.createElement(t.slideElement);p.className=t.slideClass;p.setAttribute("data-swiperindex",a);p.innerHTML=e[a];i.wrapper.appendChild(p)}}}i.reInit(true)};et()};Swiper.prototype={plugins:{},wrapperTransitionEnd:function(e,t){"use strict";function o(){e(n);if(n.params.queueEndCallbacks)n._queueEndCallbacks=false;if(!t){for(s=0;s<i.length;s++){n.h.removeEventListener(r,i[s],o)}}}var n=this,r=n.wrapper,i=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd","msTransitionEnd"],s;if(e){for(s=0;s<i.length;s++){n.h.addEventListener(r,i[s],o)}}},getWrapperTranslate:function(e){"use strict";var t=this.wrapper,n,r,i,s;if(typeof e==="undefined"){e=this.params.mode==="horizontal"?"x":"y"}if(this.support.transforms&&this.params.useCSS3Transforms){i=window.getComputedStyle(t,null);if(window.WebKitCSSMatrix){s=new WebKitCSSMatrix(i.webkitTransform==="none"?"":i.webkitTransform)}else{s=i.MozTransform||i.OTransform||i.MsTransform||i.msTransform||i.transform||i.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,");n=s.toString().split(",")}if(e==="x"){if(window.WebKitCSSMatrix)r=s.m41;else if(n.length===16)r=parseFloat(n[12]);else r=parseFloat(n[4])}if(e==="y"){if(window.WebKitCSSMatrix)r=s.m42;else if(n.length===16)r=parseFloat(n[13]);else r=parseFloat(n[5])}}else{if(e==="x")r=parseFloat(t.style.left,10)||0;if(e==="y")r=parseFloat(t.style.top,10)||0}return r||0},setWrapperTranslate:function(e,t,n){"use strict";var r=this.wrapper.style,i={x:0,y:0,z:0},s;if(arguments.length===3){i.x=e;i.y=t;i.z=n}else{if(typeof t==="undefined"){t=this.params.mode==="horizontal"?"x":"y"}i[t]=e}if(this.support.transforms&&this.params.useCSS3Transforms){s=this.support.transforms3d?"translate3d("+i.x+"px, "+i.y+"px, "+i.z+"px)":"translate("+i.x+"px, "+i.y+"px)";r.webkitTransform=r.MsTransform=r.msTransform=r.MozTransform=r.OTransform=r.transform=s}else{r.left=i.x+"px";r.top=i.y+"px"}this.callPlugins("onSetWrapperTransform",i);if(this.params.onSetWrapperTransform)this.fireCallback(this.params.onSetWrapperTransform,this,i)},setWrapperTransition:function(e){"use strict";var t=this.wrapper.style;t.webkitTransitionDuration=t.MsTransitionDuration=t.msTransitionDuration=t.MozTransitionDuration=t.OTransitionDuration=t.transitionDuration=e/1e3+"s";this.callPlugins("onSetWrapperTransition",{duration:e});if(this.params.onSetWrapperTransition)this.fireCallback(this.params.onSetWrapperTransition,this,e)},h:{getWidth:function(e,t,n){"use strict";var r=window.getComputedStyle(e,null).getPropertyValue("width");var i=parseFloat(r);if(isNaN(i)||r.indexOf("%")>0||i<0){i=e.offsetWidth-parseFloat(window.getComputedStyle(e,null).getPropertyValue("padding-left"))-parseFloat(window.getComputedStyle(e,null).getPropertyValue("padding-right"))}if(t)i+=parseFloat(window.getComputedStyle(e,null).getPropertyValue("padding-left"))+parseFloat(window.getComputedStyle(e,null).getPropertyValue("padding-right"));if(n)return Math.ceil(i);else return i},getHeight:function(e,t,n){"use strict";if(t)return e.offsetHeight;var r=window.getComputedStyle(e,null).getPropertyValue("height");var i=parseFloat(r);if(isNaN(i)||r.indexOf("%")>0||i<0){i=e.offsetHeight-parseFloat(window.getComputedStyle(e,null).getPropertyValue("padding-top"))-parseFloat(window.getComputedStyle(e,null).getPropertyValue("padding-bottom"))}if(t)i+=parseFloat(window.getComputedStyle(e,null).getPropertyValue("padding-top"))+parseFloat(window.getComputedStyle(e,null).getPropertyValue("padding-bottom"));if(n)return Math.ceil(i);else return i},getOffset:function(e){"use strict";var t=e.getBoundingClientRect();var n=document.body;var r=e.clientTop||n.clientTop||0;var i=e.clientLeft||n.clientLeft||0;var s=window.pageYOffset||e.scrollTop;var o=window.pageXOffset||e.scrollLeft;if(document.documentElement&&!window.pageYOffset){s=document.documentElement.scrollTop;o=document.documentElement.scrollLeft}return{top:t.top+s-r,left:t.left+o-i}},windowWidth:function(){"use strict";if(window.innerWidth)return window.innerWidth;else if(document.documentElement&&document.documentElement.clientWidth)return document.documentElement.clientWidth},windowHeight:function(){"use strict";if(window.innerHeight)return window.innerHeight;else if(document.documentElement&&document.documentElement.clientHeight)return document.documentElement.clientHeight},windowScroll:function(){"use strict";if(typeof pageYOffset!=="undefined"){return{left:window.pageXOffset,top:window.pageYOffset}}else if(document.documentElement){return{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}},addEventListener:function(e,t,n,r){"use strict";if(typeof r==="undefined"){r=false}if(e.addEventListener){e.addEventListener(t,n,r)}else if(e.attachEvent){e.attachEvent("on"+t,n)}},removeEventListener:function(e,t,n,r){"use strict";if(typeof r==="undefined"){r=false}if(e.removeEventListener){e.removeEventListener(t,n,r)}else if(e.detachEvent){e.detachEvent("on"+t,n)}}},setTransform:function(e,t){"use strict";var n=e.style;n.webkitTransform=n.MsTransform=n.msTransform=n.MozTransform=n.OTransform=n.transform=t},setTranslate:function(e,t){"use strict";var n=e.style;var r={x:t.x||0,y:t.y||0,z:t.z||0};var i=this.support.transforms3d?"translate3d("+r.x+"px,"+r.y+"px,"+r.z+"px)":"translate("+r.x+"px,"+r.y+"px)";n.webkitTransform=n.MsTransform=n.msTransform=n.MozTransform=n.OTransform=n.transform=i;if(!this.support.transforms){n.left=r.x+"px";n.top=r.y+"px"}},setTransition:function(e,t){"use strict";var n=e.style;n.webkitTransitionDuration=n.MsTransitionDuration=n.msTransitionDuration=n.MozTransitionDuration=n.OTransitionDuration=n.transitionDuration=t+"ms"},support:{touch:window.Modernizr&&Modernizr.touch===true||function(){"use strict";return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}(),transforms3d:window.Modernizr&&Modernizr.csstransforms3d===true||function(){"use strict";var e=document.createElement("div").style;return"webkitPerspective"in e||"MozPerspective"in e||"OPerspective"in e||"MsPerspective"in e||"perspective"in e}(),transforms:window.Modernizr&&Modernizr.csstransforms===true||function(){"use strict";var e=document.createElement("div").style;return"transform"in e||"WebkitTransform"in e||"MozTransform"in e||"msTransform"in e||"MsTransform"in e||"OTransform"in e}(),transitions:window.Modernizr&&Modernizr.csstransitions===true||function(){"use strict";var e=document.createElement("div").style;return"transition"in e||"WebkitTransition"in e||"MozTransition"in e||"msTransition"in e||"MsTransition"in e||"OTransition"in e}(),classList:function(){"use strict";var e=document.createElement("div").style;return"classList"in e}()},browser:{ie8:function(){"use strict";var e=-1;if(navigator.appName==="Microsoft Internet Explorer"){var t=navigator.userAgent;var n=new RegExp(/MSIE ([0-9]{1,}[\.0-9]{0,})/);if(n.exec(t)!==null)e=parseFloat(RegExp.$1)}return e!==-1&&e<9}(),ie10:window.navigator.msPointerEnabled,ie11:window.navigator.pointerEnabled}};if(window.jQuery||window.Zepto){(function(e){"use strict";e.fn.swiper=function(t){var n=new Swiper(e(this)[0],t);e(this).data("swiper",n);return n}})(window.jQuery||window.Zepto)}if(typeof module!=="undefined"){module.exports=Swiper}if(typeof define==="function"&&define.amd){define([],function(){"use strict";return Swiper})}