448. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2021-05-13 09:09:30 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

448.1 Files compared

#LocationFileLast Modified
1/Applications/Ampps/www/Porto 3.2.2/Theme Files/Magento 2.x/Porto Theme/app/design/frontend/Smartwave/porto_rtl/web/owl.carouselowl.carousel.js2016-05-15 16:51:50 +0000
2/Applications/Ampps/www/Porto v4.0.0/Theme Files/Magento 2.x/Porto Theme/app/design/frontend/Smartwave/porto_rtl/web/owl.carouselowl.carousel.js2021-01-13 09:39:44 +0000

448.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged3834134
Changed2701624
Inserted87540
Removed26219

448.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

448.4 Active regular expressions

No regular expressions were active.

448.5 Comparison detail

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