linaro-jekyll-theme 1.0 → 4.0.2
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 +83 -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 +242 -327
- data/_sass/core/bootstrap-multiselect.scss +1 -0
- data/_sass/core/breadcrumb.scss +16 -88
- data/_sass/core/carousel-header.scss +91 -0
- data/_sass/core/carousel-styles.scss +1 -0
- data/_sass/core/carousel.scss +188 -28
- 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 -132
- 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 -440
- 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/core/forms.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 -233
- 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 -35
- data/_includes/_theme-includes/_navigation/nav.html +0 -128
- 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/_layouts/redirect.html +0 -11
- 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 -45
- data/_sass/core/lightbox.scss +0 -213
- data/_sass/core/nav.scss +0 -723
- data/_sass/core/old-search.scss +0 -239
- 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/_sass/core/youtube.scss +0 -65
- data/_sass/custom.scss +0 -0
- 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/loadCSS.js +0 -79
- data/assets/js/vendor/mc-validate.js +0 -14
- data/assets/js/vendor/owl.carousel.min.js +0 -27
@@ -0,0 +1,698 @@
|
|
1
|
+
(function(window, factory) {
|
2
|
+
var lazySizes = factory(window, window.document);
|
3
|
+
window.lazySizes = lazySizes;
|
4
|
+
if(typeof module == 'object' && module.exports){
|
5
|
+
module.exports = lazySizes;
|
6
|
+
}
|
7
|
+
}(window, function l(window, document) {
|
8
|
+
'use strict';
|
9
|
+
/*jshint eqnull:true */
|
10
|
+
if(!document.getElementsByClassName){return;}
|
11
|
+
|
12
|
+
var lazysizes, lazySizesConfig;
|
13
|
+
|
14
|
+
var docElem = document.documentElement;
|
15
|
+
|
16
|
+
var Date = window.Date;
|
17
|
+
|
18
|
+
var supportPicture = window.HTMLPictureElement;
|
19
|
+
|
20
|
+
var _addEventListener = 'addEventListener';
|
21
|
+
|
22
|
+
var _getAttribute = 'getAttribute';
|
23
|
+
|
24
|
+
var addEventListener = window[_addEventListener];
|
25
|
+
|
26
|
+
var setTimeout = window.setTimeout;
|
27
|
+
|
28
|
+
var requestAnimationFrame = window.requestAnimationFrame || setTimeout;
|
29
|
+
|
30
|
+
var requestIdleCallback = window.requestIdleCallback;
|
31
|
+
|
32
|
+
var regPicture = /^picture$/i;
|
33
|
+
|
34
|
+
var loadEvents = ['load', 'error', 'lazyincluded', '_lazyloaded'];
|
35
|
+
|
36
|
+
var regClassCache = {};
|
37
|
+
|
38
|
+
var forEach = Array.prototype.forEach;
|
39
|
+
|
40
|
+
var hasClass = function(ele, cls) {
|
41
|
+
if(!regClassCache[cls]){
|
42
|
+
regClassCache[cls] = new RegExp('(\\s|^)'+cls+'(\\s|$)');
|
43
|
+
}
|
44
|
+
return regClassCache[cls].test(ele[_getAttribute]('class') || '') && regClassCache[cls];
|
45
|
+
};
|
46
|
+
|
47
|
+
var addClass = function(ele, cls) {
|
48
|
+
if (!hasClass(ele, cls)){
|
49
|
+
ele.setAttribute('class', (ele[_getAttribute]('class') || '').trim() + ' ' + cls);
|
50
|
+
}
|
51
|
+
};
|
52
|
+
|
53
|
+
var removeClass = function(ele, cls) {
|
54
|
+
var reg;
|
55
|
+
if ((reg = hasClass(ele,cls))) {
|
56
|
+
ele.setAttribute('class', (ele[_getAttribute]('class') || '').replace(reg, ' '));
|
57
|
+
}
|
58
|
+
};
|
59
|
+
|
60
|
+
var addRemoveLoadEvents = function(dom, fn, add){
|
61
|
+
var action = add ? _addEventListener : 'removeEventListener';
|
62
|
+
if(add){
|
63
|
+
addRemoveLoadEvents(dom, fn);
|
64
|
+
}
|
65
|
+
loadEvents.forEach(function(evt){
|
66
|
+
dom[action](evt, fn);
|
67
|
+
});
|
68
|
+
};
|
69
|
+
|
70
|
+
var triggerEvent = function(elem, name, detail, noBubbles, noCancelable){
|
71
|
+
var event = document.createEvent('CustomEvent');
|
72
|
+
|
73
|
+
if(!detail){
|
74
|
+
detail = {};
|
75
|
+
}
|
76
|
+
|
77
|
+
detail.instance = lazysizes;
|
78
|
+
|
79
|
+
event.initCustomEvent(name, !noBubbles, !noCancelable, detail);
|
80
|
+
|
81
|
+
elem.dispatchEvent(event);
|
82
|
+
return event;
|
83
|
+
};
|
84
|
+
|
85
|
+
var updatePolyfill = function (el, full){
|
86
|
+
var polyfill;
|
87
|
+
if( !supportPicture && ( polyfill = (window.picturefill || lazySizesConfig.pf) ) ){
|
88
|
+
polyfill({reevaluate: true, elements: [el]});
|
89
|
+
} else if(full && full.src){
|
90
|
+
el.src = full.src;
|
91
|
+
}
|
92
|
+
};
|
93
|
+
|
94
|
+
var getCSS = function (elem, style){
|
95
|
+
return (getComputedStyle(elem, null) || {})[style];
|
96
|
+
};
|
97
|
+
|
98
|
+
var getWidth = function(elem, parent, width){
|
99
|
+
width = width || elem.offsetWidth;
|
100
|
+
|
101
|
+
while(width < lazySizesConfig.minSize && parent && !elem._lazysizesWidth){
|
102
|
+
width = parent.offsetWidth;
|
103
|
+
parent = parent.parentNode;
|
104
|
+
}
|
105
|
+
|
106
|
+
return width;
|
107
|
+
};
|
108
|
+
|
109
|
+
var rAF = (function(){
|
110
|
+
var running, waiting;
|
111
|
+
var firstFns = [];
|
112
|
+
var secondFns = [];
|
113
|
+
var fns = firstFns;
|
114
|
+
|
115
|
+
var run = function(){
|
116
|
+
var runFns = fns;
|
117
|
+
|
118
|
+
fns = firstFns.length ? secondFns : firstFns;
|
119
|
+
|
120
|
+
running = true;
|
121
|
+
waiting = false;
|
122
|
+
|
123
|
+
while(runFns.length){
|
124
|
+
runFns.shift()();
|
125
|
+
}
|
126
|
+
|
127
|
+
running = false;
|
128
|
+
};
|
129
|
+
|
130
|
+
var rafBatch = function(fn, queue){
|
131
|
+
if(running && !queue){
|
132
|
+
fn.apply(this, arguments);
|
133
|
+
} else {
|
134
|
+
fns.push(fn);
|
135
|
+
|
136
|
+
if(!waiting){
|
137
|
+
waiting = true;
|
138
|
+
(document.hidden ? setTimeout : requestAnimationFrame)(run);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
};
|
142
|
+
|
143
|
+
rafBatch._lsFlush = run;
|
144
|
+
|
145
|
+
return rafBatch;
|
146
|
+
})();
|
147
|
+
|
148
|
+
var rAFIt = function(fn, simple){
|
149
|
+
return simple ?
|
150
|
+
function() {
|
151
|
+
rAF(fn);
|
152
|
+
} :
|
153
|
+
function(){
|
154
|
+
var that = this;
|
155
|
+
var args = arguments;
|
156
|
+
rAF(function(){
|
157
|
+
fn.apply(that, args);
|
158
|
+
});
|
159
|
+
}
|
160
|
+
;
|
161
|
+
};
|
162
|
+
|
163
|
+
var throttle = function(fn){
|
164
|
+
var running;
|
165
|
+
var lastTime = 0;
|
166
|
+
var gDelay = lazySizesConfig.throttleDelay;
|
167
|
+
var rICTimeout = lazySizesConfig.ricTimeout;
|
168
|
+
var run = function(){
|
169
|
+
running = false;
|
170
|
+
lastTime = Date.now();
|
171
|
+
fn();
|
172
|
+
};
|
173
|
+
var idleCallback = requestIdleCallback && rICTimeout > 49 ?
|
174
|
+
function(){
|
175
|
+
requestIdleCallback(run, {timeout: rICTimeout});
|
176
|
+
|
177
|
+
if(rICTimeout !== lazySizesConfig.ricTimeout){
|
178
|
+
rICTimeout = lazySizesConfig.ricTimeout;
|
179
|
+
}
|
180
|
+
} :
|
181
|
+
rAFIt(function(){
|
182
|
+
setTimeout(run);
|
183
|
+
}, true)
|
184
|
+
;
|
185
|
+
|
186
|
+
return function(isPriority){
|
187
|
+
var delay;
|
188
|
+
|
189
|
+
if((isPriority = isPriority === true)){
|
190
|
+
rICTimeout = 33;
|
191
|
+
}
|
192
|
+
|
193
|
+
if(running){
|
194
|
+
return;
|
195
|
+
}
|
196
|
+
|
197
|
+
running = true;
|
198
|
+
|
199
|
+
delay = gDelay - (Date.now() - lastTime);
|
200
|
+
|
201
|
+
if(delay < 0){
|
202
|
+
delay = 0;
|
203
|
+
}
|
204
|
+
|
205
|
+
if(isPriority || delay < 9){
|
206
|
+
idleCallback();
|
207
|
+
} else {
|
208
|
+
setTimeout(idleCallback, delay);
|
209
|
+
}
|
210
|
+
};
|
211
|
+
};
|
212
|
+
|
213
|
+
//based on http://modernjavascript.blogspot.de/2013/08/building-better-debounce.html
|
214
|
+
var debounce = function(func) {
|
215
|
+
var timeout, timestamp;
|
216
|
+
var wait = 99;
|
217
|
+
var run = function(){
|
218
|
+
timeout = null;
|
219
|
+
func();
|
220
|
+
};
|
221
|
+
var later = function() {
|
222
|
+
var last = Date.now() - timestamp;
|
223
|
+
|
224
|
+
if (last < wait) {
|
225
|
+
setTimeout(later, wait - last);
|
226
|
+
} else {
|
227
|
+
(requestIdleCallback || run)(run);
|
228
|
+
}
|
229
|
+
};
|
230
|
+
|
231
|
+
return function() {
|
232
|
+
timestamp = Date.now();
|
233
|
+
|
234
|
+
if (!timeout) {
|
235
|
+
timeout = setTimeout(later, wait);
|
236
|
+
}
|
237
|
+
};
|
238
|
+
};
|
239
|
+
|
240
|
+
(function(){
|
241
|
+
var prop;
|
242
|
+
|
243
|
+
var lazySizesDefaults = {
|
244
|
+
lazyClass: 'lazyload',
|
245
|
+
loadedClass: 'lazyloaded',
|
246
|
+
loadingClass: 'lazyloading',
|
247
|
+
preloadClass: 'lazypreload',
|
248
|
+
errorClass: 'lazyerror',
|
249
|
+
//strictClass: 'lazystrict',
|
250
|
+
autosizesClass: 'lazyautosizes',
|
251
|
+
srcAttr: 'data-src',
|
252
|
+
srcsetAttr: 'data-srcset',
|
253
|
+
sizesAttr: 'data-sizes',
|
254
|
+
//preloadAfterLoad: false,
|
255
|
+
minSize: 40,
|
256
|
+
customMedia: {},
|
257
|
+
init: true,
|
258
|
+
expFactor: 1.5,
|
259
|
+
hFac: 0.8,
|
260
|
+
loadMode: 2,
|
261
|
+
loadHidden: true,
|
262
|
+
ricTimeout: 0,
|
263
|
+
throttleDelay: 125,
|
264
|
+
};
|
265
|
+
|
266
|
+
lazySizesConfig = window.lazySizesConfig || window.lazysizesConfig || {};
|
267
|
+
|
268
|
+
for(prop in lazySizesDefaults){
|
269
|
+
if(!(prop in lazySizesConfig)){
|
270
|
+
lazySizesConfig[prop] = lazySizesDefaults[prop];
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
window.lazySizesConfig = lazySizesConfig;
|
275
|
+
|
276
|
+
setTimeout(function(){
|
277
|
+
if(lazySizesConfig.init){
|
278
|
+
init();
|
279
|
+
}
|
280
|
+
});
|
281
|
+
})();
|
282
|
+
|
283
|
+
var loader = (function(){
|
284
|
+
var preloadElems, isCompleted, resetPreloadingTimer, loadMode, started;
|
285
|
+
|
286
|
+
var eLvW, elvH, eLtop, eLleft, eLright, eLbottom;
|
287
|
+
|
288
|
+
var defaultExpand, preloadExpand, hFac;
|
289
|
+
|
290
|
+
var regImg = /^img$/i;
|
291
|
+
var regIframe = /^iframe$/i;
|
292
|
+
|
293
|
+
var supportScroll = ('onscroll' in window) && !(/glebot/.test(navigator.userAgent));
|
294
|
+
|
295
|
+
var shrinkExpand = 0;
|
296
|
+
var currentExpand = 0;
|
297
|
+
|
298
|
+
var isLoading = 0;
|
299
|
+
var lowRuns = -1;
|
300
|
+
|
301
|
+
var resetPreloading = function(e){
|
302
|
+
isLoading--;
|
303
|
+
if(e && e.target){
|
304
|
+
addRemoveLoadEvents(e.target, resetPreloading);
|
305
|
+
}
|
306
|
+
|
307
|
+
if(!e || isLoading < 0 || !e.target){
|
308
|
+
isLoading = 0;
|
309
|
+
}
|
310
|
+
};
|
311
|
+
|
312
|
+
var isNestedVisible = function(elem, elemExpand){
|
313
|
+
var outerRect;
|
314
|
+
var parent = elem;
|
315
|
+
var visible = getCSS(document.body, 'visibility') == 'hidden' || getCSS(elem, 'visibility') != 'hidden';
|
316
|
+
|
317
|
+
eLtop -= elemExpand;
|
318
|
+
eLbottom += elemExpand;
|
319
|
+
eLleft -= elemExpand;
|
320
|
+
eLright += elemExpand;
|
321
|
+
|
322
|
+
while(visible && (parent = parent.offsetParent) && parent != document.body && parent != docElem){
|
323
|
+
visible = ((getCSS(parent, 'opacity') || 1) > 0);
|
324
|
+
|
325
|
+
if(visible && getCSS(parent, 'overflow') != 'visible'){
|
326
|
+
outerRect = parent.getBoundingClientRect();
|
327
|
+
visible = eLright > outerRect.left &&
|
328
|
+
eLleft < outerRect.right &&
|
329
|
+
eLbottom > outerRect.top - 1 &&
|
330
|
+
eLtop < outerRect.bottom + 1
|
331
|
+
;
|
332
|
+
}
|
333
|
+
}
|
334
|
+
|
335
|
+
return visible;
|
336
|
+
};
|
337
|
+
|
338
|
+
var checkElements = function() {
|
339
|
+
var eLlen, i, rect, autoLoadElem, loadedSomething, elemExpand, elemNegativeExpand, elemExpandVal, beforeExpandVal;
|
340
|
+
|
341
|
+
var lazyloadElems = lazysizes.elements;
|
342
|
+
|
343
|
+
if((loadMode = lazySizesConfig.loadMode) && isLoading < 8 && (eLlen = lazyloadElems.length)){
|
344
|
+
|
345
|
+
i = 0;
|
346
|
+
|
347
|
+
lowRuns++;
|
348
|
+
|
349
|
+
if(preloadExpand == null){
|
350
|
+
if(!('expand' in lazySizesConfig)){
|
351
|
+
lazySizesConfig.expand = docElem.clientHeight > 500 && docElem.clientWidth > 500 ? 500 : 370;
|
352
|
+
}
|
353
|
+
|
354
|
+
defaultExpand = lazySizesConfig.expand;
|
355
|
+
preloadExpand = defaultExpand * lazySizesConfig.expFactor;
|
356
|
+
}
|
357
|
+
|
358
|
+
if(currentExpand < preloadExpand && isLoading < 1 && lowRuns > 2 && loadMode > 2 && !document.hidden){
|
359
|
+
currentExpand = preloadExpand;
|
360
|
+
lowRuns = 0;
|
361
|
+
} else if(loadMode > 1 && lowRuns > 1 && isLoading < 6){
|
362
|
+
currentExpand = defaultExpand;
|
363
|
+
} else {
|
364
|
+
currentExpand = shrinkExpand;
|
365
|
+
}
|
366
|
+
|
367
|
+
for(; i < eLlen; i++){
|
368
|
+
|
369
|
+
if(!lazyloadElems[i] || lazyloadElems[i]._lazyRace){continue;}
|
370
|
+
|
371
|
+
if(!supportScroll){unveilElement(lazyloadElems[i]);continue;}
|
372
|
+
|
373
|
+
if(!(elemExpandVal = lazyloadElems[i][_getAttribute]('data-expand')) || !(elemExpand = elemExpandVal * 1)){
|
374
|
+
elemExpand = currentExpand;
|
375
|
+
}
|
376
|
+
|
377
|
+
if(beforeExpandVal !== elemExpand){
|
378
|
+
eLvW = innerWidth + (elemExpand * hFac);
|
379
|
+
elvH = innerHeight + elemExpand;
|
380
|
+
elemNegativeExpand = elemExpand * -1;
|
381
|
+
beforeExpandVal = elemExpand;
|
382
|
+
}
|
383
|
+
|
384
|
+
rect = lazyloadElems[i].getBoundingClientRect();
|
385
|
+
|
386
|
+
if ((eLbottom = rect.bottom) >= elemNegativeExpand &&
|
387
|
+
(eLtop = rect.top) <= elvH &&
|
388
|
+
(eLright = rect.right) >= elemNegativeExpand * hFac &&
|
389
|
+
(eLleft = rect.left) <= eLvW &&
|
390
|
+
(eLbottom || eLright || eLleft || eLtop) &&
|
391
|
+
(lazySizesConfig.loadHidden || getCSS(lazyloadElems[i], 'visibility') != 'hidden') &&
|
392
|
+
((isCompleted && isLoading < 3 && !elemExpandVal && (loadMode < 3 || lowRuns < 4)) || isNestedVisible(lazyloadElems[i], elemExpand))){
|
393
|
+
unveilElement(lazyloadElems[i]);
|
394
|
+
loadedSomething = true;
|
395
|
+
if(isLoading > 9){break;}
|
396
|
+
} else if(!loadedSomething && isCompleted && !autoLoadElem &&
|
397
|
+
isLoading < 4 && lowRuns < 4 && loadMode > 2 &&
|
398
|
+
(preloadElems[0] || lazySizesConfig.preloadAfterLoad) &&
|
399
|
+
(preloadElems[0] || (!elemExpandVal && ((eLbottom || eLright || eLleft || eLtop) || lazyloadElems[i][_getAttribute](lazySizesConfig.sizesAttr) != 'auto')))){
|
400
|
+
autoLoadElem = preloadElems[0] || lazyloadElems[i];
|
401
|
+
}
|
402
|
+
}
|
403
|
+
|
404
|
+
if(autoLoadElem && !loadedSomething){
|
405
|
+
unveilElement(autoLoadElem);
|
406
|
+
}
|
407
|
+
}
|
408
|
+
};
|
409
|
+
|
410
|
+
var throttledCheckElements = throttle(checkElements);
|
411
|
+
|
412
|
+
var switchLoadingClass = function(e){
|
413
|
+
addClass(e.target, lazySizesConfig.loadedClass);
|
414
|
+
removeClass(e.target, lazySizesConfig.loadingClass);
|
415
|
+
addRemoveLoadEvents(e.target, rafSwitchLoadingClass);
|
416
|
+
triggerEvent(e.target, 'lazyloaded');
|
417
|
+
};
|
418
|
+
var rafedSwitchLoadingClass = rAFIt(switchLoadingClass);
|
419
|
+
var rafSwitchLoadingClass = function(e){
|
420
|
+
rafedSwitchLoadingClass({target: e.target});
|
421
|
+
};
|
422
|
+
|
423
|
+
var changeIframeSrc = function(elem, src){
|
424
|
+
try {
|
425
|
+
elem.contentWindow.location.replace(src);
|
426
|
+
} catch(e){
|
427
|
+
elem.src = src;
|
428
|
+
}
|
429
|
+
};
|
430
|
+
|
431
|
+
var handleSources = function(source){
|
432
|
+
var customMedia;
|
433
|
+
|
434
|
+
var sourceSrcset = source[_getAttribute](lazySizesConfig.srcsetAttr);
|
435
|
+
|
436
|
+
if( (customMedia = lazySizesConfig.customMedia[source[_getAttribute]('data-media') || source[_getAttribute]('media')]) ){
|
437
|
+
source.setAttribute('media', customMedia);
|
438
|
+
}
|
439
|
+
|
440
|
+
if(sourceSrcset){
|
441
|
+
source.setAttribute('srcset', sourceSrcset);
|
442
|
+
}
|
443
|
+
};
|
444
|
+
|
445
|
+
var lazyUnveil = rAFIt(function (elem, detail, isAuto, sizes, isImg){
|
446
|
+
var src, srcset, parent, isPicture, event, firesLoad;
|
447
|
+
|
448
|
+
if(!(event = triggerEvent(elem, 'lazybeforeunveil', detail)).defaultPrevented){
|
449
|
+
|
450
|
+
if(sizes){
|
451
|
+
if(isAuto){
|
452
|
+
addClass(elem, lazySizesConfig.autosizesClass);
|
453
|
+
} else {
|
454
|
+
elem.setAttribute('sizes', sizes);
|
455
|
+
}
|
456
|
+
}
|
457
|
+
|
458
|
+
srcset = elem[_getAttribute](lazySizesConfig.srcsetAttr);
|
459
|
+
src = elem[_getAttribute](lazySizesConfig.srcAttr);
|
460
|
+
|
461
|
+
if(isImg) {
|
462
|
+
parent = elem.parentNode;
|
463
|
+
isPicture = parent && regPicture.test(parent.nodeName || '');
|
464
|
+
}
|
465
|
+
|
466
|
+
firesLoad = detail.firesLoad || (('src' in elem) && (srcset || src || isPicture));
|
467
|
+
|
468
|
+
event = {target: elem};
|
469
|
+
|
470
|
+
if(firesLoad){
|
471
|
+
addRemoveLoadEvents(elem, resetPreloading, true);
|
472
|
+
clearTimeout(resetPreloadingTimer);
|
473
|
+
resetPreloadingTimer = setTimeout(resetPreloading, 2500);
|
474
|
+
|
475
|
+
addClass(elem, lazySizesConfig.loadingClass);
|
476
|
+
addRemoveLoadEvents(elem, rafSwitchLoadingClass, true);
|
477
|
+
}
|
478
|
+
|
479
|
+
if(isPicture){
|
480
|
+
forEach.call(parent.getElementsByTagName('source'), handleSources);
|
481
|
+
}
|
482
|
+
|
483
|
+
if(srcset){
|
484
|
+
elem.setAttribute('srcset', srcset);
|
485
|
+
} else if(src && !isPicture){
|
486
|
+
if(regIframe.test(elem.nodeName)){
|
487
|
+
changeIframeSrc(elem, src);
|
488
|
+
} else {
|
489
|
+
elem.src = src;
|
490
|
+
}
|
491
|
+
}
|
492
|
+
|
493
|
+
if(isImg && (srcset || isPicture)){
|
494
|
+
updatePolyfill(elem, {src: src});
|
495
|
+
}
|
496
|
+
}
|
497
|
+
|
498
|
+
if(elem._lazyRace){
|
499
|
+
delete elem._lazyRace;
|
500
|
+
}
|
501
|
+
removeClass(elem, lazySizesConfig.lazyClass);
|
502
|
+
|
503
|
+
rAF(function(){
|
504
|
+
if( !firesLoad || (elem.complete && elem.naturalWidth > 1)){
|
505
|
+
if(firesLoad){
|
506
|
+
resetPreloading(event);
|
507
|
+
} else {
|
508
|
+
isLoading--;
|
509
|
+
}
|
510
|
+
switchLoadingClass(event);
|
511
|
+
}
|
512
|
+
}, true);
|
513
|
+
});
|
514
|
+
|
515
|
+
var unveilElement = function (elem){
|
516
|
+
var detail;
|
517
|
+
|
518
|
+
var isImg = regImg.test(elem.nodeName);
|
519
|
+
|
520
|
+
//allow using sizes="auto", but don't use. it's invalid. Use data-sizes="auto" or a valid value for sizes instead (i.e.: sizes="80vw")
|
521
|
+
var sizes = isImg && (elem[_getAttribute](lazySizesConfig.sizesAttr) || elem[_getAttribute]('sizes'));
|
522
|
+
var isAuto = sizes == 'auto';
|
523
|
+
|
524
|
+
if( (isAuto || !isCompleted) && isImg && (elem[_getAttribute]('src') || elem.srcset) && !elem.complete && !hasClass(elem, lazySizesConfig.errorClass) && hasClass(elem, lazySizesConfig.lazyClass)){return;}
|
525
|
+
|
526
|
+
detail = triggerEvent(elem, 'lazyunveilread').detail;
|
527
|
+
|
528
|
+
if(isAuto){
|
529
|
+
autoSizer.updateElem(elem, true, elem.offsetWidth);
|
530
|
+
}
|
531
|
+
|
532
|
+
elem._lazyRace = true;
|
533
|
+
isLoading++;
|
534
|
+
|
535
|
+
lazyUnveil(elem, detail, isAuto, sizes, isImg);
|
536
|
+
};
|
537
|
+
|
538
|
+
var onload = function(){
|
539
|
+
if(isCompleted){return;}
|
540
|
+
if(Date.now() - started < 999){
|
541
|
+
setTimeout(onload, 999);
|
542
|
+
return;
|
543
|
+
}
|
544
|
+
var afterScroll = debounce(function(){
|
545
|
+
lazySizesConfig.loadMode = 3;
|
546
|
+
throttledCheckElements();
|
547
|
+
});
|
548
|
+
|
549
|
+
isCompleted = true;
|
550
|
+
|
551
|
+
lazySizesConfig.loadMode = 3;
|
552
|
+
|
553
|
+
throttledCheckElements();
|
554
|
+
|
555
|
+
addEventListener('scroll', function(){
|
556
|
+
if(lazySizesConfig.loadMode == 3){
|
557
|
+
lazySizesConfig.loadMode = 2;
|
558
|
+
}
|
559
|
+
afterScroll();
|
560
|
+
}, true);
|
561
|
+
};
|
562
|
+
|
563
|
+
return {
|
564
|
+
_: function(){
|
565
|
+
started = Date.now();
|
566
|
+
|
567
|
+
lazysizes.elements = document.getElementsByClassName(lazySizesConfig.lazyClass);
|
568
|
+
preloadElems = document.getElementsByClassName(lazySizesConfig.lazyClass + ' ' + lazySizesConfig.preloadClass);
|
569
|
+
hFac = lazySizesConfig.hFac;
|
570
|
+
|
571
|
+
addEventListener('scroll', throttledCheckElements, true);
|
572
|
+
|
573
|
+
addEventListener('resize', throttledCheckElements, true);
|
574
|
+
|
575
|
+
if(window.MutationObserver){
|
576
|
+
new MutationObserver( throttledCheckElements ).observe( docElem, {childList: true, subtree: true, attributes: true} );
|
577
|
+
} else {
|
578
|
+
docElem[_addEventListener]('DOMNodeInserted', throttledCheckElements, true);
|
579
|
+
docElem[_addEventListener]('DOMAttrModified', throttledCheckElements, true);
|
580
|
+
setInterval(throttledCheckElements, 999);
|
581
|
+
}
|
582
|
+
|
583
|
+
addEventListener('hashchange', throttledCheckElements, true);
|
584
|
+
|
585
|
+
//, 'fullscreenchange'
|
586
|
+
['focus', 'mouseover', 'click', 'load', 'transitionend', 'animationend', 'webkitAnimationEnd'].forEach(function(name){
|
587
|
+
document[_addEventListener](name, throttledCheckElements, true);
|
588
|
+
});
|
589
|
+
|
590
|
+
if((/d$|^c/.test(document.readyState))){
|
591
|
+
onload();
|
592
|
+
} else {
|
593
|
+
addEventListener('load', onload);
|
594
|
+
document[_addEventListener]('DOMContentLoaded', throttledCheckElements);
|
595
|
+
setTimeout(onload, 20000);
|
596
|
+
}
|
597
|
+
|
598
|
+
if(lazysizes.elements.length){
|
599
|
+
checkElements();
|
600
|
+
rAF._lsFlush();
|
601
|
+
} else {
|
602
|
+
throttledCheckElements();
|
603
|
+
}
|
604
|
+
},
|
605
|
+
checkElems: throttledCheckElements,
|
606
|
+
unveil: unveilElement
|
607
|
+
};
|
608
|
+
})();
|
609
|
+
|
610
|
+
|
611
|
+
var autoSizer = (function(){
|
612
|
+
var autosizesElems;
|
613
|
+
|
614
|
+
var sizeElement = rAFIt(function(elem, parent, event, width){
|
615
|
+
var sources, i, len;
|
616
|
+
elem._lazysizesWidth = width;
|
617
|
+
width += 'px';
|
618
|
+
|
619
|
+
elem.setAttribute('sizes', width);
|
620
|
+
|
621
|
+
if(regPicture.test(parent.nodeName || '')){
|
622
|
+
sources = parent.getElementsByTagName('source');
|
623
|
+
for(i = 0, len = sources.length; i < len; i++){
|
624
|
+
sources[i].setAttribute('sizes', width);
|
625
|
+
}
|
626
|
+
}
|
627
|
+
|
628
|
+
if(!event.detail.dataAttr){
|
629
|
+
updatePolyfill(elem, event.detail);
|
630
|
+
}
|
631
|
+
});
|
632
|
+
var getSizeElement = function (elem, dataAttr, width){
|
633
|
+
var event;
|
634
|
+
var parent = elem.parentNode;
|
635
|
+
|
636
|
+
if(parent){
|
637
|
+
width = getWidth(elem, parent, width);
|
638
|
+
event = triggerEvent(elem, 'lazybeforesizes', {width: width, dataAttr: !!dataAttr});
|
639
|
+
|
640
|
+
if(!event.defaultPrevented){
|
641
|
+
width = event.detail.width;
|
642
|
+
|
643
|
+
if(width && width !== elem._lazysizesWidth){
|
644
|
+
sizeElement(elem, parent, event, width);
|
645
|
+
}
|
646
|
+
}
|
647
|
+
}
|
648
|
+
};
|
649
|
+
|
650
|
+
var updateElementsSizes = function(){
|
651
|
+
var i;
|
652
|
+
var len = autosizesElems.length;
|
653
|
+
if(len){
|
654
|
+
i = 0;
|
655
|
+
|
656
|
+
for(; i < len; i++){
|
657
|
+
getSizeElement(autosizesElems[i]);
|
658
|
+
}
|
659
|
+
}
|
660
|
+
};
|
661
|
+
|
662
|
+
var debouncedUpdateElementsSizes = debounce(updateElementsSizes);
|
663
|
+
|
664
|
+
return {
|
665
|
+
_: function(){
|
666
|
+
autosizesElems = document.getElementsByClassName(lazySizesConfig.autosizesClass);
|
667
|
+
addEventListener('resize', debouncedUpdateElementsSizes);
|
668
|
+
},
|
669
|
+
checkElems: debouncedUpdateElementsSizes,
|
670
|
+
updateElem: getSizeElement
|
671
|
+
};
|
672
|
+
})();
|
673
|
+
|
674
|
+
var init = function(){
|
675
|
+
if(!init.i){
|
676
|
+
init.i = true;
|
677
|
+
autoSizer._();
|
678
|
+
loader._();
|
679
|
+
}
|
680
|
+
};
|
681
|
+
|
682
|
+
lazysizes = {
|
683
|
+
cfg: lazySizesConfig,
|
684
|
+
autoSizer: autoSizer,
|
685
|
+
loader: loader,
|
686
|
+
init: init,
|
687
|
+
uP: updatePolyfill,
|
688
|
+
aC: addClass,
|
689
|
+
rC: removeClass,
|
690
|
+
hC: hasClass,
|
691
|
+
fire: triggerEvent,
|
692
|
+
gW: getWidth,
|
693
|
+
rAF: rAF,
|
694
|
+
};
|
695
|
+
|
696
|
+
return lazysizes;
|
697
|
+
}
|
698
|
+
));
|