PageSourceSearch

https://cancer.org.my/wp-content/themes/Total/assets/js/core/wpex.owl.carousel.js?ver=4.6.1

js cancer.org.my collected 2026-10-02 10:26:28 UTC 81,850 bytes, 3,153 lines download raw bytes

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