ext_yarn 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +41 -47
- data/README.md +10 -0
- data/bin/yarn_after +12 -0
- data/lib/ext_yarn/version.rb +1 -1
- data/package.json +14 -13
- data/vendor/.yarn-integrity +35 -39
- data/vendor/bootswatch-sass/package.json +1 -1
- data/vendor/chart.js/dist/Chart.bundle.js +5754 -5711
- data/vendor/chart.js/dist/Chart.js +2118 -2046
- data/vendor/chart.js/package.json +1 -1
- data/vendor/chartkick/LICENSE.txt +1 -1
- data/vendor/chartkick/dist/chartkick.js +2239 -0
- data/vendor/chartkick/package.json +18 -8
- data/vendor/file-saver/dist/FileSaver.js +180 -0
- data/vendor/file-saver/package.json +16 -4
- data/vendor/jquery/dist/jquery.js +453 -342
- data/vendor/jquery/dist/jquery.slim.js +428 -319
- data/vendor/jquery/package.json +32 -21
- data/vendor/{tempusdominus-bootstrap-4 → jquery-touch-events}/LICENSE +21 -21
- data/vendor/jquery-touch-events/package.json +32 -0
- data/vendor/jquery-touch-events/src/jquery.mobile-events.js +920 -0
- data/vendor/jquery-ui-touch-punch-zoom-fork/jquery.ui.touch-punch.js +186 -0
- data/vendor/jquery-ujs/package.json +1 -1
- data/vendor/jquery-ujs/src/rails.js +14 -4
- data/vendor/{bootswatch → jquery.iframe-transport}/LICENSE +2 -2
- data/vendor/jquery.iframe-transport/jquery.iframe-transport.js +247 -0
- data/vendor/jquery.iframe-transport/package.json +28 -0
- data/vendor/jstz/dist/jstz.js +9 -1
- data/vendor/jstz/package.json +6 -4
- data/vendor/lazysizes/LICENSE +22 -0
- data/vendor/lazysizes/lazysizes-umd.js +706 -0
- data/vendor/lazysizes/lazysizes.js +703 -0
- data/vendor/lazysizes/package.json +65 -0
- data/vendor/lazysizes/plugins/artdirect/ls.artdirect.js +160 -0
- data/vendor/lazysizes/plugins/aspectratio/ls.aspectratio.js +209 -0
- data/vendor/lazysizes/plugins/attrchange/ls.attrchange.js +129 -0
- data/vendor/lazysizes/plugins/bgset/ls.bgset.js +198 -0
- data/vendor/lazysizes/plugins/blur-up/ls.blur-up.js +191 -0
- data/vendor/lazysizes/plugins/custommedia/ls.custommedia.js +75 -0
- data/vendor/lazysizes/plugins/fix-ios-sizes/fix-ios-sizes.js +80 -0
- data/vendor/lazysizes/plugins/include/ls.include.js +589 -0
- data/vendor/lazysizes/plugins/noscript/ls.noscript.js +87 -0
- data/vendor/lazysizes/plugins/object-fit/ls.object-fit.js +149 -0
- data/vendor/lazysizes/plugins/optimumx/ls.optimumx.js +273 -0
- data/vendor/lazysizes/plugins/parent-fit/ls.parent-fit.js +157 -0
- data/vendor/lazysizes/plugins/print/ls.print.js +51 -0
- data/vendor/lazysizes/plugins/progressive/ls.progressive.js +49 -0
- data/vendor/lazysizes/plugins/respimg/ls.respimg.js +314 -0
- data/vendor/lazysizes/plugins/rias/ls.rias.js +391 -0
- data/vendor/lazysizes/plugins/static-gecko-picture/ls.static-gecko-picture.js +82 -0
- data/vendor/lazysizes/plugins/twitter/ls.twitter.js +63 -0
- data/vendor/lazysizes/plugins/unload/ls.unload.js +155 -0
- data/vendor/lazysizes/plugins/unveilhooks/ls.unveilhooks.js +145 -0
- data/vendor/lazysizes/plugins/video-embed/ls.video-embed.js +114 -0
- data/vendor/lodash/core.js +75 -57
- data/vendor/lodash/lodash.js +105 -82
- data/vendor/lodash/package.json +2 -2
- data/vendor/moment/locale/af.js +58 -60
- data/vendor/moment/locale/ar-dz.js +45 -47
- data/vendor/moment/locale/ar-kw.js +45 -47
- data/vendor/moment/locale/ar-ly.js +106 -112
- data/vendor/moment/locale/ar-ma.js +45 -48
- data/vendor/moment/locale/ar-sa.js +88 -91
- data/vendor/moment/locale/ar-tn.js +45 -47
- data/vendor/moment/locale/ar.js +119 -128
- data/vendor/moment/locale/az.js +89 -91
- data/vendor/moment/locale/be.js +111 -115
- data/vendor/moment/locale/bg.js +73 -75
- data/vendor/moment/locale/bm.js +44 -47
- data/vendor/moment/locale/bn.js +103 -105
- data/vendor/moment/locale/bo.js +103 -105
- data/vendor/moment/locale/br.js +88 -90
- data/vendor/moment/locale/bs.js +133 -136
- data/vendor/moment/locale/ca.js +68 -70
- data/vendor/moment/locale/cs.js +160 -162
- data/vendor/moment/locale/cv.js +48 -50
- data/vendor/moment/locale/cy.js +64 -67
- data/vendor/moment/locale/da.js +46 -48
- data/vendor/moment/locale/de-at.js +61 -66
- data/vendor/moment/locale/de-ch.js +61 -65
- data/vendor/moment/locale/de.js +61 -65
- data/vendor/moment/locale/dv.js +82 -85
- data/vendor/moment/locale/el.js +82 -84
- data/vendor/moment/locale/en-au.js +53 -55
- data/vendor/moment/locale/en-ca.js +49 -51
- data/vendor/moment/locale/en-gb.js +53 -55
- data/vendor/moment/locale/en-ie.js +53 -55
- data/vendor/moment/locale/en-il.js +61 -0
- data/vendor/moment/locale/en-nz.js +53 -55
- data/vendor/moment/locale/eo.js +56 -60
- data/vendor/moment/locale/es-do.js +72 -73
- data/vendor/moment/locale/es-us.js +64 -66
- data/vendor/moment/locale/es.js +72 -74
- data/vendor/moment/locale/et.js +64 -67
- data/vendor/moment/locale/eu.js +52 -54
- data/vendor/moment/locale/fa.js +90 -93
- data/vendor/moment/locale/fi.js +93 -95
- data/vendor/moment/locale/fo.js +46 -48
- data/vendor/moment/locale/fr-ca.js +58 -60
- data/vendor/moment/locale/fr-ch.js +62 -64
- data/vendor/moment/locale/fr.js +66 -68
- data/vendor/moment/locale/fy.js +59 -61
- data/vendor/moment/locale/gd.js +57 -59
- data/vendor/moment/locale/gl.js +60 -62
- data/vendor/moment/locale/gom-latn.js +107 -109
- data/vendor/moment/locale/gu.js +108 -110
- data/vendor/moment/locale/he.js +77 -81
- data/vendor/moment/locale/hi.js +108 -110
- data/vendor/moment/locale/hr.js +136 -138
- data/vendor/moment/locale/hu.js +92 -94
- data/vendor/moment/locale/hy-am.js +78 -80
- data/vendor/moment/locale/id.js +67 -70
- data/vendor/moment/locale/is.js +110 -112
- data/vendor/moment/locale/it.js +53 -56
- data/vendor/moment/locale/ja.js +77 -67
- data/vendor/moment/locale/jv.js +67 -70
- data/vendor/moment/locale/ka.js +70 -72
- data/vendor/moment/locale/kk.js +72 -74
- data/vendor/moment/locale/km.js +96 -46
- data/vendor/moment/locale/kn.js +110 -112
- data/vendor/moment/locale/ko.js +66 -69
- data/vendor/moment/locale/ky.js +72 -75
- data/vendor/moment/locale/lb.js +113 -116
- data/vendor/moment/locale/lo.js +55 -57
- data/vendor/moment/locale/lt.js +100 -102
- data/vendor/moment/locale/lv.js +81 -84
- data/vendor/moment/locale/me.js +93 -95
- data/vendor/moment/locale/mi.js +50 -52
- data/vendor/moment/locale/mk.js +73 -75
- data/vendor/moment/locale/ml.js +66 -68
- data/vendor/moment/locale/mn.js +103 -0
- data/vendor/moment/locale/mr.js +140 -143
- data/vendor/moment/locale/ms-my.js +67 -70
- data/vendor/moment/locale/ms.js +67 -69
- data/vendor/moment/locale/mt.js +46 -48
- data/vendor/moment/locale/my.js +77 -82
- data/vendor/moment/locale/nb.js +48 -51
- data/vendor/moment/locale/ne.js +107 -109
- data/vendor/moment/locale/nl-be.js +68 -71
- data/vendor/moment/locale/nl.js +68 -71
- data/vendor/moment/locale/nn.js +46 -48
- data/vendor/moment/locale/pa-in.js +108 -110
- data/vendor/moment/locale/pl.js +104 -106
- data/vendor/moment/locale/pt-br.js +46 -48
- data/vendor/moment/locale/pt.js +50 -52
- data/vendor/moment/locale/ro.js +59 -62
- data/vendor/moment/locale/ru.js +153 -157
- data/vendor/moment/locale/sd.js +82 -84
- data/vendor/moment/locale/se.js +46 -49
- data/vendor/moment/locale/si.js +56 -58
- data/vendor/moment/locale/sk.js +138 -141
- data/vendor/moment/locale/sl.js +154 -156
- data/vendor/moment/locale/sq.js +54 -58
- data/vendor/moment/locale/sr-cyrl.js +93 -95
- data/vendor/moment/locale/sr.js +93 -95
- data/vendor/moment/locale/ss.js +72 -75
- data/vendor/moment/locale/sv.js +55 -57
- data/vendor/moment/locale/sw.js +45 -47
- data/vendor/moment/locale/ta.js +113 -116
- data/vendor/moment/locale/te.js +74 -76
- data/vendor/moment/locale/tet.js +53 -56
- data/vendor/moment/locale/tg.js +115 -0
- data/vendor/moment/locale/th.js +52 -54
- data/vendor/moment/locale/tl-ph.js +48 -50
- data/vendor/moment/locale/tlh.js +101 -103
- data/vendor/moment/locale/tr.js +80 -78
- data/vendor/moment/locale/tzl.js +75 -78
- data/vendor/moment/locale/tzm-latn.js +44 -46
- data/vendor/moment/locale/tzm.js +44 -46
- data/vendor/moment/locale/ug-cn.js +118 -0
- data/vendor/moment/locale/uk.js +129 -132
- data/vendor/moment/locale/ur.js +82 -85
- data/vendor/moment/locale/uz-latn.js +44 -46
- data/vendor/moment/locale/uz.js +44 -46
- data/vendor/moment/locale/vi.js +64 -66
- data/vendor/moment/locale/x-pseudo.js +54 -56
- data/vendor/moment/locale/yo.js +46 -48
- data/vendor/moment/locale/zh-cn.js +95 -98
- data/vendor/moment/locale/zh-hk.js +88 -92
- data/vendor/moment/locale/zh-tw.js +88 -91
- data/vendor/moment/min/locales.js +9701 -9581
- data/vendor/moment/min/moment-with-locales.js +13426 -13335
- data/vendor/moment/moment.js +3780 -3809
- data/vendor/moment/package.json +10 -10
- data/vendor/moment-timezone/builds/moment-timezone-with-data-2012-2022.js +43 -35
- data/vendor/moment-timezone/builds/moment-timezone-with-data.js +290 -282
- data/vendor/moment-timezone/moment-timezone-utils.js +12 -10
- data/vendor/moment-timezone/moment-timezone.js +15 -7
- data/vendor/moment-timezone/package.json +5 -3
- data/vendor/{bootstrap → pako}/LICENSE +2 -3
- data/vendor/pako/dist/pako.js +6811 -0
- data/vendor/pako/dist/pako_deflate.js +3995 -0
- data/vendor/pako/dist/pako_inflate.js +3295 -0
- data/vendor/pako/package.json +48 -0
- data/yarn.lock +51 -78
- metadata +45 -155
- data/vendor/bootstrap/dist/js/bootstrap.bundle.js +0 -6461
- data/vendor/bootstrap/dist/js/bootstrap.js +0 -3944
- data/vendor/bootstrap/js/dist/alert.js +0 -204
- data/vendor/bootstrap/js/dist/button.js +0 -192
- data/vendor/bootstrap/js/dist/carousel.js +0 -567
- data/vendor/bootstrap/js/dist/collapse.js +0 -431
- data/vendor/bootstrap/js/dist/dropdown.js +0 -552
- data/vendor/bootstrap/js/dist/index.js +0 -23
- data/vendor/bootstrap/js/dist/modal.js +0 -634
- data/vendor/bootstrap/js/dist/popover.js +0 -266
- data/vendor/bootstrap/js/dist/scrollspy.js +0 -379
- data/vendor/bootstrap/js/dist/tab.js +0 -278
- data/vendor/bootstrap/js/dist/tooltip.js +0 -734
- data/vendor/bootstrap/js/dist/util.js +0 -144
- data/vendor/bootstrap/package.json +0 -217
- data/vendor/bootstrap/scss/_alert.scss +0 -51
- data/vendor/bootstrap/scss/_badge.scss +0 -47
- data/vendor/bootstrap/scss/_breadcrumb.scss +0 -41
- data/vendor/bootstrap/scss/_button-group.scss +0 -172
- data/vendor/bootstrap/scss/_buttons.scss +0 -143
- data/vendor/bootstrap/scss/_card.scss +0 -301
- data/vendor/bootstrap/scss/_carousel.scss +0 -236
- data/vendor/bootstrap/scss/_close.scss +0 -35
- data/vendor/bootstrap/scss/_code.scss +0 -48
- data/vendor/bootstrap/scss/_custom-forms.scss +0 -433
- data/vendor/bootstrap/scss/_dropdown.scss +0 -166
- data/vendor/bootstrap/scss/_forms.scss +0 -333
- data/vendor/bootstrap/scss/_functions.scss +0 -86
- data/vendor/bootstrap/scss/_grid.scss +0 -52
- data/vendor/bootstrap/scss/_images.scss +0 -42
- data/vendor/bootstrap/scss/_input-group.scss +0 -173
- data/vendor/bootstrap/scss/_jumbotron.scss +0 -16
- data/vendor/bootstrap/scss/_list-group.scss +0 -115
- data/vendor/bootstrap/scss/_media.scss +0 -8
- data/vendor/bootstrap/scss/_mixins.scss +0 -41
- data/vendor/bootstrap/scss/_modal.scss +0 -180
- data/vendor/bootstrap/scss/_nav.scss +0 -118
- data/vendor/bootstrap/scss/_navbar.scss +0 -299
- data/vendor/bootstrap/scss/_pagination.scss +0 -78
- data/vendor/bootstrap/scss/_popover.scss +0 -183
- data/vendor/bootstrap/scss/_print.scss +0 -141
- data/vendor/bootstrap/scss/_progress.scss +0 -34
- data/vendor/bootstrap/scss/_reboot.scss +0 -483
- data/vendor/bootstrap/scss/_root.scss +0 -19
- data/vendor/bootstrap/scss/_tables.scss +0 -187
- data/vendor/bootstrap/scss/_tooltip.scss +0 -115
- data/vendor/bootstrap/scss/_transitions.scss +0 -22
- data/vendor/bootstrap/scss/_type.scss +0 -125
- data/vendor/bootstrap/scss/_utilities.scss +0 -15
- data/vendor/bootstrap/scss/_variables.scss +0 -952
- data/vendor/bootstrap/scss/bootstrap-grid.scss +0 -32
- data/vendor/bootstrap/scss/bootstrap-reboot.scss +0 -12
- data/vendor/bootstrap/scss/bootstrap.scss +0 -42
- data/vendor/bootstrap/scss/mixins/_alert.scss +0 -13
- data/vendor/bootstrap/scss/mixins/_background-variant.scss +0 -21
- data/vendor/bootstrap/scss/mixins/_badge.scss +0 -12
- data/vendor/bootstrap/scss/mixins/_border-radius.scss +0 -35
- data/vendor/bootstrap/scss/mixins/_box-shadow.scss +0 -5
- data/vendor/bootstrap/scss/mixins/_breakpoints.scss +0 -123
- data/vendor/bootstrap/scss/mixins/_buttons.scss +0 -109
- data/vendor/bootstrap/scss/mixins/_caret.scss +0 -66
- data/vendor/bootstrap/scss/mixins/_clearfix.scss +0 -7
- data/vendor/bootstrap/scss/mixins/_float.scss +0 -11
- data/vendor/bootstrap/scss/mixins/_forms.scss +0 -147
- data/vendor/bootstrap/scss/mixins/_gradients.scss +0 -45
- data/vendor/bootstrap/scss/mixins/_grid-framework.scss +0 -67
- data/vendor/bootstrap/scss/mixins/_grid.scss +0 -52
- data/vendor/bootstrap/scss/mixins/_hover.scss +0 -37
- data/vendor/bootstrap/scss/mixins/_image.scss +0 -36
- data/vendor/bootstrap/scss/mixins/_list-group.scss +0 -21
- data/vendor/bootstrap/scss/mixins/_lists.scss +0 -7
- data/vendor/bootstrap/scss/mixins/_nav-divider.scss +0 -10
- data/vendor/bootstrap/scss/mixins/_pagination.scss +0 -22
- data/vendor/bootstrap/scss/mixins/_reset-text.scss +0 -17
- data/vendor/bootstrap/scss/mixins/_resize.scss +0 -6
- data/vendor/bootstrap/scss/mixins/_screen-reader.scss +0 -33
- data/vendor/bootstrap/scss/mixins/_size.scss +0 -6
- data/vendor/bootstrap/scss/mixins/_table-row.scss +0 -30
- data/vendor/bootstrap/scss/mixins/_text-emphasis.scss +0 -14
- data/vendor/bootstrap/scss/mixins/_text-hide.scss +0 -13
- data/vendor/bootstrap/scss/mixins/_text-truncate.scss +0 -8
- data/vendor/bootstrap/scss/mixins/_transition.scss +0 -13
- data/vendor/bootstrap/scss/mixins/_visibility.scss +0 -7
- data/vendor/bootstrap/scss/utilities/_align.scss +0 -8
- data/vendor/bootstrap/scss/utilities/_background.scss +0 -19
- data/vendor/bootstrap/scss/utilities/_borders.scss +0 -59
- data/vendor/bootstrap/scss/utilities/_clearfix.scss +0 -3
- data/vendor/bootstrap/scss/utilities/_display.scss +0 -38
- data/vendor/bootstrap/scss/utilities/_embed.scss +0 -52
- data/vendor/bootstrap/scss/utilities/_flex.scss +0 -51
- data/vendor/bootstrap/scss/utilities/_float.scss +0 -9
- data/vendor/bootstrap/scss/utilities/_position.scss +0 -37
- data/vendor/bootstrap/scss/utilities/_screenreaders.scss +0 -11
- data/vendor/bootstrap/scss/utilities/_shadows.scss +0 -6
- data/vendor/bootstrap/scss/utilities/_sizing.scss +0 -12
- data/vendor/bootstrap/scss/utilities/_spacing.scss +0 -51
- data/vendor/bootstrap/scss/utilities/_text.scss +0 -58
- data/vendor/bootstrap/scss/utilities/_visibility.scss +0 -11
- data/vendor/bootswatch/dist/cerulean/_bootswatch.scss +0 -99
- data/vendor/bootswatch/dist/cerulean/_variables.scss +0 -57
- data/vendor/bootswatch/dist/cosmo/_bootswatch.scss +0 -38
- data/vendor/bootswatch/dist/cosmo/_variables.scss +0 -68
- data/vendor/bootswatch/dist/cyborg/_bootswatch.scss +0 -230
- data/vendor/bootswatch/dist/cyborg/_variables.scss +0 -173
- data/vendor/bootswatch/dist/darkly/_bootswatch.scss +0 -186
- data/vendor/bootswatch/dist/darkly/_variables.scss +0 -178
- data/vendor/bootswatch/dist/flatly/_bootswatch.scss +0 -185
- data/vendor/bootswatch/dist/flatly/_variables.scss +0 -113
- data/vendor/bootswatch/dist/journal/_bootswatch.scss +0 -73
- data/vendor/bootswatch/dist/journal/_variables.scss +0 -60
- data/vendor/bootswatch/dist/litera/_bootswatch.scss +0 -212
- data/vendor/bootswatch/dist/litera/_variables.scss +0 -77
- data/vendor/bootswatch/dist/lumen/_bootswatch.scss +0 -429
- data/vendor/bootswatch/dist/lumen/_variables.scss +0 -82
- data/vendor/bootswatch/dist/lux/_bootswatch.scss +0 -157
- data/vendor/bootswatch/dist/lux/_variables.scss +0 -120
- data/vendor/bootswatch/dist/materia/_bootswatch.scss +0 -677
- data/vendor/bootswatch/dist/materia/_variables.scss +0 -131
- data/vendor/bootswatch/dist/minty/_bootswatch.scss +0 -258
- data/vendor/bootswatch/dist/minty/_variables.scss +0 -97
- data/vendor/bootswatch/dist/pulse/_bootswatch.scss +0 -154
- data/vendor/bootswatch/dist/pulse/_variables.scss +0 -100
- data/vendor/bootswatch/dist/sandstone/_bootswatch.scss +0 -235
- data/vendor/bootswatch/dist/sandstone/_variables.scss +0 -143
- data/vendor/bootswatch/dist/simplex/_bootswatch.scss +0 -130
- data/vendor/bootswatch/dist/simplex/_variables.scss +0 -108
- data/vendor/bootswatch/dist/sketchy/_bootswatch.scss +0 -411
- data/vendor/bootswatch/dist/sketchy/_variables.scss +0 -164
- data/vendor/bootswatch/dist/slate/_bootswatch.scss +0 -425
- data/vendor/bootswatch/dist/slate/_variables.scss +0 -160
- data/vendor/bootswatch/dist/solar/_bootswatch.scss +0 -119
- data/vendor/bootswatch/dist/solar/_variables.scss +0 -175
- data/vendor/bootswatch/dist/spacelab/_bootswatch.scss +0 -167
- data/vendor/bootswatch/dist/spacelab/_variables.scss +0 -63
- data/vendor/bootswatch/dist/superhero/_bootswatch.scss +0 -200
- data/vendor/bootswatch/dist/superhero/_variables.scss +0 -148
- data/vendor/bootswatch/dist/united/_bootswatch.scss +0 -26
- data/vendor/bootswatch/dist/united/_variables.scss +0 -53
- data/vendor/bootswatch/dist/yeti/_bootswatch.scss +0 -468
- data/vendor/bootswatch/dist/yeti/_variables.scss +0 -110
- data/vendor/bootswatch/package.json +0 -38
- data/vendor/chartkick/chartkick.js +0 -1872
- data/vendor/file-saver/FileSaver.js +0 -188
- data/vendor/popper.js/dist/umd/popper-utils.js +0 -1133
- data/vendor/popper.js/dist/umd/popper.js +0 -2540
- data/vendor/popper.js/package.json +0 -54
- data/vendor/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.js +0 -2779
- data/vendor/tempusdominus-bootstrap-4/package.json +0 -79
- data/vendor/tempusdominus-bootstrap-4/src/sass/_tempusdominus-bootstrap-4.scss +0 -342
- data/vendor/tempusdominus-bootstrap-4/src/sass/tempusdominus-bootstrap-4-build.scss +0 -12
@@ -0,0 +1,149 @@
|
|
1
|
+
(function(window, factory) {
|
2
|
+
var globalInstall = function(initialEvent){
|
3
|
+
factory(window.lazySizes, initialEvent);
|
4
|
+
window.removeEventListener('lazyunveilread', globalInstall, true);
|
5
|
+
};
|
6
|
+
|
7
|
+
factory = factory.bind(null, window, window.document);
|
8
|
+
|
9
|
+
if(typeof module == 'object' && module.exports){
|
10
|
+
factory(require('lazysizes'));
|
11
|
+
} else if(window.lazySizes) {
|
12
|
+
globalInstall();
|
13
|
+
} else {
|
14
|
+
window.addEventListener('lazyunveilread', globalInstall, true);
|
15
|
+
}
|
16
|
+
}(window, function(window, document, lazySizes, initialEvent) {
|
17
|
+
'use strict';
|
18
|
+
var style = document.createElement('a').style;
|
19
|
+
var fitSupport = 'objectFit' in style;
|
20
|
+
var positionSupport = fitSupport && 'objectPosition' in style;
|
21
|
+
var regCssFit = /object-fit["']*\s*:\s*["']*(contain|cover)/;
|
22
|
+
var regCssPosition = /object-position["']*\s*:\s*["']*(.+?)(?=($|,|'|"|;))/;
|
23
|
+
var blankSrc = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
24
|
+
var regBgUrlEscape = /\(|\)|'/;
|
25
|
+
var positionDefaults = {
|
26
|
+
center: 'center',
|
27
|
+
'50% 50%': 'center',
|
28
|
+
};
|
29
|
+
|
30
|
+
function getObject(element){
|
31
|
+
var css = (getComputedStyle(element, null) || {});
|
32
|
+
var content = css.fontFamily || '';
|
33
|
+
var objectFit = content.match(regCssFit) || '';
|
34
|
+
var objectPosition = objectFit && content.match(regCssPosition) || '';
|
35
|
+
|
36
|
+
if(objectPosition){
|
37
|
+
objectPosition = objectPosition[1];
|
38
|
+
}
|
39
|
+
|
40
|
+
return {
|
41
|
+
fit: objectFit && objectFit[1] || '',
|
42
|
+
position: positionDefaults[objectPosition] || objectPosition || 'center',
|
43
|
+
};
|
44
|
+
}
|
45
|
+
|
46
|
+
function initFix(element, config){
|
47
|
+
var switchClassesAdded, addedSrc;
|
48
|
+
var lazysizesCfg = lazySizes.cfg;
|
49
|
+
var styleElement = element.cloneNode(false);
|
50
|
+
var styleElementStyle = styleElement.style;
|
51
|
+
|
52
|
+
var onChange = function(){
|
53
|
+
var src = element.currentSrc || element.src;
|
54
|
+
|
55
|
+
if(src && addedSrc !== src){
|
56
|
+
addedSrc = src;
|
57
|
+
styleElementStyle.backgroundImage = 'url(' + (regBgUrlEscape.test(src) ? JSON.stringify(src) : src ) + ')';
|
58
|
+
|
59
|
+
if(!switchClassesAdded){
|
60
|
+
switchClassesAdded = true;
|
61
|
+
lazySizes.rC(styleElement, lazysizesCfg.loadingClass);
|
62
|
+
lazySizes.aC(styleElement, lazysizesCfg.loadedClass);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
};
|
66
|
+
var rafedOnChange = function(){
|
67
|
+
lazySizes.rAF(onChange);
|
68
|
+
};
|
69
|
+
|
70
|
+
element._lazysizesParentFit = config.fit;
|
71
|
+
|
72
|
+
element.addEventListener('lazyloaded', rafedOnChange, true);
|
73
|
+
element.addEventListener('load', rafedOnChange, true);
|
74
|
+
|
75
|
+
styleElement.addEventListener('load', function(){
|
76
|
+
var curSrc = styleElement.currentSrc || styleElement.src;
|
77
|
+
|
78
|
+
if(curSrc && curSrc != blankSrc){
|
79
|
+
styleElement.src = blankSrc;
|
80
|
+
styleElement.srcset = '';
|
81
|
+
}
|
82
|
+
});
|
83
|
+
|
84
|
+
lazySizes.rAF(function(){
|
85
|
+
|
86
|
+
var hideElement = element;
|
87
|
+
var container = element.parentNode;
|
88
|
+
|
89
|
+
if(container.nodeName.toUpperCase() == 'PICTURE'){
|
90
|
+
hideElement = container;
|
91
|
+
container = container.parentNode;
|
92
|
+
}
|
93
|
+
|
94
|
+
lazySizes.rC(styleElement, lazysizesCfg.loadedClass);
|
95
|
+
lazySizes.rC(styleElement, lazysizesCfg.lazyClass);
|
96
|
+
lazySizes.aC(styleElement, lazysizesCfg.loadingClass);
|
97
|
+
lazySizes.aC(styleElement, lazysizesCfg.objectFitClass || 'lazysizes-display-clone');
|
98
|
+
|
99
|
+
if(styleElement.getAttribute(lazysizesCfg.srcsetAttr)){
|
100
|
+
styleElement.setAttribute(lazysizesCfg.srcsetAttr, '');
|
101
|
+
}
|
102
|
+
|
103
|
+
if(styleElement.getAttribute(lazysizesCfg.srcAttr)){
|
104
|
+
styleElement.setAttribute(lazysizesCfg.srcAttr, '');
|
105
|
+
}
|
106
|
+
|
107
|
+
styleElement.src = blankSrc;
|
108
|
+
styleElement.srcset = '';
|
109
|
+
|
110
|
+
styleElementStyle.backgroundRepeat = 'no-repeat';
|
111
|
+
styleElementStyle.backgroundPosition = config.position;
|
112
|
+
styleElementStyle.backgroundSize = config.fit;
|
113
|
+
|
114
|
+
hideElement.style.display = 'none';
|
115
|
+
|
116
|
+
element.setAttribute('data-parent-fit', config.fit);
|
117
|
+
element.setAttribute('data-parent-container', 'prev');
|
118
|
+
|
119
|
+
container.insertBefore(styleElement, hideElement);
|
120
|
+
|
121
|
+
if(element._lazysizesParentFit){
|
122
|
+
delete element._lazysizesParentFit;
|
123
|
+
}
|
124
|
+
|
125
|
+
if(element.complete){
|
126
|
+
onChange();
|
127
|
+
}
|
128
|
+
});
|
129
|
+
}
|
130
|
+
|
131
|
+
if(!fitSupport || !positionSupport){
|
132
|
+
var onRead = function(e){
|
133
|
+
if(e.detail.instance != lazySizes){return;}
|
134
|
+
|
135
|
+
var element = e.target;
|
136
|
+
var obj = getObject(element);
|
137
|
+
|
138
|
+
if(obj.fit && (!fitSupport || (obj.position != 'center'))){
|
139
|
+
initFix(element, obj);
|
140
|
+
}
|
141
|
+
};
|
142
|
+
|
143
|
+
window.addEventListener('lazyunveilread', onRead, true);
|
144
|
+
|
145
|
+
if(initialEvent && initialEvent.detail){
|
146
|
+
onRead(initialEvent);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}));
|
@@ -0,0 +1,273 @@
|
|
1
|
+
/*
|
2
|
+
This lazySizes extension helps to use responsive images, but to opt-out from too high retina support in case the w descriptor is used (for x descriptor this is not needed!),
|
3
|
+
- data-sizes="auto" has to be used in conjunction
|
4
|
+
|
5
|
+
<img src="100.jpg"
|
6
|
+
data-optimumx="1.8"
|
7
|
+
data-sizes="auto"
|
8
|
+
data-srcset="100.jpg 100w,
|
9
|
+
300.jpg 300w,
|
10
|
+
600.jpg 600w,
|
11
|
+
900.jpg 900w,
|
12
|
+
1200.jpg 1200w"
|
13
|
+
/>
|
14
|
+
|
15
|
+
see a live demo here: http://afarkas.github.io/lazysizes/maxdpr/
|
16
|
+
*/
|
17
|
+
|
18
|
+
(function(window, factory) {
|
19
|
+
var globalInstall = function(){
|
20
|
+
factory(window.lazySizes);
|
21
|
+
window.removeEventListener('lazyunveilread', globalInstall, true);
|
22
|
+
};
|
23
|
+
|
24
|
+
factory = factory.bind(null, window, window.document);
|
25
|
+
|
26
|
+
if(typeof module == 'object' && module.exports){
|
27
|
+
factory(require('lazysizes'));
|
28
|
+
} else if(window.lazySizes) {
|
29
|
+
globalInstall();
|
30
|
+
} else {
|
31
|
+
window.addEventListener('lazyunveilread', globalInstall, true);
|
32
|
+
}
|
33
|
+
}(window, function(window, document, lazySizes) {
|
34
|
+
/*jshint eqnull:true */
|
35
|
+
'use strict';
|
36
|
+
if(!window.addEventListener){return;}
|
37
|
+
|
38
|
+
var config;
|
39
|
+
|
40
|
+
var regPicture = /^picture$/i;
|
41
|
+
var docElem = document.documentElement;
|
42
|
+
|
43
|
+
var parseWsrcset = (function(){
|
44
|
+
var candidates;
|
45
|
+
var reg = /(([^,\s].[^\s]+)\s+(\d+)(w|h)(\s+(\d+)(w|h))?)/g;
|
46
|
+
var addCandidate = function(match, candidate, url, descNumber1, descType1, fullDesc, descNumber2, descType2){
|
47
|
+
candidates.push({
|
48
|
+
c: candidate,
|
49
|
+
u: url,
|
50
|
+
w: (descType2 == 'w' ? descNumber2 : descNumber1) * 1
|
51
|
+
});
|
52
|
+
};
|
53
|
+
|
54
|
+
return function(input){
|
55
|
+
candidates = [];
|
56
|
+
input.replace(reg, addCandidate);
|
57
|
+
return candidates;
|
58
|
+
};
|
59
|
+
})();
|
60
|
+
|
61
|
+
var parseImg = (function(){
|
62
|
+
|
63
|
+
var ascendingSort = function ( a, b ) {
|
64
|
+
return a.w - b.w;
|
65
|
+
};
|
66
|
+
|
67
|
+
var parseSets = function (elem, dataName){
|
68
|
+
var lazyData = {srcset: elem.getAttribute(lazySizes.cfg.srcsetAttr) || ''};
|
69
|
+
var cands = parseWsrcset(lazyData.srcset);
|
70
|
+
Object.defineProperty(elem, dataName, {
|
71
|
+
value: lazyData,
|
72
|
+
writable: true
|
73
|
+
});
|
74
|
+
|
75
|
+
lazyData.cands = cands;
|
76
|
+
|
77
|
+
lazyData.index = 0;
|
78
|
+
lazyData.dirty = false;
|
79
|
+
if(cands[0] && cands[0].w){
|
80
|
+
|
81
|
+
cands.sort( ascendingSort );
|
82
|
+
lazyData.cSrcset = [cands[ lazyData.index ].c];
|
83
|
+
} else {
|
84
|
+
lazyData.cSrcset = lazyData.srcset ? [lazyData.srcset] : [];
|
85
|
+
lazyData.cands = [];
|
86
|
+
}
|
87
|
+
|
88
|
+
return lazyData;
|
89
|
+
};
|
90
|
+
|
91
|
+
return function parseImg(elem, dataName){
|
92
|
+
var sources, i, len, parent;
|
93
|
+
|
94
|
+
|
95
|
+
if(!elem[dataName]){
|
96
|
+
parent = elem.parentNode || {};
|
97
|
+
elem[dataName] = parseSets(elem, dataName);
|
98
|
+
elem[dataName].isImg = true;
|
99
|
+
if(regPicture.test(parent.nodeName || '')){
|
100
|
+
elem[dataName].picture = true;
|
101
|
+
sources = parent.getElementsByTagName('source');
|
102
|
+
for(i = 0, len = sources.length; i < len; i++){
|
103
|
+
parseSets(sources[i], dataName).isImg = false;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
return elem[dataName];
|
109
|
+
};
|
110
|
+
})();
|
111
|
+
|
112
|
+
var constraintFns = {
|
113
|
+
_lazyOptimumx: (function(){
|
114
|
+
var takeHighRes = function (lowerCandidate, higherCandidateResolution, optimumx){
|
115
|
+
var low, bonusFactor, substract;
|
116
|
+
if(!lowerCandidate || !lowerCandidate.d){
|
117
|
+
return true;
|
118
|
+
}
|
119
|
+
|
120
|
+
substract = optimumx > 0.7 ? 0.6 : 0.4;
|
121
|
+
|
122
|
+
if(lowerCandidate.d >= optimumx){return false;}
|
123
|
+
|
124
|
+
bonusFactor = Math.pow(lowerCandidate.d - substract, 1.6) || 0.1;
|
125
|
+
|
126
|
+
if(bonusFactor < 0.1){
|
127
|
+
bonusFactor = 0.1;
|
128
|
+
} else if(bonusFactor > 3){
|
129
|
+
bonusFactor = 3;
|
130
|
+
}
|
131
|
+
|
132
|
+
low = lowerCandidate.d + ((higherCandidateResolution - optimumx) * bonusFactor);
|
133
|
+
|
134
|
+
return low < optimumx;
|
135
|
+
};
|
136
|
+
|
137
|
+
return function (data, width, optimumx){
|
138
|
+
var i, can;
|
139
|
+
|
140
|
+
for(i = 0; i < data.cands.length; i++){
|
141
|
+
can = data.cands[i];
|
142
|
+
can.d = (can.w || 1) / width;
|
143
|
+
|
144
|
+
if(data.index >= i){continue;}
|
145
|
+
|
146
|
+
if(can.d <= optimumx || takeHighRes(data.cands[i - 1], can.d, optimumx)){
|
147
|
+
data.cSrcset.push(can.c);
|
148
|
+
data.index = i;
|
149
|
+
} else {
|
150
|
+
break;
|
151
|
+
}
|
152
|
+
}
|
153
|
+
};
|
154
|
+
})()
|
155
|
+
};
|
156
|
+
|
157
|
+
var constrainSets = (function(){
|
158
|
+
|
159
|
+
var constrainSet = function(elem, displayWidth, optimumx, attr, dataName){
|
160
|
+
var curIndex;
|
161
|
+
var lazyData = elem[dataName];
|
162
|
+
|
163
|
+
if(!lazyData){return;}
|
164
|
+
curIndex = lazyData.index;
|
165
|
+
|
166
|
+
constraintFns[dataName](lazyData, displayWidth, optimumx);
|
167
|
+
|
168
|
+
if(!lazyData.dirty || curIndex != lazyData.index){
|
169
|
+
lazyData.cSrcset.join(', ');
|
170
|
+
elem.setAttribute(attr, lazyData.cSrcset.join(', '));
|
171
|
+
lazyData.dirty = true;
|
172
|
+
}
|
173
|
+
};
|
174
|
+
|
175
|
+
return function(image, displayWidth, optimumx, attr, dataName){
|
176
|
+
var sources, parent, len, i;
|
177
|
+
var lazyData = image[dataName];
|
178
|
+
|
179
|
+
lazyData.width = displayWidth;
|
180
|
+
|
181
|
+
if(lazyData.picture && (parent = image.parentNode)){
|
182
|
+
sources = parent.getElementsByTagName('source');
|
183
|
+
for(i = 0, len = sources.length; i < len; i++){
|
184
|
+
constrainSet(sources[i], displayWidth, optimumx, attr, dataName);
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
constrainSet(image, displayWidth, optimumx, attr, dataName);
|
189
|
+
};
|
190
|
+
})();
|
191
|
+
|
192
|
+
var getOptimumX = function(element){
|
193
|
+
var optimumx = element.getAttribute('data-optimumx') || element.getAttribute('data-maxdpr');
|
194
|
+
|
195
|
+
if(!optimumx && config.constrainPixelDensity){
|
196
|
+
optimumx = 'auto';
|
197
|
+
}
|
198
|
+
|
199
|
+
if(optimumx){
|
200
|
+
if(optimumx == 'auto'){
|
201
|
+
optimumx = config.getOptimumX(element);
|
202
|
+
} else {
|
203
|
+
optimumx = parseFloat(optimumx, 10);
|
204
|
+
}
|
205
|
+
}
|
206
|
+
return optimumx;
|
207
|
+
};
|
208
|
+
|
209
|
+
var extentLazySizes = function(){
|
210
|
+
if(lazySizes && !lazySizes.getOptimumX){
|
211
|
+
lazySizes.getX = getOptimumX;
|
212
|
+
lazySizes.pWS = parseWsrcset;
|
213
|
+
docElem.removeEventListener('lazybeforeunveil', extentLazySizes);
|
214
|
+
}
|
215
|
+
};
|
216
|
+
|
217
|
+
docElem.addEventListener('lazybeforeunveil', extentLazySizes);
|
218
|
+
setTimeout(extentLazySizes);
|
219
|
+
|
220
|
+
config = (lazySizes && lazySizes.cfg) || window.lazySizesConfig;
|
221
|
+
|
222
|
+
if(!config){
|
223
|
+
config = {};
|
224
|
+
window.lazySizesConfig = config;
|
225
|
+
}
|
226
|
+
|
227
|
+
if(typeof config.getOptimumX != 'function'){
|
228
|
+
config.getOptimumX = function(/*element*/){
|
229
|
+
var dpr = window.devicePixelRatio || 1;
|
230
|
+
if(dpr > 2.6){
|
231
|
+
dpr *= 0.6; // returns 1.8 for 3
|
232
|
+
} else if(dpr > 1.9){
|
233
|
+
dpr *= 0.8; // returns 1.6 for 2
|
234
|
+
} else {
|
235
|
+
dpr -= 0.01; // returns 0.99 for 1
|
236
|
+
}
|
237
|
+
return Math.min(Math.round(dpr * 100) / 100, 2);
|
238
|
+
};
|
239
|
+
}
|
240
|
+
|
241
|
+
if(!window.devicePixelRatio){return;}
|
242
|
+
|
243
|
+
addEventListener('lazybeforesizes', function(e){
|
244
|
+
if(e.detail.instance != lazySizes){return;}
|
245
|
+
|
246
|
+
var optimumx, lazyData, width, attr;
|
247
|
+
|
248
|
+
var elem = e.target;
|
249
|
+
var detail = e.detail;
|
250
|
+
var dataAttr = detail.dataAttr;
|
251
|
+
|
252
|
+
if(e.defaultPrevented ||
|
253
|
+
!(optimumx = getOptimumX(elem)) ||
|
254
|
+
optimumx >= devicePixelRatio){return;}
|
255
|
+
|
256
|
+
if(dataAttr && elem._lazyOptimumx && !detail.reloaded && (!config.unloadedClass || !lazySizes.hC(elem, config.unloadedClass))){
|
257
|
+
elem._lazyOptimumx = null;
|
258
|
+
}
|
259
|
+
|
260
|
+
lazyData = parseImg(elem, '_lazyOptimumx');
|
261
|
+
|
262
|
+
width = detail.width;
|
263
|
+
|
264
|
+
if(width && (lazyData.width || 0) < width){
|
265
|
+
attr = dataAttr ? lazySizes.cfg.srcsetAttr : 'srcset';
|
266
|
+
|
267
|
+
lazySizes.rAF(function(){
|
268
|
+
constrainSets(elem, width, optimumx, attr, '_lazyOptimumx');
|
269
|
+
});
|
270
|
+
}
|
271
|
+
});
|
272
|
+
|
273
|
+
}));
|
@@ -0,0 +1,157 @@
|
|
1
|
+
(function(window, factory) {
|
2
|
+
var globalInstall = function(){
|
3
|
+
factory(window.lazySizes);
|
4
|
+
window.removeEventListener('lazyunveilread', globalInstall, true);
|
5
|
+
};
|
6
|
+
|
7
|
+
factory = factory.bind(null, window, window.document);
|
8
|
+
|
9
|
+
if(typeof module == 'object' && module.exports){
|
10
|
+
factory(require('lazysizes'));
|
11
|
+
} else if(window.lazySizes) {
|
12
|
+
globalInstall();
|
13
|
+
} else {
|
14
|
+
window.addEventListener('lazyunveilread', globalInstall, true);
|
15
|
+
}
|
16
|
+
}(window, function(window, document, lazySizes) {
|
17
|
+
'use strict';
|
18
|
+
|
19
|
+
if(!window.addEventListener){return;}
|
20
|
+
|
21
|
+
var regDescriptors = /\s+(\d+)(w|h)\s+(\d+)(w|h)/;
|
22
|
+
var regCssFit = /parent-fit["']*\s*:\s*["']*(contain|cover|width)/;
|
23
|
+
var regCssObject = /parent-container["']*\s*:\s*["']*(.+?)(?=(\s|$|,|'|"|;))/;
|
24
|
+
var regPicture = /^picture$/i;
|
25
|
+
|
26
|
+
var getCSS = function (elem){
|
27
|
+
return (getComputedStyle(elem, null) || {});
|
28
|
+
};
|
29
|
+
|
30
|
+
var parentFit = {
|
31
|
+
|
32
|
+
getParent: function(element, parentSel){
|
33
|
+
var parent = element;
|
34
|
+
var parentNode = element.parentNode;
|
35
|
+
|
36
|
+
if((!parentSel || parentSel == 'prev') && parentNode && regPicture.test(parentNode.nodeName || '')){
|
37
|
+
parentNode = parentNode.parentNode;
|
38
|
+
}
|
39
|
+
|
40
|
+
if(parentSel != 'self'){
|
41
|
+
if(parentSel == 'prev'){
|
42
|
+
parent = element.previousElementSibling;
|
43
|
+
} else if(parentSel && (parentNode.closest || window.jQuery)){
|
44
|
+
parent = (parentNode.closest ?
|
45
|
+
parentNode.closest(parentSel) :
|
46
|
+
jQuery(parentNode).closest(parentSel)[0]) ||
|
47
|
+
parentNode
|
48
|
+
;
|
49
|
+
} else {
|
50
|
+
parent = parentNode;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
return parent;
|
55
|
+
},
|
56
|
+
|
57
|
+
getFit: function(element){
|
58
|
+
var tmpMatch, parentObj;
|
59
|
+
var css = getCSS(element);
|
60
|
+
var content = css.content || css.fontFamily;
|
61
|
+
var obj = {
|
62
|
+
fit: element._lazysizesParentFit || element.getAttribute('data-parent-fit')
|
63
|
+
};
|
64
|
+
|
65
|
+
if(!obj.fit && content && (tmpMatch = content.match(regCssFit))){
|
66
|
+
obj.fit = tmpMatch[1];
|
67
|
+
}
|
68
|
+
|
69
|
+
if(obj.fit){
|
70
|
+
parentObj = element._lazysizesParentContainer || element.getAttribute('data-parent-container');
|
71
|
+
|
72
|
+
if(!parentObj && content && (tmpMatch = content.match(regCssObject))){
|
73
|
+
parentObj = tmpMatch[1];
|
74
|
+
}
|
75
|
+
|
76
|
+
obj.parent = parentFit.getParent(element, parentObj);
|
77
|
+
|
78
|
+
|
79
|
+
} else {
|
80
|
+
obj.fit = css.objectFit;
|
81
|
+
}
|
82
|
+
|
83
|
+
return obj;
|
84
|
+
},
|
85
|
+
|
86
|
+
getImageRatio: function(element){
|
87
|
+
var i, srcset, media, ratio, match;
|
88
|
+
var parent = element.parentNode;
|
89
|
+
var elements = parent && regPicture.test(parent.nodeName || '') ?
|
90
|
+
parent.querySelectorAll('source, img') :
|
91
|
+
[element]
|
92
|
+
;
|
93
|
+
|
94
|
+
for(i = 0; i < elements.length; i++){
|
95
|
+
element = elements[i];
|
96
|
+
srcset = element.getAttribute(lazySizesConfig.srcsetAttr) || element.getAttribute('srcset') || element.getAttribute('data-pfsrcset') || element.getAttribute('data-risrcset') || '';
|
97
|
+
media = element._lsMedia || element.getAttribute('media');
|
98
|
+
media = lazySizesConfig.customMedia[element.getAttribute('data-media') || media] || media;
|
99
|
+
|
100
|
+
if(srcset && (!media || (window.matchMedia && matchMedia(media) || {}).matches )){
|
101
|
+
ratio = parseFloat(element.getAttribute('data-aspectratio'));
|
102
|
+
|
103
|
+
if(!ratio && (match = srcset.match(regDescriptors))){
|
104
|
+
if(match[2] == 'w'){
|
105
|
+
ratio = match[1] / match[3];
|
106
|
+
} else {
|
107
|
+
ratio = match[3] / match[1];
|
108
|
+
}
|
109
|
+
}
|
110
|
+
break;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
return ratio;
|
115
|
+
},
|
116
|
+
|
117
|
+
calculateSize: function(element, width){
|
118
|
+
var displayRatio, height, imageRatio, retWidth;
|
119
|
+
var fitObj = this.getFit(element);
|
120
|
+
var fit = fitObj.fit;
|
121
|
+
var fitElem = fitObj.parent;
|
122
|
+
|
123
|
+
if(fit != 'width' && ((fit != 'contain' && fit != 'cover') || !(imageRatio = this.getImageRatio(element)))){
|
124
|
+
return width;
|
125
|
+
}
|
126
|
+
|
127
|
+
if(fitElem){
|
128
|
+
width = fitElem.clientWidth;
|
129
|
+
} else {
|
130
|
+
fitElem = element;
|
131
|
+
}
|
132
|
+
|
133
|
+
retWidth = width;
|
134
|
+
|
135
|
+
if(fit == 'width'){
|
136
|
+
retWidth = width;
|
137
|
+
} else {
|
138
|
+
height = fitElem.clientHeight;
|
139
|
+
|
140
|
+
if(height > 40 && (displayRatio = width / height) && ((fit == 'cover' && displayRatio < imageRatio) || (fit == 'contain' && displayRatio > imageRatio))){
|
141
|
+
retWidth = width * (imageRatio / displayRatio);
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
return retWidth;
|
146
|
+
}
|
147
|
+
};
|
148
|
+
|
149
|
+
lazySizes.parentFit = parentFit;
|
150
|
+
|
151
|
+
document.addEventListener('lazybeforesizes', function(e){
|
152
|
+
if(e.defaultPrevented || e.detail.instance != lazySizes){return;}
|
153
|
+
|
154
|
+
var element = e.target;
|
155
|
+
e.detail.width = parentFit.calculateSize(element, e.detail.width);
|
156
|
+
});
|
157
|
+
}));
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/*
|
2
|
+
This lazySizes extension adds better support for print.
|
3
|
+
In case the user starts to print lazysizes will load all images.
|
4
|
+
*/
|
5
|
+
(function(window, factory) {
|
6
|
+
var globalInstall = function(){
|
7
|
+
factory(window.lazySizes);
|
8
|
+
window.removeEventListener('lazyunveilread', globalInstall, true);
|
9
|
+
};
|
10
|
+
|
11
|
+
factory = factory.bind(null, window, window.document);
|
12
|
+
|
13
|
+
if(typeof module == 'object' && module.exports){
|
14
|
+
factory(require('lazysizes'));
|
15
|
+
} else if(window.lazySizes) {
|
16
|
+
globalInstall();
|
17
|
+
} else {
|
18
|
+
window.addEventListener('lazyunveilread', globalInstall, true);
|
19
|
+
}
|
20
|
+
}(window, function(window, document, lazySizes) {
|
21
|
+
/*jshint eqnull:true */
|
22
|
+
'use strict';
|
23
|
+
var config, elements, onprint, printMedia;
|
24
|
+
// see also: http://tjvantoll.com/2012/06/15/detecting-print-requests-with-javascript/
|
25
|
+
if(window.addEventListener){
|
26
|
+
config = (lazySizes && lazySizes.cfg) || window.lazySizesConfig || {};
|
27
|
+
elements = config.lazyClass || 'lazyload';
|
28
|
+
onprint = function(){
|
29
|
+
var i, len;
|
30
|
+
if(typeof elements == 'string'){
|
31
|
+
elements = document.getElementsByClassName(elements);
|
32
|
+
}
|
33
|
+
|
34
|
+
if(lazySizes){
|
35
|
+
for(i = 0, len = elements.length; i < len; i++){
|
36
|
+
lazySizes.loader.unveil(elements[i]);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
};
|
40
|
+
|
41
|
+
addEventListener('beforeprint', onprint, false);
|
42
|
+
|
43
|
+
if(!('onbeforeprint' in window) && window.matchMedia && (printMedia = matchMedia('print')) && printMedia.addListener){
|
44
|
+
printMedia.addListener(function(){
|
45
|
+
if(printMedia.matches){
|
46
|
+
onprint();
|
47
|
+
}
|
48
|
+
});
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}));
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/*
|
2
|
+
This lazysizes plugin optimizes perceived performance by adding better support for rendering progressive JPGs/PNGs in conjunction with the LQIP pattern.
|
3
|
+
*/
|
4
|
+
(function(window, factory) {
|
5
|
+
var globalInstall = function(){
|
6
|
+
factory(window.lazySizes);
|
7
|
+
window.removeEventListener('lazyunveilread', globalInstall, true);
|
8
|
+
};
|
9
|
+
|
10
|
+
factory = factory.bind(null, window, window.document);
|
11
|
+
|
12
|
+
if(typeof module == 'object' && module.exports){
|
13
|
+
factory(require('lazysizes'));
|
14
|
+
} else if(window.lazySizes) {
|
15
|
+
globalInstall();
|
16
|
+
} else {
|
17
|
+
window.addEventListener('lazyunveilread', globalInstall, true);
|
18
|
+
}
|
19
|
+
}(window, function(window, document, lazySizes) {
|
20
|
+
/*jshint eqnull:true */
|
21
|
+
'use strict';
|
22
|
+
var regImg, onLoad;
|
23
|
+
|
24
|
+
if('srcset' in document.createElement('img')){
|
25
|
+
regImg = /^img$/i;
|
26
|
+
|
27
|
+
onLoad = function(e){
|
28
|
+
e.target.style.backgroundSize = '';
|
29
|
+
e.target.style.backgroundImage = '';
|
30
|
+
e.target.removeEventListener(e.type, onLoad);
|
31
|
+
};
|
32
|
+
|
33
|
+
document.addEventListener('lazybeforeunveil', function(e){
|
34
|
+
if(e.detail.instance != lazySizes){return;}
|
35
|
+
|
36
|
+
var img = e.target;
|
37
|
+
if(!regImg.test(img.nodeName)){
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
var src = img.getAttribute('src');
|
41
|
+
if(src) {
|
42
|
+
img.style.backgroundSize = '100% 100%';
|
43
|
+
img.style.backgroundImage = 'url(' + src + ')';
|
44
|
+
img.removeAttribute('src');
|
45
|
+
img.addEventListener('load', onLoad);
|
46
|
+
}
|
47
|
+
}, false);
|
48
|
+
}
|
49
|
+
}));
|