jumbo-jekyll-theme 3.0.42 → 3.0.43

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