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