chore(lib): update lazysizes 5.2.2 -> 5.3.1

This commit is contained in:
Dillon 2022-05-07 03:07:32 +08:00
parent 26632740ed
commit ddf73c2cce
No known key found for this signature in database
GPG key ID: 0EF4AE57FB98F108
5 changed files with 11 additions and 5 deletions

View file

@ -17,8 +17,9 @@ libFiles:
lunrJS: lunr@2.3.9/lunr.min.js
# algoliasearch@4.2.0 https://github.com/algolia/algoliasearch-client-javascript
algoliasearchJS: algoliasearch@4.2.0/dist/algoliasearch-lite.umd.min.js
# lazysizes@5.2.2 https://github.com/aFarkas/lazysizes
lazysizesJS: lazysizes@5.2.2/lazysizes.min.js
# lazysizes@5.3.1 https://github.com/aFarkas/lazysizes
lazysizesJS: lazysizes@5.3.1/lazysizes.min.js
lazysizesParentFitJS: lazysizes@5.3.1/plugins/parent-fit/ls.parent-fit.min.js
# object-fit-images@3.2.4 https://github.com/fregante/object-fit-images
objectFitImagesJS: object-fit-images@3.2.4/dist/ofi.min.js
# twemoji@13.0.0 https://github.com/twitter/twemoji

View file

@ -6,7 +6,7 @@ smooth-scroll@16.1.3 https://github.com/cferdinandi/smooth-scroll
autocomplete@0.38.1 https://github.com/algolia/autocomplete
lunr.js@2.3.9 https://lunrjs.com/
algoliasearch@4.2.0 https://github.com/algolia/algoliasearch-client-javascript
lazysizes@5.2.2 https://github.com/aFarkas/lazysizes
lazysizes@5.3.1 https://github.com/aFarkas/lazysizes
object-fit-images@3.2.4 https://github.com/fregante/object-fit-images
twemoji@13.0.0 https://github.com/twitter/twemoji
lightgallery.js@1.2.0 https://github.com/sachinchoolur/lightgallery.js

File diff suppressed because one or more lines are too long

3
assets/lib/lazysizes/ls.parent-fit.min.js vendored Executable file
View file

@ -0,0 +1,3 @@
/*! lazysizes - v5.3.1 */
!function(t,e){var i;t&&(i=function(){e(t.lazySizes),t.removeEventListener("lazyunveilread",i,!0)},e=e.bind(null,t,t.document),"object"==typeof module&&module.exports?e(require("lazysizes")):"function"==typeof define&&define.amd?define(["lazysizes"],e):t.lazySizes?i():t.addEventListener("lazyunveilread",i,!0))}("undefined"!=typeof window?window:0,function(u,t,i){"use strict";var l,s,d,f,g,o;u.addEventListener&&(l=/\s+(\d+)(w|h)\s+(\d+)(w|h)/,s=/parent-fit["']*\s*:\s*["']*(contain|cover|width)/,d=/parent-container["']*\s*:\s*["']*(.+?)(?=(\s|$|,|'|"|;))/,f=/^picture$/i,g=i.cfg,o={getParent:function(t,e){var i=t,a=t.parentNode;return e&&"prev"!=e||!a||!f.test(a.nodeName||"")||(a=a.parentNode),"self"!=e&&(i="prev"==e?t.previousElementSibling:e&&(a.closest||u.jQuery)&&(a.closest?a.closest(e):jQuery(a).closest(e)[0])||a),i},getFit:function(t){var e,i,a=getComputedStyle(t,null)||{},n=a.content||a.fontFamily,r={fit:t._lazysizesParentFit||t.getAttribute("data-parent-fit")};return!r.fit&&n&&(e=n.match(s))&&(r.fit=e[1]),r.fit?(!(i=t._lazysizesParentContainer||t.getAttribute("data-parent-container"))&&n&&(e=n.match(d))&&(i=e[1]),r.parent=o.getParent(t,i)):r.fit=a.objectFit,r},getImageRatio:function(t){for(var e,i,a,n,r,s,d=t.parentNode,o=d&&f.test(d.nodeName||"")?d.querySelectorAll("source, img"):[t],c=0;c<o.length;c++)if(e=(t=o[c]).getAttribute(g.srcsetAttr)||t.getAttribute("srcset")||t.getAttribute("data-pfsrcset")||t.getAttribute("data-risrcset")||"",i=t._lsMedia||t.getAttribute("media"),i=g.customMedia[t.getAttribute("data-media")||i]||i,e&&(!i||(u.matchMedia&&matchMedia(i)||{}).matches)){(a=parseFloat(t.getAttribute("data-aspectratio")))||(s=(n=e.match(l))?"w"==n[2]?(r=n[1],n[3]):(r=n[3],n[1]):(r=t.getAttribute("width"),t.getAttribute("height")),a=r/s);break}return a},calculateSize:function(t,e){var i,a,n,r=this.getFit(t),s=r.fit,d=r.parent;return"width"==s||("contain"==s||"cover"==s)&&(a=this.getImageRatio(t))?(d?e=d.clientWidth:d=t,n=e,"width"==s?n=e:(i=e/d.clientHeight)&&("cover"==s&&i<a||"contain"==s&&a<i)&&(n=e*(a/i)),n):e}},i.parentFit=o,t.addEventListener("lazybeforesizes",function(t){var e;t.defaultPrevented||t.detail.instance!=i||(e=t.target,t.detail.width=o.calculateSize(e,t.detail.width))}))});

View file

@ -37,6 +37,8 @@
{{- /* lazysizes */ -}}
{{- $source := $cdn.lazysizesJS | default "lib/lazysizes/lazysizes.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $source := $cdn.lazysizesParentFitJS | default "lib/lazysizes/ls.parent-fit.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- /* twemoji */ -}}
{{- if $params.twemoji -}}