jekyll-theme-doc-project 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/_layouts/dexwebsite.html +177 -0
  3. data/_layouts/hippolayout.html +41 -0
  4. data/_sass/dexwebsite.scss +1944 -0
  5. data/assets/dex-website-assets/assets.yml +58 -0
  6. data/assets/dex-website-assets/bootstrap-dexwebsite.css +332 -0
  7. data/assets/dex-website-assets/bootstrap-dexwebsite.js +976 -0
  8. data/assets/dex-website-assets/bootstrap-theme-dexwebsite.css +596 -0
  9. data/assets/dex-website-assets/dexwebsite_techdocs.scss +7 -0
  10. data/assets/dex-website-assets/images/list-icon.png +0 -0
  11. data/assets/dex-website-assets/src/fonts/icomoon.woff +0 -0
  12. data/assets/dex-website-assets/src/scripts/bootstrap-collapse.js +207 -0
  13. data/assets/dex-website-assets/src/scripts/bootstrap.js +2311 -0
  14. data/assets/dex-website-assets/src/scripts/dp-navigation-popover.js +419 -0
  15. data/assets/dex-website-assets/src/scripts/hero-carousel.js +30 -0
  16. data/assets/dex-website-assets/src/scripts/hero-no-cta.js +20 -0
  17. data/assets/dex-website-assets/src/scripts/images.js +47 -0
  18. data/assets/dex-website-assets/src/scripts/in-page-carousel.js +75 -0
  19. data/assets/dex-website-assets/src/scripts/jquery-cookie.js +119 -0
  20. data/assets/dex-website-assets/src/scripts/jquery-lazyload.js +246 -0
  21. data/assets/dex-website-assets/src/scripts/jquery.js +10322 -0
  22. data/assets/dex-website-assets/src/scripts/menu.js +100 -0
  23. data/assets/dex-website-assets/src/scripts/multi-column-with-image.js +14 -0
  24. data/assets/dex-website-assets/src/scripts/nav.js +35 -0
  25. data/assets/dex-website-assets/src/scripts/owl-carousel.js +3074 -0
  26. data/assets/dex-website-assets/src/scripts/product-nav.js +112 -0
  27. data/assets/dex-website-assets/src/scripts/search.js +41 -0
  28. data/assets/dex-website-assets/src/scripts/single-field-form.js +28 -0
  29. data/assets/dex-website-assets/src/scripts/subscribe-form.js +54 -0
  30. data/assets/dex-website-assets/src/scripts/video-responsive.js +15 -0
  31. data/assets/dex-website-assets/src/styles/_base.scss +2 -0
  32. data/assets/dex-website-assets/src/styles/_mixins.scss +73 -0
  33. data/assets/dex-website-assets/src/styles/_variables.scss +45 -0
  34. data/assets/dex-website-assets/src/styles/bootstrap-collapse.css +25 -0
  35. data/assets/dex-website-assets/src/styles/bootstrap-collapse.css.map +7 -0
  36. data/assets/dex-website-assets/src/styles/bootstrap-collapse.scss +26 -0
  37. data/assets/dex-website-assets/src/styles/bootstrap-theme.css +475 -0
  38. data/assets/dex-website-assets/src/styles/bootstrap.css +6565 -0
  39. data/assets/dex-website-assets/src/styles/content-slot.css +343 -0
  40. data/assets/dex-website-assets/src/styles/content-slot.css.map +7 -0
  41. data/assets/dex-website-assets/src/styles/content-slot.scss +506 -0
  42. data/assets/dex-website-assets/src/styles/custom-controls.css +40 -0
  43. data/assets/dex-website-assets/src/styles/custom-controls.css.map +7 -0
  44. data/assets/dex-website-assets/src/styles/custom-controls.scss +48 -0
  45. data/assets/dex-website-assets/src/styles/font-icons-variables.css +3 -0
  46. data/assets/dex-website-assets/src/styles/font-icons-variables.css.map +7 -0
  47. data/assets/dex-website-assets/src/styles/font-icons-variables.scss +3 -0
  48. data/assets/dex-website-assets/src/styles/font-icons.css +28 -0
  49. data/assets/dex-website-assets/src/styles/font-icons.css.map +7 -0
  50. data/assets/dex-website-assets/src/styles/font-icons.scss +40 -0
  51. data/assets/dex-website-assets/src/styles/footer.css +98 -0
  52. data/assets/dex-website-assets/src/styles/footer.css.map +7 -0
  53. data/assets/dex-website-assets/src/styles/footer.scss +130 -0
  54. data/assets/dex-website-assets/src/styles/grid-responsive.css +50 -0
  55. data/assets/dex-website-assets/src/styles/grid-responsive.css.map +7 -0
  56. data/assets/dex-website-assets/src/styles/grid-responsive.scss +67 -0
  57. data/assets/dex-website-assets/src/styles/grid.css +821 -0
  58. data/assets/dex-website-assets/src/styles/grid.css.map +7 -0
  59. data/assets/dex-website-assets/src/styles/grid.scss +1159 -0
  60. data/assets/dex-website-assets/src/styles/header-banner-button-cta.css +79 -0
  61. data/assets/dex-website-assets/src/styles/header-banner-button-cta.css.map +7 -0
  62. data/assets/dex-website-assets/src/styles/header-banner-button-cta.scss +103 -0
  63. data/assets/dex-website-assets/src/styles/hero-carousel.css +175 -0
  64. data/assets/dex-website-assets/src/styles/hero-carousel.css.map +7 -0
  65. data/assets/dex-website-assets/src/styles/hero-carousel.scss +179 -0
  66. data/assets/dex-website-assets/src/styles/hero-no-cta.css +1106 -0
  67. data/assets/dex-website-assets/src/styles/hero-no-cta.css.map +7 -0
  68. data/assets/dex-website-assets/src/styles/hero-no-cta.scss +125 -0
  69. data/assets/dex-website-assets/src/styles/home.css +237 -0
  70. data/assets/dex-website-assets/src/styles/home.css.map +7 -0
  71. data/assets/dex-website-assets/src/styles/home.scss +299 -0
  72. data/assets/dex-website-assets/src/styles/media.css +17 -0
  73. data/assets/dex-website-assets/src/styles/media.css.map +7 -0
  74. data/assets/dex-website-assets/src/styles/media.scss +18 -0
  75. data/assets/dex-website-assets/src/styles/menu-button.css +122 -0
  76. data/assets/dex-website-assets/src/styles/menu-button.css.map +7 -0
  77. data/assets/dex-website-assets/src/styles/menu-button.scss +121 -0
  78. data/assets/dex-website-assets/src/styles/menu.css +428 -0
  79. data/assets/dex-website-assets/src/styles/menu.css.map +7 -0
  80. data/assets/dex-website-assets/src/styles/menu.scss +578 -0
  81. data/assets/dex-website-assets/src/styles/message.css +34 -0
  82. data/assets/dex-website-assets/src/styles/message.css.map +7 -0
  83. data/assets/dex-website-assets/src/styles/message.scss +38 -0
  84. data/assets/dex-website-assets/src/styles/multi-column-left-icon.css +57 -0
  85. data/assets/dex-website-assets/src/styles/multi-column-left-icon.css.map +7 -0
  86. data/assets/dex-website-assets/src/styles/multi-column-left-icon.scss +104 -0
  87. data/assets/dex-website-assets/src/styles/multi-column-with-image.css +49 -0
  88. data/assets/dex-website-assets/src/styles/multi-column-with-image.css.map +7 -0
  89. data/assets/dex-website-assets/src/styles/multi-column-with-image.scss +63 -0
  90. data/assets/dex-website-assets/src/styles/navbar.css +82 -0
  91. data/assets/dex-website-assets/src/styles/navbar.css.map +7 -0
  92. data/assets/dex-website-assets/src/styles/navbar.scss +91 -0
  93. data/assets/dex-website-assets/src/styles/navigation.css +66 -0
  94. data/assets/dex-website-assets/src/styles/navigation.scss +81 -0
  95. data/assets/dex-website-assets/src/styles/oas.css +22 -0
  96. data/assets/dex-website-assets/src/styles/oas.css.map +7 -0
  97. data/assets/dex-website-assets/src/styles/oas.scss +27 -0
  98. data/assets/dex-website-assets/src/styles/owl-carousel.css +202 -0
  99. data/assets/dex-website-assets/src/styles/owl-carousel.css.map +7 -0
  100. data/assets/dex-website-assets/src/styles/owl-carousel.scss +215 -0
  101. data/assets/dex-website-assets/src/styles/popover.css +63 -0
  102. data/assets/dex-website-assets/src/styles/popover.css.map +7 -0
  103. data/assets/dex-website-assets/src/styles/popover.scss +65 -0
  104. data/assets/dex-website-assets/src/styles/product-nav.css +74 -0
  105. data/assets/dex-website-assets/src/styles/product-nav.css.map +7 -0
  106. data/assets/dex-website-assets/src/styles/product-nav.scss +110 -0
  107. data/assets/dex-website-assets/src/styles/sdk-downloader.css +155 -0
  108. data/assets/dex-website-assets/src/styles/sdk-downloader.css.map +7 -0
  109. data/assets/dex-website-assets/src/styles/sdk-downloader.scss +279 -0
  110. data/assets/dex-website-assets/src/styles/search.css +148 -0
  111. data/assets/dex-website-assets/src/styles/search.css.map +7 -0
  112. data/assets/dex-website-assets/src/styles/search.scss +188 -0
  113. data/assets/dex-website-assets/src/styles/sidebar.css +68 -0
  114. data/assets/dex-website-assets/src/styles/sidebar.css.map +7 -0
  115. data/assets/dex-website-assets/src/styles/sidebar.scss +87 -0
  116. data/assets/dex-website-assets/src/styles/single-field-form.css +157 -0
  117. data/assets/dex-website-assets/src/styles/single-field-form.css.map +7 -0
  118. data/assets/dex-website-assets/src/styles/single-field-form.scss +88 -0
  119. data/assets/dex-website-assets/src/styles/subscribe-form.css +53 -0
  120. data/assets/dex-website-assets/src/styles/subscribe-form.css.map +7 -0
  121. data/assets/dex-website-assets/src/styles/subscribe-form.scss +63 -0
  122. data/assets/dex-website-assets/src/styles/typography.css +85 -0
  123. data/assets/dex-website-assets/src/styles/typography.css.map +7 -0
  124. data/assets/dex-website-assets/src/styles/typography.scss +96 -0
  125. data/assets/dex-website-assets/src/styles/utility.css +102 -0
  126. data/assets/dex-website-assets/src/styles/utility.css.map +7 -0
  127. data/assets/dex-website-assets/src/styles/utility.scss +135 -0
  128. data/assets/dex-website-assets/src/styles/value-props.css +49 -0
  129. data/assets/dex-website-assets/src/styles/value-props.css.map +7 -0
  130. data/assets/dex-website-assets/src/styles/value-props.scss +64 -0
  131. data/assets/hippo-assets/customscriptshippo.js +18 -0
  132. data/assets/hippo-assets/highlighter.min.css +3 -0
  133. data/assets/hippo-assets/hipposidebar.css +199 -0
  134. data/assets/hippo-assets/hipposidebarpage.min.css +1 -0
  135. data/assets/hippo-assets/includescript.min.js +3 -0
  136. data/assets/hippo-assets/navtabshippo.css +4 -0
  137. metadata +136 -1
