PageSourceSearch

https://betterbirthblog.org/wp-content/plugins/js_composer/assets/…/owl.carousel.js?ver=4.7.4

js betterbirthblog.org collected 2026-09-25 00:32:53 UTC 81,021 bytes, 3,136 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.