owlcarousel2 2.2.0.pre.4.pre.g22132e0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.gitmodules +3 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +53 -0
  7. data/Rakefile +13 -0
  8. data/lib/owlcarousel2.rb +9 -0
  9. data/lib/owlcarousel2/engine.rb +5 -0
  10. data/lib/owlcarousel2/version.rb +3 -0
  11. data/owlcarousel2.gemspec +25 -0
  12. data/vendor/assets/images/owlcarousel2/ajax-loader.gif +0 -0
  13. data/vendor/assets/images/owlcarousel2/owl.video.play.png +0 -0
  14. data/vendor/assets/javascripts/owlcarousel2/owl.animate.js +121 -0
  15. data/vendor/assets/javascripts/owlcarousel2/owl.autoheight.js +97 -0
  16. data/vendor/assets/javascripts/owlcarousel2/owl.autoplay.js +199 -0
  17. data/vendor/assets/javascripts/owlcarousel2/owl.autorefresh.js +111 -0
  18. data/vendor/assets/javascripts/owlcarousel2/owl.carousel.js +1692 -0
  19. data/vendor/assets/javascripts/owlcarousel2/owl.hash.js +122 -0
  20. data/vendor/assets/javascripts/owlcarousel2/owl.lazyload.js +135 -0
  21. data/vendor/assets/javascripts/owlcarousel2/owl.navigation.js +382 -0
  22. data/vendor/assets/javascripts/owlcarousel2/owl.support.js +83 -0
  23. data/vendor/assets/javascripts/owlcarousel2/owl.support.modernizr.js +66 -0
  24. data/vendor/assets/javascripts/owlcarousel2/owl.video.js +319 -0
  25. data/vendor/assets/stylesheets/owlcarousel2/_animate.scss +28 -0
  26. data/vendor/assets/stylesheets/owlcarousel2/_autoheight.scss +7 -0
  27. data/vendor/assets/stylesheets/owlcarousel2/_core.scss +114 -0
  28. data/vendor/assets/stylesheets/owlcarousel2/_lazyload.scss +17 -0
  29. data/vendor/assets/stylesheets/owlcarousel2/_theme.default.scss +30 -0
  30. data/vendor/assets/stylesheets/owlcarousel2/_theme.green.scss +30 -0
  31. data/vendor/assets/stylesheets/owlcarousel2/_theme.scss +64 -0
  32. data/vendor/assets/stylesheets/owlcarousel2/_video.scss +51 -0
  33. data/vendor/assets/stylesheets/owlcarousel2/owl.carousel.scss +5 -0
  34. data/vendor/assets/stylesheets/owlcarousel2/owl.theme.default.scss +1 -0
  35. data/vendor/assets/stylesheets/owlcarousel2/owl.theme.green.scss +1 -0
  36. metadata +93 -0
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Support Plugin
3
+ *
4
+ * @version 2.1.0
5
+ * @author Vivid Planet Software GmbH
6
+ * @author Artus Kolanowski
7
+ * @author David Deutsch
8
+ * @license The MIT License (MIT)
9
+ */
10
+ ;(function($, window, document, undefined) {
11
+
12
+ var style = $('<support>').get(0).style,
13
+ prefixes = 'Webkit Moz O ms'.split(' '),
14
+ events = {
15
+ transition: {
16
+ end: {
17
+ WebkitTransition: 'webkitTransitionEnd',
18
+ MozTransition: 'transitionend',
19
+ OTransition: 'oTransitionEnd',
20
+ transition: 'transitionend'
21
+ }
22
+ },
23
+ animation: {
24
+ end: {
25
+ WebkitAnimation: 'webkitAnimationEnd',
26
+ MozAnimation: 'animationend',
27
+ OAnimation: 'oAnimationEnd',
28
+ animation: 'animationend'
29
+ }
30
+ }
31
+ },
32
+ tests = {
33
+ csstransforms: function() {
34
+ return !!test('transform');
35
+ },
36
+ csstransforms3d: function() {
37
+ return !!test('perspective');
38
+ },
39
+ csstransitions: function() {
40
+ return !!test('transition');
41
+ },
42
+ cssanimations: function() {
43
+ return !!test('animation');
44
+ }
45
+ };
46
+
47
+ function test(property, prefixed) {
48
+ var result = false,
49
+ upper = property.charAt(0).toUpperCase() + property.slice(1);
50
+
51
+ $.each((property + ' ' + prefixes.join(upper + ' ') + upper).split(' '), function(i, property) {
52
+ if (style[property] !== undefined) {
53
+ result = prefixed ? property : true;
54
+ return false;
55
+ }
56
+ });
57
+
58
+ return result;
59
+ }
60
+
61
+ function prefixed(property) {
62
+ return test(property, true);
63
+ }
64
+
65
+ if (tests.csstransitions()) {
66
+ /* jshint -W053 */
67
+ $.support.transition = new String(prefixed('transition'))
68
+ $.support.transition.end = events.transition.end[ $.support.transition ];
69
+ }
70
+
71
+ if (tests.cssanimations()) {
72
+ /* jshint -W053 */
73
+ $.support.animation = new String(prefixed('animation'))
74
+ $.support.animation.end = events.animation.end[ $.support.animation ];
75
+ }
76
+
77
+ if (tests.csstransforms()) {
78
+ /* jshint -W053 */
79
+ $.support.transform = new String(prefixed('transform'));
80
+ $.support.transform3d = tests.csstransforms3d();
81
+ }
82
+
83
+ })(window.Zepto || window.jQuery, window, document);
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Modernizr Support Plugin
3
+ *
4
+ * @version 2.1.0
5
+ * @author Vivid Planet Software GmbH
6
+ * @author Artus Kolanowski
7
+ * @author David Deutsch
8
+ * @license The MIT License (MIT)
9
+ */
10
+ ;(function($, Modernizr, window, document, undefined) {
11
+
12
+ var events = {
13
+ transition: {
14
+ end: {
15
+ WebkitTransition: 'webkitTransitionEnd',
16
+ MozTransition: 'transitionend',
17
+ OTransition: 'oTransitionEnd',
18
+ transition: 'transitionend'
19
+ }
20
+ },
21
+ animation: {
22
+ end: {
23
+ WebkitAnimation: 'webkitAnimationEnd',
24
+ MozAnimation: 'animationend',
25
+ OAnimation: 'oAnimationEnd',
26
+ animation: 'animationend'
27
+ }
28
+ }
29
+ };
30
+
31
+ if (!Modernizr) {
32
+ throw new Error('Modernizr is not loaded.');
33
+ }
34
+
35
+ $.each([ 'cssanimations', 'csstransitions', 'csstransforms', 'csstransforms3d', 'prefixed' ], function(i, property) {
36
+ if (typeof Modernizr[property] == 'undefined') {
37
+ throw new Error([ 'Modernizr "', property, '" is not loaded.' ].join(''));
38
+ }
39
+ });
40
+
41
+ if (Modernizr.csstransitions) {
42
+ /* jshint -W053 */
43
+ $.support.transition = new String(Modernizr.prefixed('transition'))
44
+ $.support.transition.end = events.transition.end[ $.support.transition ];
45
+ // fix transitionend support detection, which does not work properly for older Android versions,
46
+ // as it does not give the prefixed event name. here we use Modernizr to ensure the correct event.
47
+ // see:
48
+ // https://github.com/Modernizr/Modernizr/issues/897
49
+ // https://github.com/niksy/modernizr-detects/commit/05d148fc4f3813b1412c836325a9ca78c7a63f4d
50
+ if (/Android 4\.[123]/.test(navigator.userAgent)) {
51
+ $.support.transition.end = 'webkitTransitionEnd';
52
+ }
53
+ }
54
+
55
+ if (Modernizr.cssanimations) {
56
+ /* jshint -W053 */
57
+ $.support.animation = new String(Modernizr.prefixed('animation'))
58
+ $.support.animation.end = events.animation.end[ $.support.animation ];
59
+ }
60
+
61
+ if (Modernizr.csstransforms) {
62
+ /* jshint -W053 */
63
+ $.support.transform = new String(Modernizr.prefixed('transform'));
64
+ $.support.transform3d = Modernizr.csstransforms3d;
65
+ }
66
+ })(window.Zepto || window.jQuery, window.Modernizr, window, document);
@@ -0,0 +1,319 @@
1
+ /**
2
+ * Video Plugin
3
+ * @version 2.1.0
4
+ * @author Bartosz Wojciechowski
5
+ * @author David Deutsch
6
+ * @license The MIT License (MIT)
7
+ */
8
+ ;(function($, window, document, undefined) {
9
+
10
+ /**
11
+ * Creates the video plugin.
12
+ * @class The Video Plugin
13
+ * @param {Owl} carousel - The Owl Carousel
14
+ */
15
+ var Video = function(carousel) {
16
+ /**
17
+ * Reference to the core.
18
+ * @protected
19
+ * @type {Owl}
20
+ */
21
+ this._core = carousel;
22
+
23
+ /**
24
+ * Cache all video URLs.
25
+ * @protected
26
+ * @type {Object}
27
+ */
28
+ this._videos = {};
29
+
30
+ /**
31
+ * Current playing item.
32
+ * @protected
33
+ * @type {jQuery}
34
+ */
35
+ this._playing = null;
36
+
37
+ /**
38
+ * All event handlers.
39
+ * @todo The cloned content removale is too late
40
+ * @protected
41
+ * @type {Object}
42
+ */
43
+ this._handlers = {
44
+ 'initialized.owl.carousel': $.proxy(function(e) {
45
+ if (e.namespace) {
46
+ this._core.register({ type: 'state', name: 'playing', tags: [ 'interacting' ] });
47
+ }
48
+ }, this),
49
+ 'resize.owl.carousel': $.proxy(function(e) {
50
+ if (e.namespace && this._core.settings.video && this.isInFullScreen()) {
51
+ e.preventDefault();
52
+ }
53
+ }, this),
54
+ 'refreshed.owl.carousel': $.proxy(function(e) {
55
+ if (e.namespace && this._core.is('resizing')) {
56
+ this._core.$stage.find('.cloned .owl-video-frame').remove();
57
+ }
58
+ }, this),
59
+ 'changed.owl.carousel': $.proxy(function(e) {
60
+ if (e.namespace && e.property.name === 'position' && this._playing) {
61
+ this.stop();
62
+ }
63
+ }, this),
64
+ 'prepared.owl.carousel': $.proxy(function(e) {
65
+ if (!e.namespace) {
66
+ return;
67
+ }
68
+
69
+ var $element = $(e.content).find('.owl-video');
70
+
71
+ if ($element.length) {
72
+ $element.css('display', 'none');
73
+ this.fetch($element, $(e.content));
74
+ }
75
+ }, this)
76
+ };
77
+
78
+ // set default options
79
+ this._core.options = $.extend({}, Video.Defaults, this._core.options);
80
+
81
+ // register event handlers
82
+ this._core.$element.on(this._handlers);
83
+
84
+ this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
85
+ this.play(e);
86
+ }, this));
87
+ };
88
+
89
+ /**
90
+ * Default options.
91
+ * @public
92
+ */
93
+ Video.Defaults = {
94
+ video: false,
95
+ videoHeight: false,
96
+ videoWidth: false
97
+ };
98
+
99
+ /**
100
+ * Gets the video ID and the type (YouTube/Vimeo/vzaar only).
101
+ * @protected
102
+ * @param {jQuery} target - The target containing the video data.
103
+ * @param {jQuery} item - The item containing the video.
104
+ */
105
+ Video.prototype.fetch = function(target, item) {
106
+ var type = (function() {
107
+ if (target.attr('data-vimeo-id')) {
108
+ return 'vimeo';
109
+ } else if (target.attr('data-vzaar-id')) {
110
+ return 'vzaar'
111
+ } else {
112
+ return 'youtube';
113
+ }
114
+ })(),
115
+ id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'),
116
+ width = target.attr('data-width') || this._core.settings.videoWidth,
117
+ height = target.attr('data-height') || this._core.settings.videoHeight,
118
+ url = target.attr('href');
119
+
120
+ if (url) {
121
+
122
+ /*
123
+ Parses the id's out of the following urls (and probably more):
124
+ https://www.youtube.com/watch?v=:id
125
+ https://youtu.be/:id
126
+ https://vimeo.com/:id
127
+ https://vimeo.com/channels/:channel/:id
128
+ https://vimeo.com/groups/:group/videos/:id
129
+ https://app.vzaar.com/videos/:id
130
+
131
+ 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
132
+ */
133
+
134
+ 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+)?/);
135
+
136
+ if (id[3].indexOf('youtu') > -1) {
137
+ type = 'youtube';
138
+ } else if (id[3].indexOf('vimeo') > -1) {
139
+ type = 'vimeo';
140
+ } else if (id[3].indexOf('vzaar') > -1) {
141
+ type = 'vzaar';
142
+ } else {
143
+ throw new Error('Video URL not supported.');
144
+ }
145
+ id = id[6];
146
+ } else {
147
+ throw new Error('Missing video URL.');
148
+ }
149
+
150
+ this._videos[url] = {
151
+ type: type,
152
+ id: id,
153
+ width: width,
154
+ height: height
155
+ };
156
+
157
+ item.attr('data-video', url);
158
+
159
+ this.thumbnail(target, this._videos[url]);
160
+ };
161
+
162
+ /**
163
+ * Creates video thumbnail.
164
+ * @protected
165
+ * @param {jQuery} target - The target containing the video data.
166
+ * @param {Object} info - The video info object.
167
+ * @see `fetch`
168
+ */
169
+ Video.prototype.thumbnail = function(target, video) {
170
+ var tnLink,
171
+ icon,
172
+ path,
173
+ dimensions = video.width && video.height ? 'style="width:' + video.width + 'px;height:' + video.height + 'px;"' : '',
174
+ customTn = target.find('img'),
175
+ srcType = 'src',
176
+ lazyClass = '',
177
+ settings = this._core.settings,
178
+ create = function(path) {
179
+ icon = '<div class="owl-video-play-icon"></div>';
180
+
181
+ if (settings.lazyLoad) {
182
+ tnLink = '<div class="owl-video-tn ' + lazyClass + '" ' + srcType + '="' + path + '"></div>';
183
+ } else {
184
+ tnLink = '<div class="owl-video-tn" style="opacity:1;background-image:url(' + path + ')"></div>';
185
+ }
186
+ target.after(tnLink);
187
+ target.after(icon);
188
+ };
189
+
190
+ // wrap video content into owl-video-wrapper div
191
+ target.wrap('<div class="owl-video-wrapper"' + dimensions + '></div>');
192
+
193
+ if (this._core.settings.lazyLoad) {
194
+ srcType = 'data-src';
195
+ lazyClass = 'owl-lazy';
196
+ }
197
+
198
+ // custom thumbnail
199
+ if (customTn.length) {
200
+ create(customTn.attr(srcType));
201
+ customTn.remove();
202
+ return false;
203
+ }
204
+
205
+ if (video.type === 'youtube') {
206
+ path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
207
+ create(path);
208
+ } else if (video.type === 'vimeo') {
209
+ $.ajax({
210
+ type: 'GET',
211
+ url: '//vimeo.com/api/v2/video/' + video.id + '.json',
212
+ jsonp: 'callback',
213
+ dataType: 'jsonp',
214
+ success: function(data) {
215
+ path = data[0].thumbnail_large;
216
+ create(path);
217
+ }
218
+ });
219
+ } else if (video.type === 'vzaar') {
220
+ $.ajax({
221
+ type: 'GET',
222
+ url: '//vzaar.com/api/videos/' + video.id + '.json',
223
+ jsonp: 'callback',
224
+ dataType: 'jsonp',
225
+ success: function(data) {
226
+ path = data.framegrab_url;
227
+ create(path);
228
+ }
229
+ });
230
+ }
231
+ };
232
+
233
+ /**
234
+ * Stops the current video.
235
+ * @public
236
+ */
237
+ Video.prototype.stop = function() {
238
+ this._core.trigger('stop', null, 'video');
239
+ this._playing.find('.owl-video-frame').remove();
240
+ this._playing.removeClass('owl-video-playing');
241
+ this._playing = null;
242
+ this._core.leave('playing');
243
+ this._core.trigger('stopped', null, 'video');
244
+ };
245
+
246
+ /**
247
+ * Starts the current video.
248
+ * @public
249
+ * @param {Event} event - The event arguments.
250
+ */
251
+ Video.prototype.play = function(event) {
252
+ var target = $(event.target),
253
+ item = target.closest('.' + this._core.settings.itemClass),
254
+ video = this._videos[item.attr('data-video')],
255
+ width = video.width || '100%',
256
+ height = video.height || this._core.$stage.height(),
257
+ html;
258
+
259
+ if (this._playing) {
260
+ return;
261
+ }
262
+
263
+ this._core.enter('playing');
264
+ this._core.trigger('play', null, 'video');
265
+
266
+ item = this._core.items(this._core.relative(item.index()));
267
+
268
+ this._core.reset(item.index());
269
+
270
+ if (video.type === 'youtube') {
271
+ html = '<iframe width="' + width + '" height="' + height + '" src="//www.youtube.com/embed/' +
272
+ video.id + '?autoplay=1&v=' + video.id + '" frameborder="0" allowfullscreen></iframe>';
273
+ } else if (video.type === 'vimeo') {
274
+ html = '<iframe src="//player.vimeo.com/video/' + video.id +
275
+ '?autoplay=1" width="' + width + '" height="' + height +
276
+ '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
277
+ } else if (video.type === 'vzaar') {
278
+ html = '<iframe frameborder="0"' + 'height="' + height + '"' + 'width="' + width +
279
+ '" allowfullscreen mozallowfullscreen webkitAllowFullScreen ' +
280
+ 'src="//view.vzaar.com/' + video.id + '/player?autoplay=true"></iframe>';
281
+ }
282
+
283
+ $('<div class="owl-video-frame">' + html + '</div>').insertAfter(item.find('.owl-video'));
284
+
285
+ this._playing = item.addClass('owl-video-playing');
286
+ };
287
+
288
+ /**
289
+ * Checks whether an video is currently in full screen mode or not.
290
+ * @todo Bad style because looks like a readonly method but changes members.
291
+ * @protected
292
+ * @returns {Boolean}
293
+ */
294
+ Video.prototype.isInFullScreen = function() {
295
+ var element = document.fullscreenElement || document.mozFullScreenElement ||
296
+ document.webkitFullscreenElement;
297
+
298
+ return element && $(element).parent().hasClass('owl-video-frame');
299
+ };
300
+
301
+ /**
302
+ * Destroys the plugin.
303
+ */
304
+ Video.prototype.destroy = function() {
305
+ var handler, property;
306
+
307
+ this._core.$element.off('click.owl.video');
308
+
309
+ for (handler in this._handlers) {
310
+ this._core.$element.off(handler, this._handlers[handler]);
311
+ }
312
+ for (property in Object.getOwnPropertyNames(this)) {
313
+ typeof this[property] != 'function' && (this[property] = null);
314
+ }
315
+ };
316
+
317
+ $.fn.owlCarousel.Constructor.Plugins.Video = Video;
318
+
319
+ })(window.Zepto || window.jQuery, window, document);