@@ -0,0 +1,3074 @@
1
+ /**
2
+ * Owl carousel
3
+ * @version 2.0.0
4
+ * @author Bartosz Wojciechowski
5
+ * @license The MIT License (MIT)
6
+ * @todo Lazy Load Icon
7
+ * @todo prevent animationend bubling
8
+ * @todo itemsScaleUp
9
+ * @todo Test Zepto
10
+ * @todo stagePadding calculate wrong active classes
11
+ */
12
+ P.when("jQuery", "ready").register("jQuery-owl", function(jQuery) {
13
+ ;(function($, window, document, undefined) {
14
+
15
+ var drag, state, e;
16
+
17
+ /**
18
+ * Template for status information about drag and touch events.
19
+ * @private
20
+ */
21
+ drag = {
22
+ start: 0,
23
+ startX: 0,
24
+ startY: 0,
25
+ current: 0,
26
+ currentX: 0,
27
+ currentY: 0,
28
+ offsetX: 0,
29
+ offsetY: 0,
30
+ distance: null,
31
+ startTime: 0,
32
+ endTime: 0,
33
+ updatedX: 0,
34
+ targetEl: null
35
+ };
36
+
37
+ /**
38
+ * Template for some status informations.
39
+ * @private
40
+ */
41
+ state = {
42
+ isTouch: false,
43
+ isScrolling: false,
44
+ isSwiping: false,
45
+ direction: false,
46
+ inMotion: false
47
+ };
48
+
49
+ /**
50
+ * Event functions references.
51
+ * @private
52
+ */
53
+ e = {
54
+ _onDragStart: null,
55
+ _onDragMove: null,
56
+ _onDragEnd: null,
57
+ _transitionEnd: null,
58
+ _resizer: null,
59
+ _responsiveCall: null,
60
+ _goToLoop: null,
61
+ _checkVisibile: null
62
+ };
63
+
64
+ /**
65
+ * Creates a carousel.
66
+ * @class The Owl Carousel.
67
+ * @public
68
+ * @param {HTMLElement|jQuery} element - The element to create the carousel for.
69
+ * @param {Object} [options] - The options
70
+ */
71
+ function Owl(element, options) {
72
+
73
+ /**
74
+ * Current settings for the carousel.
75
+ * @public
76
+ */
77
+ this.settings = null;
78
+
79
+ /**
80
+ * Current options set by the caller including defaults.
81
+ * @public
82
+ */
83
+ this.options = $.extend({}, Owl.Defaults, options);
84
+
85
+ /**
86
+ * Plugin element.
87
+ * @public
88
+ */
89
+ this.$element = $(element);
90
+
91
+ /**
92
+ * Caches informations about drag and touch events.
93
+ */
94
+ this.drag = $.extend({}, drag);
95
+
96
+ /**
97
+ * Caches some status informations.
98
+ * @protected
99
+ */
100
+ this.state = $.extend({}, state);
101
+
102
+ /**
103
+ * @protected
104
+ * @todo Must be documented
105
+ */
106
+ this.e = $.extend({}, e);
107
+
108
+ /**
109
+ * References to the running plugins of this carousel.
110
+ * @protected
111
+ */
112
+ this._plugins = {};
113
+
114
+ /**
115
+ * Currently suppressed events to prevent them from beeing retriggered.
116
+ * @protected
117
+ */
118
+ this._supress = {};
119
+
120
+ /**
121
+ * Absolute current position.
122
+ * @protected
123
+ */
124
+ this._current = null;
125
+
126
+ /**
127
+ * Animation speed in milliseconds.
128
+ * @protected
129
+ */
130
+ this._speed = null;
131
+
132
+ /**
133
+ * Coordinates of all items in pixel.
134
+ * @todo The name of this member is missleading.
135
+ * @protected
136
+ */
137
+ this._coordinates = [];
138
+
139
+ /**
140
+ * Current breakpoint.
141
+ * @todo Real media queries would be nice.
142
+ * @protected
143
+ */
144
+ this._breakpoint = null;
145
+
146
+ /**
147
+ * Current width of the plugin element.
148
+ */
149
+ this._width = null;
150
+
151
+ /**
152
+ * All real items.
153
+ * @protected
154
+ */
155
+ this._items = [];
156
+
157
+ /**
158
+ * All cloned items.
159
+ * @protected
160
+ */
161
+ this._clones = [];
162
+
163
+ /**
164
+ * Merge values of all items.
165
+ * @todo Maybe this could be part of a plugin.
166
+ * @protected
167
+ */
168
+ this._mergers = [];
169
+
170
+ /**
171
+ * Invalidated parts within the update process.
172
+ * @protected
173
+ */
174
+ this._invalidated = {};
175
+
176
+ /**
177
+ * Ordered list of workers for the update process.
178
+ * @protected
179
+ */
180
+ this._pipe = [];
181
+
182
+ $.each(Owl.Plugins, $.proxy(function(key, plugin) {
183
+ this._plugins[key[0].toLowerCase() + key.slice(1)]
184
+ = new plugin(this);
185
+ }, this));
186
+
187
+ $.each(Owl.Pipe, $.proxy(function(priority, worker) {
188
+ this._pipe.push({
189
+ 'filter': worker.filter,
190
+ 'run': $.proxy(worker.run, this)
191
+ });
192
+ }, this));
193
+
194
+ this.setup();
195
+ this.initialize();
196
+ }
197
+
198
+ /**
199
+ * Default options for the carousel.
200
+ * @public
201
+ */
202
+ Owl.Defaults = {
203
+ items: 3,
204
+ loop: false,
205
+ center: false,
206
+
207
+ mouseDrag: true,
208
+ touchDrag: true,
209
+ pullDrag: true,
210
+ freeDrag: false,
211
+
212
+ margin: 0,
213
+ stagePadding: 0,
214
+
215
+ merge: false,
216
+ mergeFit: true,
217
+ autoWidth: false,
218
+
219
+ startPosition: 0,
220
+ rtl: false,
221
+
222
+ smartSpeed: 250,
223
+ fluidSpeed: false,
224
+ dragEndSpeed: false,
225
+
226
+ responsive: {},
227
+ responsiveRefreshRate: 200,
228
+ responsiveBaseElement: window,
229
+ responsiveClass: false,
230
+
231
+ fallbackEasing: 'swing',
232
+
233
+ info: false,
234
+
235
+ nestedItemSelector: false,
236
+ itemElement: 'div',
237
+ stageElement: 'div',
238
+
239
+ // Classes and Names
240
+ themeClass: 'owl-theme',
241
+ baseClass: 'owl-carousel',
242
+ itemClass: 'owl-item',
243
+ centerClass: 'center',
244
+ activeClass: 'active'
245
+ };
246
+
247
+ /**
248
+ * Enumeration for width.
249
+ * @public
250
+ * @readonly
251
+ * @enum {String}
252
+ */
253
+ Owl.Width = {
254
+ Default: 'default',
255
+ Inner: 'inner',
256
+ Outer: 'outer'
257
+ };
258
+
259
+ /**
260
+ * Contains all registered plugins.
261
+ * @public
262
+ */
263
+ Owl.Plugins = {};
264
+
265
+ /**
266
+ * Update pipe.
267
+ */
268
+ Owl.Pipe = [ {
269
+ filter: [ 'width', 'items', 'settings' ],
270
+ run: function(cache) {
271
+ cache.current = this._items && this._items[this.relative(this._current)];
272
+ }
273
+ }, {
274
+ filter: [ 'items', 'settings' ],
275
+ run: function() {
276
+ var cached = this._clones,
277
+ clones = this.$stage.children('.cloned');
278
+
279
+ if (clones.length !== cached.length || (!this.settings.loop && cached.length > 0)) {
280
+ this.$stage.children('.cloned').remove();
281
+ this._clones = [];
282
+ }
283
+ }
284
+ }, {
285
+ filter: [ 'items', 'settings' ],
286
+ run: function() {
287
+ var i, n,
288
+ clones = this._clones,
289
+ items = this._items,
290
+ delta = this.settings.loop ? clones.length - Math.max(this.settings.items * 2, 4) : 0;
291
+
292
+ for (i = 0, n = Math.abs(delta / 2); i < n; i++) {
293
+ if (delta > 0) {
294
+ this.$stage.children().eq(items.length + clones.length - 1).remove();
295
+ clones.pop();
296
+ this.$stage.children().eq(0).remove();
297
+ clones.pop();
298
+ } else {
299
+ clones.push(clones.length / 2);
300
+ this.$stage.append(items[clones[clones.length - 1]].clone().addClass('cloned'));
301
+ clones.push(items.length - 1 - (clones.length - 1) / 2);
302
+ this.$stage.prepend(items[clones[clones.length - 1]].clone().addClass('cloned'));
303
+ }
304
+ }
305
+ }
306
+ }, {
307
+ filter: [ 'width', 'items', 'settings' ],
308
+ run: function() {
309
+ var rtl = (this.settings.rtl ? 1 : -1),
310
+ width = (this.width() / this.settings.items).toFixed(3),
311
+ coordinate = 0, merge, i, n;
312
+
313
+ this._coordinates = [];
314
+ for (i = 0, n = this._clones.length + this._items.length; i < n; i++) {
315
+ merge = this._mergers[this.relative(i)];
316
+ merge = (this.settings.mergeFit && Math.min(merge, this.settings.items)) || merge;
317
+ coordinate += (this.settings.autoWidth ? this._items[this.relative(i)].width() + this.settings.margin : width * merge) * rtl;
318
+
319
+ this._coordinates.push(coordinate);
320
+ }
321
+ }
322
+ }, {
323
+ filter: [ 'width', 'items', 'settings' ],
324
+ run: function() {
325
+ var i, n, width = (this.width() / this.settings.items).toFixed(3), css = {
326
+ 'width': Math.abs(this._coordinates[this._coordinates.length - 1]) + this.settings.stagePadding * 2,
327
+ 'padding-left': this.settings.stagePadding || '',
328
+ 'padding-right': this.settings.stagePadding || ''
329
+ };
330
+
331
+ this.$stage.css(css);
332
+
333
+ css = { 'width': this.settings.autoWidth ? 'auto' : width - this.settings.margin };
334
+ css[this.settings.rtl ? 'margin-left' : 'margin-right'] = this.settings.margin;
335
+
336
+ if (!this.settings.autoWidth && $.grep(this._mergers, function(v) { return v > 1 }).length > 0) {
337
+ for (i = 0, n = this._coordinates.length; i < n; i++) {
338
+ css.width = Math.abs(this._coordinates[i]) - Math.abs(this._coordinates[i - 1] || 0) - this.settings.margin;
339
+ this.$stage.children().eq(i).css(css);
340
+ }
341
+ } else {
342
+ this.$stage.children().css(css);
343
+ }
344
+ }
345
+ }, {
346
+ filter: [ 'width', 'items', 'settings' ],
347
+ run: function(cache) {
348
+ cache.current && this.reset(this.$stage.children().index(cache.current));
349
+ }
350
+ }, {
351
+ filter: [ 'position' ],
352
+ run: function() {
353
+ this.animate(this.coordinates(this._current));
354
+ }
355
+ }, {
356
+ filter: [ 'width', 'position', 'items', 'settings' ],
357
+ run: function() {
358
+ var rtl = this.settings.rtl ? 1 : -1,
359
+ padding = this.settings.stagePadding * 2,
360
+ begin = this.coordinates(this.current()) + padding,
361
+ end = begin + this.width() * rtl,
362
+ inner, outer, matches = [], i, n;
363
+
364
+ for (i = 0, n = this._coordinates.length; i < n; i++) {
365
+ inner = this._coordinates[i - 1] || 0;
366
+ outer = Math.abs(this._coordinates[i]) + padding * rtl;
367
+
368
+ if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end)))
369
+ || (this.op(outer, '<', begin) && this.op(outer, '>', end))) {
370
+ matches.push(i);
371
+ }
372
+ }
373
+
374
+ this.$stage.children('.' + this.settings.activeClass).removeClass(this.settings.activeClass);
375
+ this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass(this.settings.activeClass);
376
+
377
+ if (this.settings.center) {
378
+ this.$stage.children('.' + this.settings.centerClass).removeClass(this.settings.centerClass);
379
+ this.$stage.children().eq(this.current()).addClass(this.settings.centerClass);
380
+ }
381
+ }
382
+ } ];
383
+
384
+ /**
385
+ * Initializes the carousel.
386
+ * @protected
387
+ */
388
+ Owl.prototype.initialize = function() {
389
+ this.trigger('initialize');
390
+
391
+ this.$element
392
+ .addClass(this.settings.baseClass)
393
+ .addClass(this.settings.themeClass)
394
+ .toggleClass('owl-rtl', this.settings.rtl);
395
+
396
+ // check support
397
+ this.browserSupport();
398
+
399
+ if (this.settings.autoWidth && this.state.imagesLoaded !== true) {
400
+ var imgs, nestedSelector, width;
401
+ imgs = this.$element.find('img');
402
+ nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined;
403
+ width = this.$element.children(nestedSelector).width();
404
+
405
+ if (imgs.length && width <= 0) {
406
+ this.preloadAutoWidthImages(imgs);
407
+ return false;
408
+ }
409
+ }
410
+
411
+ this.$element.addClass('owl-loading');
412
+
413
+ // create stage
414
+ this.$stage = $('<' + this.settings.stageElement + ' class="owl-stage"/>')
415
+ .wrap('<div class="owl-stage-outer">');
416
+
417
+ // append stage
418
+ this.$element.append(this.$stage.parent());
419
+
420
+ // append content
421
+ this.replace(this.$element.children().not(this.$stage.parent()));
422
+
423
+ // set view width
424
+ this._width = this.$element.width();
425
+
426
+ // update view
427
+ this.refresh();
428
+
429
+ this.$element.removeClass('owl-loading').addClass('owl-loaded');
430
+
431
+ // attach generic events
432
+ this.eventsCall();
433
+
434
+ // attach generic events
435
+ this.internalEvents();
436
+
437
+ // attach custom control events
438
+ this.addTriggerableEvents();
439
+
440
+ this.trigger('initialized');
441
+ };
442
+
443
+ /**
444
+ * Setups the current settings.
445
+ * @todo Remove responsive classes. Why should adaptive designs be brought into IE8?
446
+ * @todo Support for media queries by using `matchMedia` would be nice.
447
+ * @public
448
+ */
449
+ Owl.prototype.setup = function() {
450
+ var viewport = this.viewport(),
451
+ overwrites = this.options.responsive,
452
+ match = -1,
453
+ settings = null;
454
+
455
+ if (!overwrites) {
456
+ settings = $.extend({}, this.options);
457
+ } else {
458
+ $.each(overwrites, function(breakpoint) {
459
+ if (breakpoint <= viewport && breakpoint > match) {
460
+ match = Number(breakpoint);
461
+ }
462
+ });
463
+
464
+ settings = $.extend({}, this.options, overwrites[match]);
465
+ delete settings.responsive;
466
+
467
+ // responsive class
468
+ if (settings.responsiveClass) {
469
+ this.$element.attr('class', function(i, c) {
470
+ return c.replace(/\b owl-responsive-\S+/g, '');
471
+ }).addClass('owl-responsive-' + match);
472
+ }
473
+ }
474
+
475
+ if (this.settings === null || this._breakpoint !== match) {
476
+ this.trigger('change', { property: { name: 'settings', value: settings } });
477
+ this._breakpoint = match;
478
+ this.settings = settings;
479
+ this.invalidate('settings');
480
+ this.trigger('changed', { property: { name: 'settings', value: this.settings } });
481
+ }
482
+ };
483
+
484
+ /**
485
+ * Updates option logic if necessery.
486
+ * @protected
487
+ */
488
+ Owl.prototype.optionsLogic = function() {
489
+ // Toggle Center class
490
+ this.$element.toggleClass('owl-center', this.settings.center);
491
+
492
+ // if items number is less than in body
493
+ if (this.settings.loop && this._items.length < this.settings.items) {
494
+ this.settings.loop = false;
495
+ }
496
+
497
+ if (this.settings.autoWidth) {
498
+ this.settings.stagePadding = false;
499
+ this.settings.merge = false;
500
+ }
501
+ };
502
+
503
+ /**
504
+ * Prepares an item before add.
505
+ * @todo Rename event parameter `content` to `item`.
506
+ * @protected
507
+ * @returns {jQuery|HTMLElement} - The item container.
508
+ */
509
+ Owl.prototype.prepare = function(item) {
510
+ var event = this.trigger('prepare', { content: item });
511
+
512
+ if (!event.data) {
513
+ event.data = $('<' + this.settings.itemElement + '/>')
514
+ .addClass(this.settings.itemClass).append(item)
515
+ }
516
+
517
+ this.trigger('prepared', { content: event.data });
518
+
519
+ return event.data;
520
+ };
521
+
522
+ /**
523
+ * Updates the view.
524
+ * @public
525
+ */
526
+ Owl.prototype.update = function() {
527
+ var i = 0,
528
+ n = this._pipe.length,
529
+ filter = $.proxy(function(p) { return this[p] }, this._invalidated),
530
+ cache = {};
531
+
532
+ while (i < n) {
533
+ if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) {
534
+ this._pipe[i].run(cache);
535
+ }
536
+ i++;
537
+ }
538
+
539
+ this._invalidated = {};
540
+ };
541
+
542
+ /**
543
+ * Gets the width of the view.
544
+ * @public
545
+ * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return.
546
+ * @returns {Number} - The width of the view in pixel.
547
+ */
548
+ Owl.prototype.width = function(dimension) {
549
+ dimension = dimension || Owl.Width.Default;
550
+ switch (dimension) {
551
+ case Owl.Width.Inner:
552
+ case Owl.Width.Outer:
553
+ return this._width;
554
+ default:
555
+ return this._width - this.settings.stagePadding * 2 + this.settings.margin;
556
+ }
557
+ };
558
+
559
+ /**
560
+ * Refreshes the carousel primarily for adaptive purposes.
561
+ * @public
562
+ */
563
+ Owl.prototype.refresh = function() {
564
+ if (this._items.length === 0) {
565
+ return false;
566
+ }
567
+
568
+ var start = new Date().getTime();
569
+
570
+ this.trigger('refresh');
571
+
572
+ this.setup();
573
+
574
+ this.optionsLogic();
575
+
576
+ // hide and show methods helps here to set a proper widths,
577
+ // this prevents scrollbar to be calculated in stage width
578
+ this.$stage.addClass('owl-refresh');
579
+
580
+ this.update();
581
+
582
+ this.$stage.removeClass('owl-refresh');
583
+
584
+ this.state.orientation = window.orientation;
585
+
586
+ this.watchVisibility();
587
+
588
+ this.trigger('refreshed');
589
+ };
590
+
591
+ /**
592
+ * Save internal event references and add event based functions.
593
+ * @protected
594
+ */
595
+ Owl.prototype.eventsCall = function() {
596
+ // Save events references
597
+ this.e._onDragStart = $.proxy(function(e) {
598
+ this.onDragStart(e);
599
+ }, this);
600
+ this.e._onDragMove = $.proxy(function(e) {
601
+ this.onDragMove(e);
602
+ }, this);
603
+ this.e._onDragEnd = $.proxy(function(e) {
604
+ this.onDragEnd(e);
605
+ }, this);
606
+ this.e._onResize = $.proxy(function(e) {
607
+ this.onResize(e);
608
+ }, this);
609
+ this.e._transitionEnd = $.proxy(function(e) {
610
+ this.transitionEnd(e);
611
+ }, this);
612
+ this.e._preventClick = $.proxy(function(e) {
613
+ this.preventClick(e);
614
+ }, this);
615
+ };
616
+
617
+ /**
618
+ * Checks window `resize` event.
619
+ * @protected
620
+ */
621
+ Owl.prototype.onThrottledResize = function() {
622
+ window.clearTimeout(this.resizeTimer);
623
+ this.resizeTimer = window.setTimeout(this.e._onResize, this.settings.responsiveRefreshRate);
624
+ };
625
+
626
+ /**
627
+ * Checks window `resize` event.
628
+ * @protected
629
+ */
630
+ Owl.prototype.onResize = function() {
631
+ if (!this._items.length) {
632
+ return false;
633
+ }
634
+
635
+ if (this._width === this.$element.width()) {
636
+ return false;
637
+ }
638
+
639
+ if (this.trigger('resize').isDefaultPrevented()) {
640
+ return false;
641
+ }
642
+
643
+ this._width = this.$element.width();
644
+
645
+ this.invalidate('width');
646
+
647
+ this.refresh();
648
+
649
+ this.trigger('resized');
650
+ };
651
+
652
+ /**
653
+ * Checks for touch/mouse drag event type and add run event handlers.
654
+ * @protected
655
+ */
656
+ Owl.prototype.eventsRouter = function(event) {
657
+ var type = event.type;
658
+
659
+ if (type === "mousedown" || type === "touchstart") {
660
+ this.onDragStart(event);
661
+ } else if (type === "mousemove" || type === "touchmove") {
662
+ this.onDragMove(event);
663
+ } else if (type === "mouseup" || type === "touchend") {
664
+ this.onDragEnd(event);
665
+ } else if (type === "touchcancel") {
666
+ this.onDragEnd(event);
667
+ }
668
+ };
669
+
670
+ /**
671
+ * Checks for touch/mouse drag options and add necessery event handlers.
672
+ * @protected
673
+ */
674
+ Owl.prototype.internalEvents = function() {
675
+ var isTouch = isTouchSupport(),
676
+ isTouchIE = isTouchSupportIE();
677
+
678
+ if (this.settings.mouseDrag){
679
+ this.$stage.on('mousedown', $.proxy(function(event) { this.eventsRouter(event) }, this));
680
+ this.$stage.on('dragstart', function() { return false });
681
+ this.$stage.get(0).onselectstart = function() { return false };
682
+ } else {
683
+ this.$element.addClass('owl-text-select-on');
684
+ }
685
+
686
+ if (this.settings.touchDrag && !isTouchIE){
687
+ this.$stage.on('touchstart touchcancel', $.proxy(function(event) { this.eventsRouter(event) }, this));
688
+ }
689
+
690
+ // catch transitionEnd event
691
+ if (this.transitionEndVendor) {
692
+ this.on(this.$stage.get(0), this.transitionEndVendor, this.e._transitionEnd, false);
693
+ }
694
+
695
+ // responsive
696
+ if (this.settings.responsive !== false) {
697
+ this.on(window, 'resize', $.proxy(this.onThrottledResize, this));
698
+ }
699
+ };
700
+
701
+ /**
702
+ * Handles touchstart/mousedown event.
703
+ * @protected
704
+ * @param {Event} event - The event arguments.
705
+ */
706
+ Owl.prototype.onDragStart = function(event) {
707
+ var ev, isTouchEvent, pageX, pageY, animatedPos;
708
+
709
+ ev = event.originalEvent || event || window.event;
710
+
711
+ // prevent right click
712
+ if (ev.which === 3 || this.state.isTouch) {
713
+ return false;
714
+ }
715
+
716
+ if (ev.type === 'mousedown') {
717
+ this.$stage.addClass('owl-grab');
718
+ }
719
+
720
+ this.trigger('drag');
721
+ this.drag.startTime = new Date().getTime();
722
+ this.speed(0);
723
+ this.state.isTouch = true;
724
+ this.state.isScrolling = false;
725
+ this.state.isSwiping = false;
726
+ this.drag.distance = 0;
727
+
728
+ pageX = getTouches(ev).x;
729
+ pageY = getTouches(ev).y;
730
+
731
+ // get stage position left
732
+ this.drag.offsetX = this.$stage.position().left;
733
+ this.drag.offsetY = this.$stage.position().top;
734
+
735
+ if (this.settings.rtl) {
736
+ this.drag.offsetX = this.$stage.position().left + this.$stage.width() - this.width()
737
+ + this.settings.margin;
738
+ }
739
+
740
+ // catch position // ie to fix
741
+ if (this.state.inMotion && this.support3d) {
742
+ animatedPos = this.getTransformProperty();
743
+ this.drag.offsetX = animatedPos;
744
+ this.animate(animatedPos);
745
+ this.state.inMotion = true;
746
+ } else if (this.state.inMotion && !this.support3d) {
747
+ this.state.inMotion = false;
748
+ return false;
749
+ }
750
+
751
+ this.drag.startX = pageX - this.drag.offsetX;
752
+ this.drag.startY = pageY - this.drag.offsetY;
753
+
754
+ this.drag.start = pageX - this.drag.startX;
755
+ this.drag.targetEl = ev.target || ev.srcElement;
756
+ this.drag.updatedX = this.drag.start;
757
+
758
+ // to do/check
759
+ // prevent links and images dragging;
760
+ if (this.drag.targetEl.tagName === "IMG" || this.drag.targetEl.tagName === "A") {
761
+ this.drag.targetEl.draggable = false;
762
+ }
763
+
764
+ $(document).on('mousemove.owl.dragEvents mouseup.owl.dragEvents touchmove.owl.dragEvents touchend.owl.dragEvents', $.proxy(function(event) {this.eventsRouter(event)},this));
765
+ };
766
+
767
+ /**
768
+ * Handles the touchmove/mousemove events.
769
+ * @todo Simplify
770
+ * @protected
771
+ * @param {Event} event - The event arguments.
772
+ */
773
+ Owl.prototype.onDragMove = function(event) {
774
+ var ev, isTouchEvent, pageX, pageY, minValue, maxValue, pull;
775
+
776
+ if (!this.state.isTouch) {
777
+ return;
778
+ }
779
+
780
+ if (this.state.isScrolling) {
781
+ return;
782
+ }
783
+
784
+ ev = event.originalEvent || event || window.event;
785
+
786
+ pageX = getTouches(ev).x;
787
+ pageY = getTouches(ev).y;
788
+
789
+ // Drag Direction
790
+ this.drag.currentX = pageX - this.drag.startX;
791
+ this.drag.currentY = pageY - this.drag.startY;
792
+ this.drag.distance = this.drag.currentX - this.drag.offsetX;
793
+
794
+ // Check move direction
795
+ if (this.drag.distance < 0) {
796
+ this.state.direction = this.settings.rtl ? 'right' : 'left';
797
+ } else if (this.drag.distance > 0) {
798
+ this.state.direction = this.settings.rtl ? 'left' : 'right';
799
+ }
800
+ // Loop
801
+ if (this.settings.loop) {
802
+ if (this.op(this.drag.currentX, '>', this.coordinates(this.minimum())) && this.state.direction === 'right') {
803
+ this.drag.currentX -= (this.settings.center && this.coordinates(0)) - this.coordinates(this._items.length);
804
+ } else if (this.op(this.drag.currentX, '<', this.coordinates(this.maximum())) && this.state.direction === 'left') {
805
+ this.drag.currentX += (this.settings.center && this.coordinates(0)) - this.coordinates(this._items.length);
806
+ }
807
+ } else {
808
+ // pull
809
+ minValue = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum());
810
+ maxValue = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum());
811
+ pull = this.settings.pullDrag ? this.drag.distance / 5 : 0;
812
+ this.drag.currentX = Math.max(Math.min(this.drag.currentX, minValue + pull), maxValue + pull);
813
+ }
814
+
815
+ // Lock browser if swiping horizontal
816
+
817
+ if ((this.drag.distance > 8 || this.drag.distance < -8)) {
818
+ if (ev.preventDefault !== undefined) {
819
+ ev.preventDefault();
820
+ } else {
821
+ ev.returnValue = false;
822
+ }
823
+ this.state.isSwiping = true;
824
+ }
825
+
826
+ this.drag.updatedX = this.drag.currentX;
827
+
828
+ // Lock Owl if scrolling
829
+ if ((this.drag.currentY > 16 || this.drag.currentY < -16) && this.state.isSwiping === false) {
830
+ this.state.isScrolling = true;
831
+ this.drag.updatedX = this.drag.start;
832
+ }
833
+
834
+ this.animate(this.drag.updatedX);
835
+ };
836
+
837
+ /**
838
+ * Handles the touchend/mouseup events.
839
+ * @protected
840
+ */
841
+ Owl.prototype.onDragEnd = function(event) {
842
+ var compareTimes, distanceAbs, closest;
843
+
844
+ if (!this.state.isTouch) {
845
+ return;
846
+ }
847
+
848
+ if (event.type === 'mouseup') {
849
+ this.$stage.removeClass('owl-grab');
850
+ }
851
+
852
+ this.trigger('dragged');
853
+
854
+ // prevent links and images dragging;
855
+ this.drag.targetEl.removeAttribute("draggable");
856
+
857
+ // remove drag event listeners
858
+
859
+ this.state.isTouch = false;
860
+ this.state.isScrolling = false;
861
+ this.state.isSwiping = false;
862
+
863
+ // to check
864
+ if (this.drag.distance === 0 && this.state.inMotion !== true) {
865
+ this.state.inMotion = false;
866
+ return false;
867
+ }
868
+
869
+ // prevent clicks while scrolling
870
+
871
+ this.drag.endTime = new Date().getTime();
872
+ compareTimes = this.drag.endTime - this.drag.startTime;
873
+ distanceAbs = Math.abs(this.drag.distance);
874
+
875
+ // to test
876
+ if (distanceAbs > 3 || compareTimes > 300) {
877
+ this.removeClick(this.drag.targetEl);
878
+ }
879
+
880
+ closest = this.closest(this.drag.updatedX);
881
+
882
+ this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed);
883
+ this.current(closest);
884
+ this.invalidate('position');
885
+ this.update();
886
+
887
+ // if pullDrag is off then fire transitionEnd event manually when stick
888
+ // to border
889
+ if (!this.settings.pullDrag && this.drag.updatedX === this.coordinates(closest)) {
890
+ this.transitionEnd();
891
+ }
892
+
893
+ this.drag.distance = 0;
894
+
895
+ $(document).off('.owl.dragEvents');
896
+ };
897
+
898
+ /**
899
+ * Attaches `preventClick` to disable link while swipping.
900
+ * @protected
901
+ * @param {HTMLElement} [target] - The target of the `click` event.
902
+ */
903
+ Owl.prototype.removeClick = function(target) {
904
+ this.drag.targetEl = target;
905
+ $(target).on('click.preventClick', this.e._preventClick);
906
+ // to make sure click is removed:
907
+ window.setTimeout(function() {
908
+ $(target).off('click.preventClick');
909
+ }, 300);
910
+ };
911
+
912
+ /**
913
+ * Suppresses click event.
914
+ * @protected
915
+ * @param {Event} ev - The event arguments.
916
+ */
917
+ Owl.prototype.preventClick = function(ev) {
918
+ if (ev.preventDefault) {
919
+ ev.preventDefault();
920
+ } else {
921
+ ev.returnValue = false;
922
+ }
923
+ if (ev.stopPropagation) {
924
+ ev.stopPropagation();
925
+ }
926
+ $(ev.target).off('click.preventClick');
927
+ };
928
+
929
+ /**
930
+ * Catches stage position while animate (only CSS3).
931
+ * @protected
932
+ * @returns
933
+ */
934
+ Owl.prototype.getTransformProperty = function() {
935
+ var transform, matrix3d;
936
+
937
+ transform = window.getComputedStyle(this.$stage.get(0), null).getPropertyValue(this.vendorName + 'transform');
938
+ // var transform = this.$stage.css(this.vendorName + 'transform')
939
+ transform = transform.replace(/matrix(3d)?\(|\)/g, '').split(',');
940
+ matrix3d = transform.length === 16;
941
+
942
+ return matrix3d !== true ? transform[4] : transform[12];
943
+ };
944
+
945
+ /**
946
+ * Gets absolute position of the closest item for a coordinate.
947
+ * @todo Setting `freeDrag` makes `closest` not reusable. See #165.
948
+ * @protected
949
+ * @param {Number} coordinate - The coordinate in pixel.
950
+ * @return {Number} - The absolute position of the closest item.
951
+ */
952
+ Owl.prototype.closest = function(coordinate) {
953
+ var position = -1, pull = 30, width = this.width(), coordinates = this.coordinates();
954
+
955
+ if (!this.settings.freeDrag) {
956
+ // check closest item
957
+ $.each(coordinates, $.proxy(function(index, value) {
958
+ if (coordinate > value - pull && coordinate < value + pull) {
959
+ position = index;
960
+ } else if (this.op(coordinate, '<', value)
961
+ && this.op(coordinate, '>', coordinates[index + 1] || value - width)) {
962
+ position = this.state.direction === 'left' ? index + 1 : index;
963
+ }
964
+ return position === -1;
965
+ }, this));
966
+ }
967
+
968
+ if (!this.settings.loop) {
969
+ // non loop boundries
970
+ if (this.op(coordinate, '>', coordinates[this.minimum()])) {
971
+ position = coordinate = this.minimum();
972
+ } else if (this.op(coordinate, '<', coordinates[this.maximum()])) {
973
+ position = coordinate = this.maximum();
974
+ }
975
+ }
976
+
977
+ return position;
978
+ };
979
+
980
+ /**
981
+ * Animates the stage.
982
+ * @public
983
+ * @param {Number} coordinate - The coordinate in pixels.
984
+ */
985
+ Owl.prototype.animate = function(coordinate) {
986
+ this.trigger('translate');
987
+ this.state.inMotion = this.speed() > 0;
988
+
989
+ if (this.support3d) {
990
+ this.$stage.css({
991
+ transform: 'translate3d(' + coordinate + 'px' + ',0px, 0px)',
992
+ transition: (this.speed() / 1000) + 's'
993
+ });
994
+ } else if (this.state.isTouch) {
995
+ this.$stage.css({
996
+ left: coordinate + 'px'
997
+ });
998
+ } else {
999
+ this.$stage.animate({
1000
+ left: coordinate
1001
+ }, this.speed() / 1000, this.settings.fallbackEasing, $.proxy(function() {
1002
+ if (this.state.inMotion) {
1003
+ this.transitionEnd();
1004
+ }
1005
+ }, this));
1006
+ }
1007
+ };
1008
+
1009
+ /**
1010
+ * Sets the absolute position of the current item.
1011
+ * @public
1012
+ * @param {Number} [position] - The new absolute position or nothing to leave it unchanged.
1013
+ * @returns {Number} - The absolute position of the current item.
1014
+ */
1015
+ Owl.prototype.current = function(position) {
1016
+ if (position === undefined) {
1017
+ return this._current;
1018
+ }
1019
+
1020
+ if (this._items.length === 0) {
1021
+ return undefined;
1022
+ }
1023
+
1024
+ position = this.normalize(position);
1025
+
1026
+ if (this._current !== position) {
1027
+ var event = this.trigger('change', { property: { name: 'position', value: position } });
1028
+
1029
+ if (event.data !== undefined) {
1030
+ position = this.normalize(event.data);
1031
+ }
1032
+
1033
+ this._current = position;
1034
+
1035
+ this.invalidate('position');
1036
+
1037
+ this.trigger('changed', { property: { name: 'position', value: this._current } });
1038
+ }
1039
+
1040
+ return this._current;
1041
+ };
1042
+
1043
+ /**
1044
+ * Invalidates the given part of the update routine.
1045
+ * @param {String} part - The part to invalidate.
1046
+ */
1047
+ Owl.prototype.invalidate = function(part) {
1048
+ this._invalidated[part] = true;
1049
+ }
1050
+
1051
+ /**
1052
+ * Resets the absolute position of the current item.
1053
+ * @public
1054
+ * @param {Number} position - The absolute position of the new item.
1055
+ */
1056
+ Owl.prototype.reset = function(position) {
1057
+ position = this.normalize(position);
1058
+
1059
+ if (position === undefined) {
1060
+ return;
1061
+ }
1062
+
1063
+ this._speed = 0;
1064
+ this._current = position;
1065
+
1066
+ this.suppress([ 'translate', 'translated' ]);
1067
+
1068
+ this.animate(this.coordinates(position));
1069
+
1070
+ this.release([ 'translate', 'translated' ]);
1071
+ };
1072
+
1073
+ /**
1074
+ * Normalizes an absolute or a relative position for an item.
1075
+ * @public
1076
+ * @param {Number} position - The absolute or relative position to normalize.
1077
+ * @param {Boolean} [relative=false] - Whether the given position is relative or not.
1078
+ * @returns {Number} - The normalized position.
1079
+ */
1080
+ Owl.prototype.normalize = function(position, relative) {
1081
+ var n = (relative ? this._items.length : this._items.length + this._clones.length);
1082
+
1083
+ if (!$.isNumeric(position) || n < 1) {
1084
+ return undefined;
1085
+ }
1086
+
1087
+ if (this._clones.length) {
1088
+ position = ((position % n) + n) % n;
1089
+ } else {
1090
+ position = Math.max(this.minimum(relative), Math.min(this.maximum(relative), position));
1091
+ }
1092
+
1093
+ return position;
1094
+ };
1095
+
1096
+ /**
1097
+ * Converts an absolute position for an item into a relative position.
1098
+ * @public
1099
+ * @param {Number} position - The absolute position to convert.
1100
+ * @returns {Number} - The converted position.
1101
+ */
1102
+ Owl.prototype.relative = function(position) {
1103
+ position = this.normalize(position);
1104
+ position = position - this._clones.length / 2;
1105
+ return this.normalize(position, true);
1106
+ };
1107
+
1108
+ /**
1109
+ * Gets the maximum position for an item.
1110
+ * @public
1111
+ * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
1112
+ * @returns {Number}
1113
+ */
1114
+ Owl.prototype.maximum = function(relative) {
1115
+ var maximum, width, i = 0, coordinate,
1116
+ settings = this.settings;
1117
+
1118
+ if (relative) {
1119
+ return this._items.length - 1;
1120
+ }
1121
+
1122
+ if (!settings.loop && settings.center) {
1123
+ maximum = this._items.length - 1;
1124
+ } else if (!settings.loop && settings.items > 1 && !settings.center && this.viewport() > 900) {
1125
+ //If the viewport size is desktop or larger, increase slide by position by 1 to prevent last item being cut-off
1126
+ maximum = this._items.length - settings.items + 1;
1127
+ } else if (!settings.loop && !settings.center) {
1128
+ maximum = this._items.length - settings.items;
1129
+ } else if (settings.loop || settings.center) {
1130
+ maximum = this._items.length + settings.items;
1131
+ } else if (settings.autoWidth || settings.merge) {
1132
+ revert = settings.rtl ? 1 : -1;
1133
+ width = this.$stage.width() - this.$element.width();
1134
+ while (coordinate = this.coordinates(i)) {
1135
+ if (coordinate * revert >= width) {
1136
+ break;
1137
+ }
1138
+ maximum = ++i;
1139
+ }
1140
+ } else {
1141
+ throw 'Can not detect maximum absolute position.'
1142
+ }
1143
+
1144
+ return maximum;
1145
+ };
1146
+
1147
+ /**
1148
+ * Gets the minimum position for an item.
1149
+ * @public
1150
+ * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
1151
+ * @returns {Number}
1152
+ */
1153
+ Owl.prototype.minimum = function(relative) {
1154
+ if (relative) {
1155
+ return 0;
1156
+ }
1157
+
1158
+ return this._clones.length / 2;
1159
+ };
1160
+
1161
+ /**
1162
+ * Gets an item at the specified relative position.
1163
+ * @public
1164
+ * @param {Number} [position] - The relative position of the item.
1165
+ * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
1166
+ */
1167
+ Owl.prototype.items = function(position) {
1168
+ if (position === undefined) {
1169
+ return this._items.slice();
1170
+ }
1171
+
1172
+ position = this.normalize(position, true);
1173
+ return this._items[position];
1174
+ };
1175
+
1176
+ /**
1177
+ * Gets an item at the specified relative position.
1178
+ * @public
1179
+ * @param {Number} [position] - The relative position of the item.
1180
+ * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
1181
+ */
1182
+ Owl.prototype.mergers = function(position) {
1183
+ if (position === undefined) {
1184
+ return this._mergers.slice();
1185
+ }
1186
+
1187
+ position = this.normalize(position, true);
1188
+ return this._mergers[position];
1189
+ };
1190
+
1191
+ /**
1192
+ * Gets the absolute positions of clones for an item.
1193
+ * @public
1194
+ * @param {Number} [position] - The relative position of the item.
1195
+ * @returns {Array.<Number>} - The absolute positions of clones for the item or all if no position was given.
1196
+ */
1197
+ Owl.prototype.clones = function(position) {
1198
+ var odd = this._clones.length / 2,
1199
+ even = odd + this._items.length,
1200
+ map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 };
1201
+
1202
+ if (position === undefined) {
1203
+ return $.map(this._clones, function(v, i) { return map(i) });
1204
+ }
1205
+
1206
+ return $.map(this._clones, function(v, i) { return v === position ? map(i) : null });
1207
+ };
1208
+
1209
+ /**
1210
+ * Sets the current animation speed.
1211
+ * @public
1212
+ * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged.
1213
+ * @returns {Number} - The current animation speed in milliseconds.
1214
+ */
1215
+ Owl.prototype.speed = function(speed) {
1216
+ if (speed !== undefined) {
1217
+ this._speed = speed;
1218
+ }
1219
+
1220
+ return this._speed;
1221
+ };
1222
+
1223
+ /**
1224
+ * Gets the coordinate of an item.
1225
+ * @todo The name of this method is missleanding.
1226
+ * @public
1227
+ * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`.
1228
+ * @returns {Number|Array.<Number>} - The coordinate of the item in pixel or all coordinates.
1229
+ */
1230
+ Owl.prototype.coordinates = function(position) {
1231
+ var coordinate = null;
1232
+
1233
+ if (position === undefined) {
1234
+ return $.map(this._coordinates, $.proxy(function(coordinate, index) {
1235
+ return this.coordinates(index);
1236
+ }, this));
1237
+ }
1238
+
1239
+ if (this.settings.center) {
1240
+ coordinate = this._coordinates[position];
1241
+ coordinate += (this.width() - coordinate + (this._coordinates[position - 1] || 0)) / 2 * (this.settings.rtl ? -1 : 1);
1242
+ } else {
1243
+ coordinate = this._coordinates[position - 1] || 0;
1244
+ }
1245
+
1246
+ return coordinate;
1247
+ };
1248
+
1249
+ /**
1250
+ * Calculates the speed for a translation.
1251
+ * @protected
1252
+ * @param {Number} from - The absolute position of the start item.
1253
+ * @param {Number} to - The absolute position of the target item.
1254
+ * @param {Number} [factor=undefined] - The time factor in milliseconds.
1255
+ * @returns {Number} - The time in milliseconds for the translation.
1256
+ */
1257
+ Owl.prototype.duration = function(from, to, factor) {
1258
+ return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed));
1259
+ };
1260
+
1261
+ /**
1262
+ * Slides to the specified item.
1263
+ * @public
1264
+ * @param {Number} position - The position of the item.
1265
+ * @param {Number} [speed] - The time in milliseconds for the transition.
1266
+ */
1267
+ Owl.prototype.to = function(position, speed) {
1268
+ if (this.settings.loop) {
1269
+ var distance = position - this.relative(this.current()),
1270
+ revert = this.current(),
1271
+ before = this.current(),
1272
+ after = this.current() + distance,
1273
+ direction = before - after < 0 ? true : false,
1274
+ items = this._clones.length + this._items.length;
1275
+
1276
+ if (after < this.settings.items && direction === false) {
1277
+ revert = before + this._items.length;
1278
+ this.reset(revert);
1279
+ } else if (after >= items - this.settings.items && direction === true) {
1280
+ revert = before - this._items.length;
1281
+ this.reset(revert);
1282
+ }
1283
+ window.clearTimeout(this.e._goToLoop);
1284
+ this.e._goToLoop = window.setTimeout($.proxy(function() {
1285
+ this.speed(this.duration(this.current(), revert + distance, speed));
1286
+ this.current(revert + distance);
1287
+ this.update();
1288
+ }, this), 30);
1289
+ } else {
1290
+ this.speed(this.duration(this.current(), position, speed));
1291
+ this.current(position);
1292
+ this.update();
1293
+ }
1294
+ };
1295
+
1296
+ /**
1297
+ * Slides to the next item.
1298
+ * @public
1299
+ * @param {Number} [speed] - The time in milliseconds for the transition.
1300
+ */
1301
+ Owl.prototype.next = function(speed) {
1302
+ speed = speed || false;
1303
+ this.to(this.relative(this.current()) + 1, speed);
1304
+ };
1305
+
1306
+ /**
1307
+ * Slides to the previous item.
1308
+ * @public
1309
+ * @param {Number} [speed] - The time in milliseconds for the transition.
1310
+ */
1311
+ Owl.prototype.prev = function(speed) {
1312
+ speed = speed || false;
1313
+ this.to(this.relative(this.current()) - 1, speed);
1314
+ };
1315
+
1316
+ /**
1317
+ * Handles the end of an animation.
1318
+ * @protected
1319
+ * @param {Event} event - The event arguments.
1320
+ */
1321
+ Owl.prototype.transitionEnd = function(event) {
1322
+
1323
+ // if css2 animation then event object is undefined
1324
+ if (event !== undefined) {
1325
+ event.stopPropagation();
1326
+
1327
+ // Catch only owl-stage transitionEnd event
1328
+ if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) {
1329
+ return false;
1330
+ }
1331
+ }
1332
+
1333
+ this.state.inMotion = false;
1334
+ this.trigger('translated');
1335
+ };
1336
+
1337
+ /**
1338
+ * Gets viewport width.
1339
+ * @protected
1340
+ * @return {Number} - The width in pixel.
1341
+ */
1342
+ Owl.prototype.viewport = function() {
1343
+ var width;
1344
+ if (this.options.responsiveBaseElement !== window) {
1345
+ width = $(this.options.responsiveBaseElement).width();
1346
+ } else if (window.innerWidth) {
1347
+ width = window.innerWidth;
1348
+ } else if (document.documentElement && document.documentElement.clientWidth) {
1349
+ width = document.documentElement.clientWidth;
1350
+ } else {
1351
+ throw 'Can not detect viewport width.';
1352
+ }
1353
+ return width;
1354
+ };
1355
+
1356
+ /**
1357
+ * Replaces the current content.
1358
+ * @public
1359
+ * @param {HTMLElement|jQuery|String} content - The new content.
1360
+ */
1361
+ Owl.prototype.replace = function(content) {
1362
+ this.$stage.empty();
1363
+ this._items = [];
1364
+
1365
+ if (content) {
1366
+ content = (content instanceof jQuery) ? content : $(content);
1367
+ }
1368
+
1369
+ if (this.settings.nestedItemSelector) {
1370
+ content = content.find('.' + this.settings.nestedItemSelector);
1371
+ }
1372
+
1373
+ content.filter(function() {
1374
+ return this.nodeType === 1;
1375
+ }).each($.proxy(function(index, item) {
1376
+ item = this.prepare(item);
1377
+ this.$stage.append(item);
1378
+ this._items.push(item);
1379
+ this._mergers.push(item.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
1380
+ }, this));
1381
+
1382
+ this.reset($.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0);
1383
+
1384
+ this.invalidate('items');
1385
+ };
1386
+
1387
+ /**
1388
+ * Adds an item.
1389
+ * @todo Use `item` instead of `content` for the event arguments.
1390
+ * @public
1391
+ * @param {HTMLElement|jQuery|String} content - The item content to add.
1392
+ * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end.
1393
+ */
1394
+ Owl.prototype.add = function(content, position) {
1395
+ position = position === undefined ? this._items.length : this.normalize(position, true);
1396
+
1397
+ this.trigger('add', { content: content, position: position });
1398
+
1399
+ if (this._items.length === 0 || position === this._items.length) {
1400
+ this.$stage.append(content);
1401
+ this._items.push(content);
1402
+ this._mergers.push(content.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
1403
+ } else {
1404
+ this._items[position].before(content);
1405
+ this._items.splice(position, 0, content);
1406
+ this._mergers.splice(position, 0, content.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
1407
+ }
1408
+
1409
+ this.invalidate('items');
1410
+
1411
+ this.trigger('added', { content: content, position: position });
1412
+ };
1413
+
1414
+ /**
1415
+ * Removes an item by its position.
1416
+ * @todo Use `item` instead of `content` for the event arguments.
1417
+ * @public
1418
+ * @param {Number} position - The relative position of the item to remove.
1419
+ */
1420
+ Owl.prototype.remove = function(position) {
1421
+ position = this.normalize(position, true);
1422
+
1423
+ if (position === undefined) {
1424
+ return;
1425
+ }
1426
+
1427
+ this.trigger('remove', { content: this._items[position], position: position });
1428
+
1429
+ this._items[position].remove();
1430
+ this._items.splice(position, 1);
1431
+ this._mergers.splice(position, 1);
1432
+
1433
+ this.invalidate('items');
1434
+
1435
+ this.trigger('removed', { content: null, position: position });
1436
+ };
1437
+
1438
+ /**
1439
+ * Adds triggerable events.
1440
+ * @protected
1441
+ */
1442
+ Owl.prototype.addTriggerableEvents = function() {
1443
+ var handler = $.proxy(function(callback, event) {
1444
+ return $.proxy(function(e) {
1445
+ if (e.relatedTarget !== this) {
1446
+ this.suppress([ event ]);
1447
+ callback.apply(this, [].slice.call(arguments, 1));
1448
+ this.release([ event ]);
1449
+ }
1450
+ }, this);
1451
+ }, this);
1452
+
1453
+ $.each({
1454
+ 'next': this.next,
1455
+ 'prev': this.prev,
1456
+ 'to': this.to,
1457
+ 'destroy': this.destroy,
1458
+ 'refresh': this.refresh,
1459
+ 'replace': this.replace,
1460
+ 'add': this.add,
1461
+ 'remove': this.remove
1462
+ }, $.proxy(function(event, callback) {
1463
+ this.$element.on(event + '.owl.carousel', handler(callback, event + '.owl.carousel'));
1464
+ }, this));
1465
+
1466
+ };
1467
+
1468
+ /**
1469
+ * Watches the visibility of the carousel element.
1470
+ * @protected
1471
+ */
1472
+ Owl.prototype.watchVisibility = function() {
1473
+
1474
+ // test on zepto
1475
+ if (!isElVisible(this.$element.get(0))) {
1476
+ this.$element.addClass('owl-hidden');
1477
+ window.clearInterval(this.e._checkVisibile);
1478
+ this.e._checkVisibile = window.setInterval($.proxy(checkVisible, this), 500);
1479
+ }
1480
+
1481
+ function isElVisible(el) {
1482
+ return el.offsetWidth > 0 && el.offsetHeight > 0;
1483
+ }
1484
+
1485
+ function checkVisible() {
1486
+ if (isElVisible(this.$element.get(0))) {
1487
+ this.$element.removeClass('owl-hidden');
1488
+ this.refresh();
1489
+ window.clearInterval(this.e._checkVisibile);
1490
+ }
1491
+ }
1492
+ };
1493
+
1494
+ /**
1495
+ * Preloads images with auto width.
1496
+ * @protected
1497
+ * @todo Still to test
1498
+ */
1499
+ Owl.prototype.preloadAutoWidthImages = function(imgs) {
1500
+ var loaded, that, $el, img;
1501
+
1502
+ loaded = 0;
1503
+ that = this;
1504
+ imgs.each(function(i, el) {
1505
+ $el = $(el);
1506
+ img = new Image();
1507
+
1508
+ img.onload = function() {
1509
+ loaded++;
1510
+ $el.attr('src', img.src);
1511
+ $el.css('opacity', 1);
1512
+ if (loaded >= imgs.length) {
1513
+ that.state.imagesLoaded = true;
1514
+ that.initialize();
1515
+ }
1516
+ };
1517
+
1518
+ img.src = $el.attr('src') || $el.attr('data-src') || $el.attr('data-src-retina');
1519
+ });
1520
+ };
1521
+
1522
+ /**
1523
+ * Destroys the carousel.
1524
+ * @public
1525
+ */
1526
+ Owl.prototype.destroy = function() {
1527
+
1528
+ if (this.$element.hasClass(this.settings.themeClass)) {
1529
+ this.$element.removeClass(this.settings.themeClass);
1530
+ }
1531
+
1532
+ if (this.settings.responsive !== false) {
1533
+ $(window).off('resize.owl.carousel');
1534
+ }
1535
+
1536
+ if (this.transitionEndVendor) {
1537
+ this.off(this.$stage.get(0), this.transitionEndVendor, this.e._transitionEnd);
1538
+ }
1539
+
1540
+ for ( var i in this._plugins) {
1541
+ this._plugins[i].destroy();
1542
+ }
1543
+
1544
+ if (this.settings.mouseDrag || this.settings.touchDrag) {
1545
+ this.$stage.off('mousedown touchstart touchcancel');
1546
+ $(document).off('.owl.dragEvents');
1547
+ this.$stage.get(0).onselectstart = function() {};
1548
+ this.$stage.off('dragstart', function() { return false });
1549
+ }
1550
+
1551
+ // remove event handlers in the ".owl.carousel" namespace
1552
+ this.$element.off('.owl');
1553
+
1554
+ this.$stage.children('.cloned').remove();
1555
+ this.e = null;
1556
+ this.$element.removeData('owlCarousel');
1557
+
1558
+ this.$stage.children().contents().unwrap();
1559
+ this.$stage.children().unwrap();
1560
+ this.$stage.unwrap();
1561
+ };
1562
+
1563
+ /**
1564
+ * Operators to calculate right-to-left and left-to-right.
1565
+ * @protected
1566
+ * @param {Number} [a] - The left side operand.
1567
+ * @param {String} [o] - The operator.
1568
+ * @param {Number} [b] - The right side operand.
1569
+ */
1570
+ Owl.prototype.op = function(a, o, b) {
1571
+ var rtl = this.settings.rtl;
1572
+ switch (o) {
1573
+ case '<':
1574
+ return rtl ? a > b : a < b;
1575
+ case '>':
1576
+ return rtl ? a < b : a > b;
1577
+ case '>=':
1578
+ return rtl ? a <= b : a >= b;
1579
+ case '<=':
1580
+ return rtl ? a >= b : a <= b;
1581
+ default:
1582
+ break;
1583
+ }
1584
+ };
1585
+
1586
+ /**
1587
+ * Attaches to an internal event.
1588
+ * @protected
1589
+ * @param {HTMLElement} element - The event source.
1590
+ * @param {String} event - The event name.
1591
+ * @param {Function} listener - The event handler to attach.
1592
+ * @param {Boolean} capture - Wether the event should be handled at the capturing phase or not.
1593
+ */
1594
+ Owl.prototype.on = function(element, event, listener, capture) {
1595
+ if (element.addEventListener) {
1596
+ element.addEventListener(event, listener, capture);
1597
+ } else if (element.attachEvent) {
1598
+ element.attachEvent('on' + event, listener);
1599
+ }
1600
+ };
1601
+
1602
+ /**
1603
+ * Detaches from an internal event.
1604
+ * @protected
1605
+ * @param {HTMLElement} element - The event source.
1606
+ * @param {String} event - The event name.
1607
+ * @param {Function} listener - The attached event handler to detach.
1608
+ * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not.
1609
+ */
1610
+ Owl.prototype.off = function(element, event, listener, capture) {
1611
+ if (element.removeEventListener) {
1612
+ element.removeEventListener(event, listener, capture);
1613
+ } else if (element.detachEvent) {
1614
+ element.detachEvent('on' + event, listener);
1615
+ }
1616
+ };
1617
+
1618
+ /**
1619
+ * Triggers an public event.
1620
+ * @protected
1621
+ * @param {String} name - The event name.
1622
+ * @param {*} [data=null] - The event data.
1623
+ * @param {String} [namespace=.owl.carousel] - The event namespace.
1624
+ * @returns {Event} - The event arguments.
1625
+ */
1626
+ Owl.prototype.trigger = function(name, data, namespace) {
1627
+ var status = {
1628
+ item: { count: this._items.length, index: this.current() }
1629
+ }, handler = $.camelCase(
1630
+ $.grep([ 'on', name, namespace ], function(v) { return v })
1631
+ .join('-').toLowerCase()
1632
+ ), event = $.Event(
1633
+ [ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(),
1634
+ $.extend({ relatedTarget: this }, status, data)
1635
+ );
1636
+
1637
+ if (!this._supress[name]) {
1638
+ $.each(this._plugins, function(name, plugin) {
1639
+ if (plugin.onTrigger) {
1640
+ plugin.onTrigger(event);
1641
+ }
1642
+ });
1643
+
1644
+ this.$element.trigger(event);
1645
+
1646
+ if (this.settings && typeof this.settings[handler] === 'function') {
1647
+ this.settings[handler].apply(this, event);
1648
+ }
1649
+ }
1650
+
1651
+ return event;
1652
+ };
1653
+
1654
+ /**
1655
+ * Suppresses events.
1656
+ * @protected
1657
+ * @param {Array.<String>} events - The events to suppress.
1658
+ */
1659
+ Owl.prototype.suppress = function(events) {
1660
+ $.each(events, $.proxy(function(index, event) {
1661
+ this._supress[event] = true;
1662
+ }, this));
1663
+ }
1664
+
1665
+ /**
1666
+ * Releases suppressed events.
1667
+ * @protected
1668
+ * @param {Array.<String>} events - The events to release.
1669
+ */
1670
+ Owl.prototype.release = function(events) {
1671
+ $.each(events, $.proxy(function(index, event) {
1672
+ delete this._supress[event];
1673
+ }, this));
1674
+ }
1675
+
1676
+ /**
1677
+ * Checks the availability of some browser features.
1678
+ * @protected
1679
+ */
1680
+ Owl.prototype.browserSupport = function() {
1681
+ this.support3d = isPerspective();
1682
+
1683
+ if (this.support3d) {
1684
+ this.transformVendor = isTransform();
1685
+
1686
+ // take transitionend event name by detecting transition
1687
+ var endVendors = [ 'transitionend', 'webkitTransitionEnd', 'transitionend', 'oTransitionEnd' ];
1688
+ this.transitionEndVendor = endVendors[isTransition()];
1689
+
1690
+ // take vendor name from transform name
1691
+ this.vendorName = this.transformVendor.replace(/Transform/i, '');
1692
+ this.vendorName = this.vendorName !== '' ? '-' + this.vendorName.toLowerCase() + '-' : '';
1693
+ }
1694
+
1695
+ this.state.orientation = window.orientation;
1696
+ };
1697
+
1698
+ /**
1699
+ * Get touch/drag coordinats.
1700
+ * @private
1701
+ * @param {event} - mousedown/touchstart event
1702
+ * @returns {object} - Contains X and Y of current mouse/touch position
1703
+ */
1704
+
1705
+ function getTouches(event) {
1706
+ if (event.touches !== undefined) {
1707
+ return {
1708
+ x: event.touches[0].pageX,
1709
+ y: event.touches[0].pageY
1710
+ };
1711
+ }
1712
+
1713
+ if (event.touches === undefined) {
1714
+ if (event.pageX !== undefined) {
1715
+ return {
1716
+ x: event.pageX,
1717
+ y: event.pageY
1718
+ };
1719
+ }
1720
+
1721
+ if (event.pageX === undefined) {
1722
+ return {
1723
+ x: event.clientX,
1724
+ y: event.clientY
1725
+ };
1726
+ }
1727
+ }
1728
+ }
1729
+
1730
+ /**
1731
+ * Checks for CSS support.
1732
+ * @private
1733
+ * @param {Array} array - The CSS properties to check for.
1734
+ * @returns {Array} - Contains the supported CSS property name and its index or `false`.
1735
+ */
1736
+ function isStyleSupported(array) {
1737
+ var p, s, fake = document.createElement('div'), list = array;
1738
+ for (p in list) {
1739
+ s = list[p];
1740
+ if (typeof fake.style[s] !== 'undefined') {
1741
+ fake = null;
1742
+ return [ s, p ];
1743
+ }
1744
+ }
1745
+ return [ false ];
1746
+ }
1747
+
1748
+ /**
1749
+ * Checks for CSS transition support.
1750
+ * @private
1751
+ * @todo Realy bad design
1752
+ * @returns {Number}
1753
+ */
1754
+ function isTransition() {
1755
+ return isStyleSupported([ 'transition', 'WebkitTransition', 'MozTransition', 'OTransition' ])[1];
1756
+ }
1757
+
1758
+ /**
1759
+ * Checks for CSS transform support.
1760
+ * @private
1761
+ * @returns {String} The supported property name or false.
1762
+ */
1763
+ function isTransform() {
1764
+ return isStyleSupported([ 'transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform' ])[0];
1765
+ }
1766
+
1767
+ /**
1768
+ * Checks for CSS perspective support.
1769
+ * @private
1770
+ * @returns {String} The supported property name or false.
1771
+ */
1772
+ function isPerspective() {
1773
+ return isStyleSupported([ 'perspective', 'webkitPerspective', 'MozPerspective', 'OPerspective', 'MsPerspective' ])[0];
1774
+ }
1775
+
1776
+ /**
1777
+ * Checks wether touch is supported or not.
1778
+ * @private
1779
+ * @returns {Boolean}
1780
+ */
1781
+ function isTouchSupport() {
1782
+ return 'ontouchstart' in window || !!(navigator.msMaxTouchPoints);
1783
+ }
1784
+
1785
+ /**
1786
+ * Checks wether touch is supported or not for IE.
1787
+ * @private
1788
+ * @returns {Boolean}
1789
+ */
1790
+ function isTouchSupportIE() {
1791
+ return window.navigator.msPointerEnabled;
1792
+ }
1793
+
1794
+ /**
1795
+ * The jQuery Plugin for the Owl Carousel
1796
+ * @public
1797
+ */
1798
+ $.fn.owlCarousel = function(options) {
1799
+ return this.each(function() {
1800
+ if (!$(this).data('owlCarousel')) {
1801
+ $(this).data('owlCarousel', new Owl(this, options));
1802
+ }
1803
+ });
1804
+ };
1805
+
1806
+ /**
1807
+ * The constructor for the jQuery Plugin
1808
+ * @public
1809
+ */
1810
+ $.fn.owlCarousel.Constructor = Owl;
1811
+
1812
+ })(window.Zepto || window.jQuery, window, document);
1813
+
1814
+ /**
1815
+ * Lazy Plugin
1816
+ * @version 2.0.0
1817
+ * @author Bartosz Wojciechowski
1818
+ * @license The MIT License (MIT)
1819
+ */
1820
+ ;(function($, window, document, undefined) {
1821
+
1822
+ /**
1823
+ * Creates the lazy plugin.
1824
+ * @class The Lazy Plugin
1825
+ * @param {Owl} carousel - The Owl Carousel
1826
+ */
1827
+ var Lazy = function(carousel) {
1828
+
1829
+ /**
1830
+ * Reference to the core.
1831
+ * @protected
1832
+ * @type {Owl}
1833
+ */
1834
+ this._core = carousel;
1835
+
1836
+ /**
1837
+ * Already loaded items.
1838
+ * @protected
1839
+ * @type {Array.<jQuery>}
1840
+ */
1841
+ this._loaded = [];
1842
+
1843
+ /**
1844
+ * Event handlers.
1845
+ * @protected
1846
+ * @type {Object}
1847
+ */
1848
+ this._handlers = {
1849
+ 'initialized.owl.carousel change.owl.carousel': $.proxy(function(e) {
1850
+ if (!e.namespace) {
1851
+ return;
1852
+ }
1853
+
1854
+ if (!this._core.settings || !this._core.settings.lazyLoad) {
1855
+ return;
1856
+ }
1857
+
1858
+ if ((e.property && e.property.name == 'position') || e.type == 'initialized') {
1859
+ var settings = this._core.settings,
1860
+ n = (settings.center && Math.ceil(settings.items / 2) || settings.items),
1861
+ i = ((settings.center && n * -1) || 0),
1862
+ position = ((e.property && e.property.value) || this._core.current()) + i,
1863
+ clones = this._core.clones().length,
1864
+ load = $.proxy(function(i, v) { this.load(v) }, this);
1865
+
1866
+ while (i++ < n) {
1867
+ this.load(clones / 2 + this._core.relative(position));
1868
+ clones && $.each(this._core.clones(this._core.relative(position++)), load);
1869
+ }
1870
+ }
1871
+ }, this)
1872
+ };
1873
+
1874
+ // set the default options
1875
+ this._core.options = $.extend({}, Lazy.Defaults, this._core.options);
1876
+
1877
+ // register event handler
1878
+ this._core.$element.on(this._handlers);
1879
+ }
1880
+
1881
+ /**
1882
+ * Default options.
1883
+ * @public
1884
+ */
1885
+ Lazy.Defaults = {
1886
+ lazyLoad: false
1887
+ }
1888
+
1889
+ /**
1890
+ * Loads all resources of an item at the specified position.
1891
+ * @param {Number} position - The absolute position of the item.
1892
+ * @protected
1893
+ */
1894
+ Lazy.prototype.load = function(position) {
1895
+ var $item = this._core.$stage.children().eq(position),
1896
+ $elements = $item && $item.find('.owl-lazy');
1897
+
1898
+ if (!$elements || $.inArray($item.get(0), this._loaded) > -1) {
1899
+ return;
1900
+ }
1901
+
1902
+ $elements.each($.proxy(function(index, element) {
1903
+ var $element = $(element), image,
1904
+ url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src');
1905
+
1906
+ this._core.trigger('load', { element: $element, url: url }, 'lazy');
1907
+
1908
+ if ($element.is('img')) {
1909
+ $element.one('load.owl.lazy', $.proxy(function() {
1910
+ $element.css('opacity', 1);
1911
+ this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
1912
+ }, this)).attr('src', url);
1913
+ } else {
1914
+ image = new Image();
1915
+ image.onload = $.proxy(function() {
1916
+ $element.css({
1917
+ 'background-image': 'url(' + url + ')',
1918
+ 'opacity': '1'
1919
+ });
1920
+ this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
1921
+ }, this);
1922
+ image.src = url;
1923
+ }
1924
+ }, this));
1925
+
1926
+ this._loaded.push($item.get(0));
1927
+ }
1928
+
1929
+ /**
1930
+ * Destroys the plugin.
1931
+ * @public
1932
+ */
1933
+ Lazy.prototype.destroy = function() {
1934
+ var handler, property;
1935
+
1936
+ for (handler in this.handlers) {
1937
+ this._core.$element.off(handler, this.handlers[handler]);
1938
+ }
1939
+ for (property in Object.getOwnPropertyNames(this)) {
1940
+ typeof this[property] != 'function' && (this[property] = null);
1941
+ }
1942
+ }
1943
+
1944
+ $.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy;
1945
+
1946
+ })(window.Zepto || window.jQuery, window, document);
1947
+
1948
+ /**
1949
+ * AutoHeight Plugin
1950
+ * @version 2.0.0
1951
+ * @author Bartosz Wojciechowski
1952
+ * @license The MIT License (MIT)
1953
+ */
1954
+ ;(function($, window, document, undefined) {
1955
+
1956
+ /**
1957
+ * Creates the auto height plugin.
1958
+ * @class The Auto Height Plugin
1959
+ * @param {Owl} carousel - The Owl Carousel
1960
+ */
1961
+ var AutoHeight = function(carousel) {
1962
+ /**
1963
+ * Reference to the core.
1964
+ * @protected
1965
+ * @type {Owl}
1966
+ */
1967
+ this._core = carousel;
1968
+
1969
+ /**
1970
+ * All event handlers.
1971
+ * @protected
1972
+ * @type {Object}
1973
+ */
1974
+ this._handlers = {
1975
+ 'initialized.owl.carousel': $.proxy(function() {
1976
+ if (this._core.settings.autoHeight) {
1977
+ this.update();
1978
+ }
1979
+ }, this),
1980
+ 'changed.owl.carousel': $.proxy(function(e) {
1981
+ if (this._core.settings.autoHeight && e.property.name == 'position'){
1982
+ this.update();
1983
+ }
1984
+ }, this),
1985
+ 'loaded.owl.lazy': $.proxy(function(e) {
1986
+ if (this._core.settings.autoHeight && e.element.closest('.' + this._core.settings.itemClass)
1987
+ === this._core.$stage.children().eq(this._core.current())) {
1988
+ this.update();
1989
+ }
1990
+ }, this)
1991
+ };
1992
+
1993
+ // set default options
1994
+ this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);
1995
+
1996
+ // register event handlers
1997
+ this._core.$element.on(this._handlers);
1998
+ };
1999
+
2000
+ /**
2001
+ * Default options.
2002
+ * @public
2003
+ */
2004
+ AutoHeight.Defaults = {
2005
+ autoHeight: false,
2006
+ autoHeightClass: 'owl-height'
2007
+ };
2008
+
2009
+ /**
2010
+ * Updates the view.
2011
+ */
2012
+ AutoHeight.prototype.update = function() {
2013
+ this._core.$stage.parent()
2014
+ .height(this._core.$stage.children().eq(this._core.current()).height())
2015
+ .addClass(this._core.settings.autoHeightClass);
2016
+ };
2017
+
2018
+ AutoHeight.prototype.destroy = function() {
2019
+ var handler, property;
2020
+
2021
+ for (handler in this._handlers) {
2022
+ this._core.$element.off(handler, this._handlers[handler]);
2023
+ }
2024
+ for (property in Object.getOwnPropertyNames(this)) {
2025
+ typeof this[property] != 'function' && (this[property] = null);
2026
+ }
2027
+ };
2028
+
2029
+ $.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
2030
+
2031
+ })(window.Zepto || window.jQuery, window, document);
2032
+
2033
+ /**
2034
+ * Video Plugin
2035
+ * @version 2.0.0
2036
+ * @author Bartosz Wojciechowski
2037
+ * @license The MIT License (MIT)
2038
+ */
2039
+ ;(function($, window, document, undefined) {
2040
+
2041
+ /**
2042
+ * Creates the video plugin.
2043
+ * @class The Video Plugin
2044
+ * @param {Owl} carousel - The Owl Carousel
2045
+ */
2046
+ var Video = function(carousel) {
2047
+ /**
2048
+ * Reference to the core.
2049
+ * @protected
2050
+ * @type {Owl}
2051
+ */
2052
+ this._core = carousel;
2053
+
2054
+ /**
2055
+ * Cache all video URLs.
2056
+ * @protected
2057
+ * @type {Object}
2058
+ */
2059
+ this._videos = {};
2060
+
2061
+ /**
2062
+ * Current playing item.
2063
+ * @protected
2064
+ * @type {jQuery}
2065
+ */
2066
+ this._playing = null;
2067
+
2068
+ /**
2069
+ * Whether this is in fullscreen or not.
2070
+ * @protected
2071
+ * @type {Boolean}
2072
+ */
2073
+ this._fullscreen = false;
2074
+
2075
+ /**
2076
+ * All event handlers.
2077
+ * @protected
2078
+ * @type {Object}
2079
+ */
2080
+ this._handlers = {
2081
+ 'resize.owl.carousel': $.proxy(function(e) {
2082
+ if (this._core.settings.video && !this.isInFullScreen()) {
2083
+ e.preventDefault();
2084
+ }
2085
+ }, this),
2086
+ 'refresh.owl.carousel changed.owl.carousel': $.proxy(function(e) {
2087
+ if (this._playing) {
2088
+ this.stop();
2089
+ }
2090
+ }, this),
2091
+ 'prepared.owl.carousel': $.proxy(function(e) {
2092
+ var $element = $(e.content).find('.owl-video');
2093
+ if ($element.length) {
2094
+ $element.css('display', 'none');
2095
+ this.fetch($element, $(e.content));
2096
+ }
2097
+ }, this)
2098
+ };
2099
+
2100
+ // set default options
2101
+ this._core.options = $.extend({}, Video.Defaults, this._core.options);
2102
+
2103
+ // register event handlers
2104
+ this._core.$element.on(this._handlers);
2105
+
2106
+ this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
2107
+ this.play(e);
2108
+ }, this));
2109
+ };
2110
+
2111
+ /**
2112
+ * Default options.
2113
+ * @public
2114
+ */
2115
+ Video.Defaults = {
2116
+ video: false,
2117
+ videoHeight: false,
2118
+ videoWidth: false
2119
+ };
2120
+
2121
+ /**
2122
+ * Gets the video ID and the type (YouTube/Vimeo only).
2123
+ * @protected
2124
+ * @param {jQuery} target - The target containing the video data.
2125
+ * @param {jQuery} item - The item containing the video.
2126
+ */
2127
+ Video.prototype.fetch = function(target, item) {
2128
+
2129
+ var type = target.attr('data-vimeo-id') ? 'vimeo' : 'youtube',
2130
+ id = target.attr('data-vimeo-id') || target.attr('data-youtube-id'),
2131
+ width = target.attr('data-width') || this._core.settings.videoWidth,
2132
+ height = target.attr('data-height') || this._core.settings.videoHeight,
2133
+ url = target.attr('href');
2134
+
2135
+ if (url) {
2136
+ id = url.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);
2137
+
2138
+ if (id[3].indexOf('youtu') > -1) {
2139
+ type = 'youtube';
2140
+ } else if (id[3].indexOf('vimeo') > -1) {
2141
+ type = 'vimeo';
2142
+ } else {
2143
+ throw new Error('Video URL not supported.');
2144
+ }
2145
+ id = id[6];
2146
+ } else {
2147
+ throw new Error('Missing video URL.');
2148
+ }
2149
+
2150
+ this._videos[url] = {
2151
+ type: type,
2152
+ id: id,
2153
+ width: width,
2154
+ height: height
2155
+ };
2156
+
2157
+ item.attr('data-video', url);
2158
+
2159
+ this.thumbnail(target, this._videos[url]);
2160
+ };
2161
+
2162
+ /**
2163
+ * Creates video thumbnail.
2164
+ * @protected
2165
+ * @param {jQuery} target - The target containing the video data.
2166
+ * @param {Object} info - The video info object.
2167
+ * @see `fetch`
2168
+ */
2169
+ Video.prototype.thumbnail = function(target, video) {
2170
+
2171
+ var tnLink,
2172
+ icon,
2173
+ path,
2174
+ dimensions = video.width && video.height ? 'style="width:' + video.width + 'px;height:' + video.height + 'px;"' : '',
2175
+ customTn = target.find('img'),
2176
+ srcType = 'src',
2177
+ lazyClass = '',
2178
+ settings = this._core.settings,
2179
+ create = function(path) {
2180
+ icon = '<div class="owl-video-play-icon"></div>';
2181
+
2182
+ if (settings.lazyLoad) {
2183
+ tnLink = '<div class="owl-video-tn ' + lazyClass + '" ' + srcType + '="' + path + '"></div>';
2184
+ } else {
2185
+ tnLink = '<div class="owl-video-tn" style="opacity:1;background-image:url(' + path + ')"></div>';
2186
+ }
2187
+ target.after(tnLink);
2188
+ target.after(icon);
2189
+ };
2190
+
2191
+ // wrap video content into owl-video-wrapper div
2192
+ target.wrap('<div class="owl-video-wrapper"' + dimensions + '></div>');
2193
+
2194
+ if (this._core.settings.lazyLoad) {
2195
+ srcType = 'data-src';
2196
+ lazyClass = 'owl-lazy';
2197
+ }
2198
+
2199
+ // custom thumbnail
2200
+ if (customTn.length) {
2201
+ create(customTn.attr(srcType));
2202
+ customTn.remove();
2203
+ return false;
2204
+ }
2205
+
2206
+ if (video.type === 'youtube') {
2207
+ path = "http://img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
2208
+ create(path);
2209
+ } else if (video.type === 'vimeo') {
2210
+ $.ajax({
2211
+ type: 'GET',
2212
+ url: 'http://vimeo.com/api/v2/video/' + video.id + '.json',
2213
+ jsonp: 'callback',
2214
+ dataType: 'jsonp',
2215
+ success: function(data) {
2216
+ path = data[0].thumbnail_large;
2217
+ create(path);
2218
+ }
2219
+ });
2220
+ }
2221
+ };
2222
+
2223
+ /**
2224
+ * Stops the current video.
2225
+ * @public
2226
+ */
2227
+ Video.prototype.stop = function() {
2228
+ this._core.trigger('stop', null, 'video');
2229
+ this._playing.find('.owl-video-frame').remove();
2230
+ this._playing.removeClass('owl-video-playing');
2231
+ this._playing = null;
2232
+ };
2233
+
2234
+ /**
2235
+ * Starts the current video.
2236
+ * @public
2237
+ * @param {Event} ev - The event arguments.
2238
+ */
2239
+ Video.prototype.play = function(ev) {
2240
+ this._core.trigger('play', null, 'video');
2241
+
2242
+ if (this._playing) {
2243
+ this.stop();
2244
+ }
2245
+
2246
+ var target = $(ev.target || ev.srcElement),
2247
+ item = target.closest('.' + this._core.settings.itemClass),
2248
+ video = this._videos[item.attr('data-video')],
2249
+ width = video.width || '100%',
2250
+ height = video.height || this._core.$stage.height(),
2251
+ html, wrap;
2252
+
2253
+ if (video.type === 'youtube') {
2254
+ html = '<iframe width="' + width + '" height="' + height + '" src="http://www.youtube.com/embed/'
2255
+ + video.id + '?autoplay=1&v=' + video.id + '" frameborder="0" allowfullscreen></iframe>';
2256
+ } else if (video.type === 'vimeo') {
2257
+ html = '<iframe src="http://player.vimeo.com/video/' + video.id + '?autoplay=1" width="' + width
2258
+ + '" height="' + height
2259
+ + '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
2260
+ }
2261
+
2262
+ item.addClass('owl-video-playing');
2263
+ this._playing = item;
2264
+
2265
+ wrap = $('<div style="height:' + height + 'px; width:' + width + 'px" class="owl-video-frame">'
2266
+ + html + '</div>');
2267
+ target.after(wrap);
2268
+ };
2269
+
2270
+ /**
2271
+ * Checks whether an video is currently in full screen mode or not.
2272
+ * @todo Bad style because looks like a readonly method but changes members.
2273
+ * @protected
2274
+ * @returns {Boolean}
2275
+ */
2276
+ Video.prototype.isInFullScreen = function() {
2277
+
2278
+ // if Vimeo Fullscreen mode
2279
+ var element = document.fullscreenElement || document.mozFullScreenElement
2280
+ || document.webkitFullscreenElement;
2281
+
2282
+ if (element && $(element).parent().hasClass('owl-video-frame')) {
2283
+ this._core.speed(0);
2284
+ this._fullscreen = true;
2285
+ }
2286
+
2287
+ if (element && this._fullscreen && this._playing) {
2288
+ return false;
2289
+ }
2290
+
2291
+ // comming back from fullscreen
2292
+ if (this._fullscreen) {
2293
+ this._fullscreen = false;
2294
+ return false;
2295
+ }
2296
+
2297
+ // check full screen mode and window orientation
2298
+ if (this._playing) {
2299
+ if (this._core.state.orientation !== window.orientation) {
2300
+ this._core.state.orientation = window.orientation;
2301
+ return false;
2302
+ }
2303
+ }
2304
+
2305
+ return true;
2306
+ };
2307
+
2308
+ /**
2309
+ * Destroys the plugin.
2310
+ */
2311
+ Video.prototype.destroy = function() {
2312
+ var handler, property;
2313
+
2314
+ this._core.$element.off('click.owl.video');
2315
+
2316
+ for (handler in this._handlers) {
2317
+ this._core.$element.off(handler, this._handlers[handler]);
2318
+ }
2319
+ for (property in Object.getOwnPropertyNames(this)) {
2320
+ typeof this[property] != 'function' && (this[property] = null);
2321
+ }
2322
+ };
2323
+
2324
+ $.fn.owlCarousel.Constructor.Plugins.Video = Video;
2325
+
2326
+ })(window.Zepto || window.jQuery, window, document);
2327
+
2328
+ /**
2329
+ * Animate Plugin
2330
+ * @version 2.0.0
2331
+ * @author Bartosz Wojciechowski
2332
+ * @license The MIT License (MIT)
2333
+ */
2334
+ ;(function($, window, document, undefined) {
2335
+
2336
+ /**
2337
+ * Creates the animate plugin.
2338
+ * @class The Navigation Plugin
2339
+ * @param {Owl} scope - The Owl Carousel
2340
+ */
2341
+ var Animate = function(scope) {
2342
+ this.core = scope;
2343
+ this.core.options = $.extend({}, Animate.Defaults, this.core.options);
2344
+ this.swapping = true;
2345
+ this.previous = undefined;
2346
+ this.next = undefined;
2347
+
2348
+ this.handlers = {
2349
+ 'change.owl.carousel': $.proxy(function(e) {
2350
+ if (e.property.name == 'position') {
2351
+ this.previous = this.core.current();
2352
+ this.next = e.property.value;
2353
+ }
2354
+ }, this),
2355
+ 'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
2356
+ this.swapping = e.type == 'translated';
2357
+ }, this),
2358
+ 'translate.owl.carousel': $.proxy(function(e) {
2359
+ if (this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
2360
+ this.swap();
2361
+ }
2362
+ }, this)
2363
+ };
2364
+
2365
+ this.core.$element.on(this.handlers);
2366
+ };
2367
+
2368
+ /**
2369
+ * Default options.
2370
+ * @public
2371
+ */
2372
+ Animate.Defaults = {
2373
+ animateOut: false,
2374
+ animateIn: false
2375
+ };
2376
+
2377
+ /**
2378
+ * Toggles the animation classes whenever an translations starts.
2379
+ * @protected
2380
+ * @returns {Boolean|undefined}
2381
+ */
2382
+ Animate.prototype.swap = function() {
2383
+
2384
+ if (this.core.settings.items !== 1 || !this.core.support3d) {
2385
+ return;
2386
+ }
2387
+
2388
+ this.core.speed(0);
2389
+
2390
+ var left,
2391
+ clear = $.proxy(this.clear, this),
2392
+ previous = this.core.$stage.children().eq(this.previous),
2393
+ next = this.core.$stage.children().eq(this.next),
2394
+ incoming = this.core.settings.animateIn,
2395
+ outgoing = this.core.settings.animateOut;
2396
+
2397
+ if (this.core.current() === this.previous) {
2398
+ return;
2399
+ }
2400
+
2401
+ if (outgoing) {
2402
+ left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
2403
+ previous.css( { 'left': left + 'px' } )
2404
+ .addClass('animated owl-animated-out')
2405
+ .addClass(outgoing)
2406
+ .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', clear);
2407
+ }
2408
+
2409
+ if (incoming) {
2410
+ next.addClass('animated owl-animated-in')
2411
+ .addClass(incoming)
2412
+ .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', clear);
2413
+ }
2414
+ };
2415
+
2416
+ Animate.prototype.clear = function(e) {
2417
+ $(e.target).css( { 'left': '' } )
2418
+ .removeClass('animated owl-animated-out owl-animated-in')
2419
+ .removeClass(this.core.settings.animateIn)
2420
+ .removeClass(this.core.settings.animateOut);
2421
+ this.core.transitionEnd();
2422
+ }
2423
+
2424
+ /**
2425
+ * Destroys the plugin.
2426
+ * @public
2427
+ */
2428
+ Animate.prototype.destroy = function() {
2429
+ var handler, property;
2430
+
2431
+ for (handler in this.handlers) {
2432
+ this.core.$element.off(handler, this.handlers[handler]);
2433
+ }
2434
+ for (property in Object.getOwnPropertyNames(this)) {
2435
+ typeof this[property] != 'function' && (this[property] = null);
2436
+ }
2437
+ };
2438
+
2439
+ $.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
2440
+
2441
+ })(window.Zepto || window.jQuery, window, document);
2442
+
2443
+ /**
2444
+ * Autoplay Plugin
2445
+ * @version 2.0.0
2446
+ * @author Bartosz Wojciechowski
2447
+ * @license The MIT License (MIT)
2448
+ */
2449
+ ;(function($, window, document, undefined) {
2450
+
2451
+ /**
2452
+ * Creates the autoplay plugin.
2453
+ * @class The Autoplay Plugin
2454
+ * @param {Owl} scope - The Owl Carousel
2455
+ */
2456
+ var Autoplay = function(scope) {
2457
+ this.core = scope;
2458
+ this.core.options = $.extend({}, Autoplay.Defaults, this.core.options);
2459
+
2460
+ this.handlers = {
2461
+ 'translated.owl.carousel refreshed.owl.carousel': $.proxy(function() {
2462
+ this.autoplay();
2463
+ }, this),
2464
+ 'play.owl.autoplay': $.proxy(function(e, t, s) {
2465
+ this.play(t, s);
2466
+ }, this),
2467
+ 'stop.owl.autoplay': $.proxy(function() {
2468
+ this.stop();
2469
+ }, this),
2470
+ 'mouseover.owl.autoplay': $.proxy(function() {
2471
+ if (this.core.settings.autoplayHoverPause) {
2472
+ this.pause();
2473
+ }
2474
+ }, this),
2475
+ 'mouseleave.owl.autoplay': $.proxy(function() {
2476
+ if (this.core.settings.autoplayHoverPause) {
2477
+ this.autoplay();
2478
+ }
2479
+ }, this)
2480
+ };
2481
+
2482
+ this.core.$element.on(this.handlers);
2483
+ };
2484
+
2485
+ /**
2486
+ * Default options.
2487
+ * @public
2488
+ */
2489
+ Autoplay.Defaults = {
2490
+ autoplay: false,
2491
+ autoplayTimeout: 5000,
2492
+ autoplayHoverPause: false,
2493
+ autoplaySpeed: false
2494
+ };
2495
+
2496
+ /**
2497
+ * @protected
2498
+ * @todo Must be documented.
2499
+ */
2500
+ Autoplay.prototype.autoplay = function() {
2501
+ if (this.core.settings.autoplay && !this.core.state.videoPlay) {
2502
+ window.clearInterval(this.interval);
2503
+
2504
+ this.interval = window.setInterval($.proxy(function() {
2505
+ this.play();
2506
+ }, this), this.core.settings.autoplayTimeout);
2507
+ } else {
2508
+ window.clearInterval(this.interval);
2509
+ }
2510
+ };
2511
+
2512
+ /**
2513
+ * Starts the autoplay.
2514
+ * @public
2515
+ * @param {Number} [timeout] - ...
2516
+ * @param {Number} [speed] - ...
2517
+ * @returns {Boolean|undefined} - ...
2518
+ * @todo Must be documented.
2519
+ */
2520
+ Autoplay.prototype.play = function(timeout, speed) {
2521
+ // if tab is inactive - doesnt work in <IE10
2522
+ if (document.hidden === true) {
2523
+ return;
2524
+ }
2525
+
2526
+ if (this.core.state.isTouch || this.core.state.isScrolling
2527
+ || this.core.state.isSwiping || this.core.state.inMotion) {
2528
+ return;
2529
+ }
2530
+
2531
+ if (this.core.settings.autoplay === false) {
2532
+ window.clearInterval(this.interval);
2533
+ return;
2534
+ }
2535
+
2536
+ this.core.next(this.core.settings.autoplaySpeed);
2537
+ };
2538
+
2539
+ /**
2540
+ * Stops the autoplay.
2541
+ * @public
2542
+ */
2543
+ Autoplay.prototype.stop = function() {
2544
+ window.clearInterval(this.interval);
2545
+ };
2546
+
2547
+ /**
2548
+ * Pauses the autoplay.
2549
+ * @public
2550
+ */
2551
+ Autoplay.prototype.pause = function() {
2552
+ window.clearInterval(this.interval);
2553
+ };
2554
+
2555
+ /**
2556
+ * Destroys the plugin.
2557
+ */
2558
+ Autoplay.prototype.destroy = function() {
2559
+ var handler, property;
2560
+
2561
+ window.clearInterval(this.interval);
2562
+
2563
+ for (handler in this.handlers) {
2564
+ this.core.$element.off(handler, this.handlers[handler]);
2565
+ }
2566
+ for (property in Object.getOwnPropertyNames(this)) {
2567
+ typeof this[property] != 'function' && (this[property] = null);
2568
+ }
2569
+ };
2570
+
2571
+ $.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay;
2572
+
2573
+ })(window.Zepto || window.jQuery, window, document);
2574
+
2575
+ /**
2576
+ * Navigation Plugin
2577
+ * @version 2.0.0
2578
+ * @author Artus Kolanowski
2579
+ * @license The MIT License (MIT)
2580
+ */
2581
+ ;(function($, window, document, undefined) {
2582
+ 'use strict';
2583
+
2584
+ /**
2585
+ * Creates the navigation plugin.
2586
+ * @class The Navigation Plugin
2587
+ * @param {Owl} carousel - The Owl Carousel.
2588
+ */
2589
+ var Navigation = function(carousel) {
2590
+ /**
2591
+ * Reference to the core.
2592
+ * @protected
2593
+ * @type {Owl}
2594
+ */
2595
+ this._core = carousel;
2596
+
2597
+ /**
2598
+ * Indicates whether the plugin is initialized or not.
2599
+ * @protected
2600
+ * @type {Boolean}
2601
+ */
2602
+ this._initialized = false;
2603
+
2604
+ /**
2605
+ * The current paging indexes.
2606
+ * @protected
2607
+ * @type {Array}
2608
+ */
2609
+ this._pages = [];
2610
+
2611
+ /**
2612
+ * All DOM elements of the user interface.
2613
+ * @protected
2614
+ * @type {Object}
2615
+ */
2616
+ this._controls = {};
2617
+
2618
+ /**
2619
+ * Markup for an indicator.
2620
+ * @protected
2621
+ * @type {Array.<String>}
2622
+ */
2623
+ this._templates = [];
2624
+
2625
+ /**
2626
+ * The carousel element.
2627
+ * @type {jQuery}
2628
+ */
2629
+ this.$element = this._core.$element;
2630
+
2631
+ /**
2632
+ * Overridden methods of the carousel.
2633
+ * @protected
2634
+ * @type {Object}
2635
+ */
2636
+ this._overrides = {
2637
+ next: this._core.next,
2638
+ prev: this._core.prev,
2639
+ to: this._core.to
2640
+ };
2641
+
2642
+ /**
2643
+ * All event handlers.
2644
+ * @protected
2645
+ * @type {Object}
2646
+ */
2647
+ this._handlers = {
2648
+ 'prepared.owl.carousel': $.proxy(function(e) {
2649
+ if (this._core.settings.dotsData) {
2650
+ this._templates.push($(e.content).find('[data-dot]').andSelf('[data-dot]').attr('data-dot'));
2651
+ }
2652
+ }, this),
2653
+ 'add.owl.carousel': $.proxy(function(e) {
2654
+ if (this._core.settings.dotsData) {
2655
+ this._templates.splice(e.position, 0, $(e.content).find('[data-dot]').andSelf('[data-dot]').attr('data-dot'));
2656
+ }
2657
+ }, this),
2658
+ 'remove.owl.carousel prepared.owl.carousel': $.proxy(function(e) {
2659
+ if (this._core.settings.dotsData) {
2660
+ this._templates.splice(e.position, 1);
2661
+ }
2662
+ }, this),
2663
+ 'change.owl.carousel': $.proxy(function(e) {
2664
+ if (e.property.name == 'position') {
2665
+ if (!this._core.state.revert && !this._core.settings.loop && this._core.settings.navRewind) {
2666
+ var current = this._core.current(),
2667
+ maximum = this._core.maximum(),
2668
+ minimum = this._core.minimum();
2669
+ e.data = e.property.value > maximum
2670
+ ? current >= maximum ? minimum : maximum
2671
+ : e.property.value < minimum ? maximum : e.property.value;
2672
+ }
2673
+ }
2674
+ }, this),
2675
+ 'changed.owl.carousel': $.proxy(function(e) {
2676
+ if (e.property.name == 'position') {
2677
+ this.draw();
2678
+ }
2679
+ }, this),
2680
+ 'refreshed.owl.carousel': $.proxy(function() {
2681
+ if (!this._initialized) {
2682
+ this.initialize();
2683
+ this._initialized = true;
2684
+ }
2685
+ this._core.trigger('refresh', null, 'navigation');
2686
+ this.update();
2687
+ this.draw();
2688
+ this._core.trigger('refreshed', null, 'navigation');
2689
+ }, this)
2690
+ };
2691
+
2692
+ // set default options
2693
+ this._core.options = $.extend({}, Navigation.Defaults, this._core.options);
2694
+
2695
+ // register event handlers
2696
+ this.$element.on(this._handlers);
2697
+ }
2698
+
2699
+ /**
2700
+ * Default options.
2701
+ * @public
2702
+ * @todo Rename `slideBy` to `navBy`
2703
+ */
2704
+ Navigation.Defaults = {
2705
+ nav: false,
2706
+ navRewind: true,
2707
+ navText: [ 'prev', 'next' ],
2708
+ navSpeed: false,
2709
+ navElement: 'div',
2710
+ navContainer: false,
2711
+ navContainerClass: 'owl-nav',
2712
+ navClass: [ 'owl-prev', 'owl-next' ],
2713
+ slideBy: 1,
2714
+ dotClass: 'owl-dot',
2715
+ dotsClass: 'owl-dots',
2716
+ dots: true,
2717
+ dotsEach: false,
2718
+ dotData: false,
2719
+ dotsSpeed: false,
2720
+ dotsContainer: false,
2721
+ controlsClass: 'owl-controls'
2722
+ }
2723
+
2724
+ /**
2725
+ * Initializes the layout of the plugin and extends the carousel.
2726
+ * @protected
2727
+ */
2728
+ Navigation.prototype.initialize = function() {
2729
+ var $container, override,
2730
+ options = this._core.settings;
2731
+
2732
+ // create the indicator template
2733
+ if (!options.dotsData) {
2734
+ this._templates = [ $('<div>')
2735
+ .addClass(options.dotClass)
2736
+ .append($('<span>'))
2737
+ .prop('outerHTML') ];
2738
+ }
2739
+
2740
+ // create controls container if needed
2741
+ if (!options.navContainer || !options.dotsContainer) {
2742
+ this._controls.$container = $('<div>')
2743
+ .addClass(options.controlsClass)
2744
+ .appendTo(this.$element);
2745
+ }
2746
+
2747
+ // create DOM structure for absolute navigation
2748
+ this._controls.$indicators = options.dotsContainer ? $(options.dotsContainer)
2749
+ : $('<div>').hide().addClass(options.dotsClass).appendTo(this._controls.$container);
2750
+
2751
+ this._controls.$indicators.on('click', 'div', $.proxy(function(e) {
2752
+ var index = $(e.target).parent().is(this._controls.$indicators)
2753
+ ? $(e.target).index() : $(e.target).parent().index();
2754
+
2755
+ e.preventDefault();
2756
+
2757
+ this.to(index, options.dotsSpeed);
2758
+ }, this));
2759
+
2760
+ // create DOM structure for relative navigation
2761
+ $container = options.navContainer ? $(options.navContainer)
2762
+ : $('<div>').addClass(options.navContainerClass).prependTo(this._controls.$container);
2763
+
2764
+ this._controls.$next = $('<' + options.navElement + '>');
2765
+ this._controls.$previous = this._controls.$next.clone();
2766
+
2767
+ this._controls.$previous
2768
+ .addClass(options.navClass[0])
2769
+ .html(options.navText[0])
2770
+ .hide()
2771
+ .prependTo($container)
2772
+ .on('click', $.proxy(function(e) {
2773
+ this.prev(options.navSpeed);
2774
+ }, this));
2775
+ this._controls.$next
2776
+ .addClass(options.navClass[1])
2777
+ .html(options.navText[1])
2778
+ .hide()
2779
+ .appendTo($container)
2780
+ .on('click', $.proxy(function(e) {
2781
+ this.next(options.navSpeed);
2782
+ }, this));
2783
+
2784
+ // override public methods of the carousel
2785
+ for (override in this._overrides) {
2786
+ this._core[override] = $.proxy(this[override], this);
2787
+ }
2788
+ }
2789
+
2790
+ /**
2791
+ * Destroys the plugin.
2792
+ * @protected
2793
+ */
2794
+ Navigation.prototype.destroy = function() {
2795
+ var handler, control, property, override;
2796
+
2797
+ for (handler in this._handlers) {
2798
+ this.$element.off(handler, this._handlers[handler]);
2799
+ }
2800
+ for (control in this._controls) {
2801
+ this._controls[control].remove();
2802
+ }
2803
+ for (override in this.overides) {
2804
+ this._core[override] = this._overrides[override];
2805
+ }
2806
+ for (property in Object.getOwnPropertyNames(this)) {
2807
+ typeof this[property] != 'function' && (this[property] = null);
2808
+ }
2809
+ }
2810
+
2811
+ /**
2812
+ * Updates the internal state.
2813
+ * @protected
2814
+ */
2815
+ Navigation.prototype.update = function() {
2816
+ var i, j, k,
2817
+ options = this._core.settings,
2818
+ lower = this._core.clones().length / 2,
2819
+ upper = lower + this._core.items().length,
2820
+ size = options.center || options.autoWidth || options.dotData
2821
+ ? 1 : options.dotsEach || options.items;
2822
+
2823
+ if (options.slideBy !== 'page') {
2824
+ options.slideBy = Math.min(options.slideBy, options.items);
2825
+ }
2826
+
2827
+ if (options.dots || options.slideBy == 'page') {
2828
+ this._pages = [];
2829
+
2830
+ for (i = lower, j = 0, k = 0; i < upper; i++) {
2831
+ if (j >= size || j === 0) {
2832
+ this._pages.push({
2833
+ start: i - lower,
2834
+ end: i - lower + size - 1
2835
+ });
2836
+ j = 0, ++k;
2837
+ }
2838
+ j += this._core.mergers(this._core.relative(i));
2839
+ }
2840
+ }
2841
+ }
2842
+
2843
+ /**
2844
+ * Draws the user interface.
2845
+ * @todo The option `dotData` wont work.
2846
+ * @protected
2847
+ */
2848
+ Navigation.prototype.draw = function() {
2849
+ var difference, i, html = '',
2850
+ options = this._core.settings,
2851
+ $items = this._core.$stage.children(),
2852
+ index = this._core.relative(this._core.current());
2853
+
2854
+ if (options.nav && !options.loop && !options.navRewind) {
2855
+ this._controls.$previous.toggleClass('disabled', index <= 0);
2856
+ this._controls.$next.toggleClass('disabled', index >= this._core.maximum());
2857
+ }
2858
+
2859
+ this._controls.$previous.toggle(options.nav);
2860
+ this._controls.$next.toggle(options.nav);
2861
+
2862
+ if (options.dots) {
2863
+ difference = this._pages.length - this._controls.$indicators.children().length;
2864
+
2865
+ if (options.dotData && difference !== 0) {
2866
+ for (i = 0; i < this._controls.$indicators.children().length; i++) {
2867
+ html += this._templates[this._core.relative(i)];
2868
+ }
2869
+ this._controls.$indicators.html(html);
2870
+ } else if (difference > 0) {
2871
+ html = new Array(difference + 1).join(this._templates[0]);
2872
+ this._controls.$indicators.append(html);
2873
+ } else if (difference < 0) {
2874
+ this._controls.$indicators.children().slice(difference).remove();
2875
+ }
2876
+
2877
+ this._controls.$indicators.find('.active').removeClass('active');
2878
+ this._controls.$indicators.children().eq($.inArray(this.current(), this._pages)).addClass('active');
2879
+ }
2880
+
2881
+ this._controls.$indicators.toggle(options.dots);
2882
+ }
2883
+
2884
+ /**
2885
+ * Extends event data.
2886
+ * @protected
2887
+ * @param {Event} event - The event object which gets thrown.
2888
+ */
2889
+ Navigation.prototype.onTrigger = function(event) {
2890
+ var settings = this._core.settings;
2891
+
2892
+ event.page = {
2893
+ index: $.inArray(this.current(), this._pages),
2894
+ count: this._pages.length,
2895
+ size: settings && (settings.center || settings.autoWidth || settings.dotData
2896
+ ? 1 : settings.dotsEach || settings.items)
2897
+ };
2898
+ }
2899
+
2900
+ /**
2901
+ * Gets the current page position of the carousel.
2902
+ * @protected
2903
+ * @returns {Number}
2904
+ */
2905
+ Navigation.prototype.current = function() {
2906
+ var index = this._core.relative(this._core.current());
2907
+ return $.grep(this._pages, function(o) {
2908
+ return o.start <= index && o.end >= index;
2909
+ }).pop();
2910
+ }
2911
+
2912
+ /**
2913
+ * Gets the current succesor/predecessor position.
2914
+ * @protected
2915
+ * @returns {Number}
2916
+ */
2917
+ Navigation.prototype.getPosition = function(successor) {
2918
+ var position, length,
2919
+ options = this._core.settings;
2920
+
2921
+ if (options.slideBy == 'page') {
2922
+ position = $.inArray(this.current(), this._pages);
2923
+ length = this._pages.length;
2924
+ successor ? ++position : --position;
2925
+ position = this._pages[((position % length) + length) % length].start;
2926
+ } else {
2927
+ position = this._core.relative(this._core.current());
2928
+ length = this._core.items().length;
2929
+ successor ? position += options.slideBy : position -= options.slideBy;
2930
+ }
2931
+ return position;
2932
+ }
2933
+
2934
+ /**
2935
+ * Slides to the next item or page.
2936
+ * @public
2937
+ * @param {Number} [speed=false] - The time in milliseconds for the transition.
2938
+ */
2939
+ Navigation.prototype.next = function(speed) {
2940
+ $.proxy(this._overrides.to, this._core)(this.getPosition(true), speed);
2941
+ }
2942
+
2943
+ /**
2944
+ * Slides to the previous item or page.
2945
+ * @public
2946
+ * @param {Number} [speed=false] - The time in milliseconds for the transition.
2947
+ */
2948
+ Navigation.prototype.prev = function(speed) {
2949
+ $.proxy(this._overrides.to, this._core)(this.getPosition(false), speed);
2950
+ }
2951
+
2952
+ /**
2953
+ * Slides to the specified item or page.
2954
+ * @public
2955
+ * @param {Number} position - The position of the item or page.
2956
+ * @param {Number} [speed] - The time in milliseconds for the transition.
2957
+ * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not.
2958
+ */
2959
+ Navigation.prototype.to = function(position, speed, standard) {
2960
+ var length;
2961
+
2962
+ if (!standard) {
2963
+ length = this._pages.length;
2964
+ $.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed);
2965
+ } else {
2966
+ $.proxy(this._overrides.to, this._core)(position, speed);
2967
+ }
2968
+ }
2969
+
2970
+ $.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation;
2971
+
2972
+ })(window.Zepto || window.jQuery, window, document);
2973
+
2974
+ /**
2975
+ * Hash Plugin
2976
+ * @version 2.0.0
2977
+ * @author Artus Kolanowski
2978
+ * @license The MIT License (MIT)
2979
+ */
2980
+ ;(function($, window, document, undefined) {
2981
+ 'use strict';
2982
+
2983
+ /**
2984
+ * Creates the hash plugin.
2985
+ * @class The Hash Plugin
2986
+ * @param {Owl} carousel - The Owl Carousel
2987
+ */
2988
+ var Hash = function(carousel) {
2989
+ /**
2990
+ * Reference to the core.
2991
+ * @protected
2992
+ * @type {Owl}
2993
+ */
2994
+ this._core = carousel;
2995
+
2996
+ /**
2997
+ * Hash table for the hashes.
2998
+ * @protected
2999
+ * @type {Object}
3000
+ */
3001
+ this._hashes = {};
3002
+
3003
+ /**
3004
+ * The carousel element.
3005
+ * @type {jQuery}
3006
+ */
3007
+ this.$element = this._core.$element;
3008
+
3009
+ /**
3010
+ * All event handlers.
3011
+ * @protected
3012
+ * @type {Object}
3013
+ */
3014
+ this._handlers = {
3015
+ 'initialized.owl.carousel': $.proxy(function() {
3016
+ if (this._core.settings.startPosition == 'URLHash') {
3017
+ $(window).trigger('hashchange.owl.navigation');
3018
+ }
3019
+ }, this),
3020
+ 'prepared.owl.carousel': $.proxy(function(e) {
3021
+ var hash = $(e.content).find('[data-hash]').andSelf('[data-hash]').attr('data-hash');
3022
+ this._hashes[hash] = e.content;
3023
+ }, this)
3024
+ };
3025
+
3026
+ // set default options
3027
+ this._core.options = $.extend({}, Hash.Defaults, this._core.options);
3028
+
3029
+ // register the event handlers
3030
+ this.$element.on(this._handlers);
3031
+
3032
+ // register event listener for hash navigation
3033
+ $(window).on('hashchange.owl.navigation', $.proxy(function() {
3034
+ var hash = window.location.hash.substring(1),
3035
+ items = this._core.$stage.children(),
3036
+ position = this._hashes[hash] && items.index(this._hashes[hash]) || 0;
3037
+
3038
+ if (!hash) {
3039
+ return false;
3040
+ }
3041
+
3042
+ this._core.to(position, false, true);
3043
+ }, this));
3044
+ }
3045
+
3046
+ /**
3047
+ * Default options.
3048
+ * @public
3049
+ */
3050
+ Hash.Defaults = {
3051
+ URLhashListener: false
3052
+ }
3053
+
3054
+ /**
3055
+ * Destroys the plugin.
3056
+ * @public
3057
+ */
3058
+ Hash.prototype.destroy = function() {
3059
+ var handler, property;
3060
+
3061
+ $(window).off('hashchange.owl.navigation');
3062
+
3063
+ for (handler in this._handlers) {
3064
+ this._core.$element.off(handler, this._handlers[handler]);
3065
+ }
3066
+ for (property in Object.getOwnPropertyNames(this)) {
3067
+ typeof this[property] != 'function' && (this[property] = null);
3068
+ }
3069
+ }
3070
+
3071
+ $.fn.owlCarousel.Constructor.Plugins.Hash = Hash;
3072
+
3073
+ })(window.Zepto || window.jQuery, window, document);
3074
+ });