From b7edb5007dd7502f7ce8f2539e166c166b866f99 Mon Sep 17 00:00:00 2001
From: nobody42 <5514211-nobody42@users.noreply.gitlab.com>
Date: Thu, 26 Mar 2020 07:33:27 +0100
Subject: [PATCH] Added lazysizes v4.1.8
---
core/files.js | 3 +++
core/mappings.js | 1 +
core/resources.js | 5 +++++
modules/internal/helpers.js | 4 ++++
pages/updates/updates.html | 1 +
resources/lazysizes/4.1.8/lazysizes.min.jsm | 2 ++
6 files changed, 16 insertions(+)
create mode 100644 resources/lazysizes/4.1.8/lazysizes.min.jsm
diff --git a/core/files.js b/core/files.js
index bffa745a..9f1f8e23 100644
--- a/core/files.js
+++ b/core/files.js
@@ -86,6 +86,9 @@ var files = {
// jQuery UI
'resources/jqueryui/1.11.4/jquery-ui.min.jsm': true,
+ // lazysizes
+ 'resources/lazysizes/4.1.8/lazysizes.min.jsm': true,
+
// lozad.js
'resources/lozad.js/1.14.0/lozad.min.jsm': true,
diff --git a/core/mappings.js b/core/mappings.js
index 337f42aa..6a8505cf 100644
--- a/core/mappings.js
+++ b/core/mappings.js
@@ -80,6 +80,7 @@ var mappings = {
'jquery/{version}/jquery.min.': resources.jQuery,
'jqueryui/{version}/jquery-ui.js': resources.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': resources.jQueryUI,
+ 'lazysizes/{version}/lazysizes.min.js': resources.lazysizes,
'modernizr/{version}/modernizr.': resources.modernizr,
'moment.js/{version}/moment.': resources.moment,
'moment.js/{version}/moment.min.': resources.moment,
diff --git a/core/resources.js b/core/resources.js
index d03dd17c..87c419d3 100644
--- a/core/resources.js
+++ b/core/resources.js
@@ -109,6 +109,11 @@ var resources = {
'path': 'resources/jqueryui/{version}/jquery-ui.min.jsm',
'type': 'application/javascript'
},
+ // lazysizes
+ 'lazysizes': {
+ 'path': 'resources/lazysizes/{version}/lazysizes.min.jsm',
+ 'type': 'application/javascript'
+ },
// lozad.js
'lozad': {
'path': 'resources/lozad.js/{version}/lozad.min.jsm',
diff --git a/modules/internal/helpers.js b/modules/internal/helpers.js
index f5754304..8ccc159e 100644
--- a/modules/internal/helpers.js
+++ b/modules/internal/helpers.js
@@ -232,6 +232,8 @@ helpers.determineResourceName = function (filename) {
return 'jQuery';
case 'jquery-ui.min.jsm':
return 'jQuery UI';
+ case 'lazysizes.min.jsm':
+ return 'lazysizes';
case 'lozad.min.jsm':
return 'lozad.js';
case 'modernizr.min.jsm':
@@ -356,6 +358,8 @@ helpers.setLastVersion = function (type, versionNumber) {
version = '3.4.1';
} else if (type.includes('/jqueryui/1.')) {
version = '1.11.4';
+ } else if (type.includes('lazysizes/4.')) {
+ version = '4.1.8';
} else if (type.includes('lozad')) {
version = '1.14.0';
} else if (type.includes('/modernizr/2.')) {
diff --git a/pages/updates/updates.html b/pages/updates/updates.html
index 5107c13b..9f97320a 100644
--- a/pages/updates/updates.html
+++ b/pages/updates/updates.html
@@ -28,6 +28,7 @@
Fixed Twitter Bootstrap CSS & JS v3.4.1
Added toastr.js v2.1.4
Added WOW v1.1.2
+ Added lazysizes v4.1.8
Please update your uBlock/uMatrix rules
diff --git a/resources/lazysizes/4.1.8/lazysizes.min.jsm b/resources/lazysizes/4.1.8/lazysizes.min.jsm
new file mode 100644
index 00000000..5c19061c
--- /dev/null
+++ b/resources/lazysizes/4.1.8/lazysizes.min.jsm
@@ -0,0 +1,2 @@
+/*! lazysizes - v4.1.8 */
+!function(a,b){var c=b(a,a.document);a.lazySizes=c,"object"==typeof module&&module.exports&&(module.exports=c)}(window,function(a,b){"use strict";if(b.getElementsByClassName){var c,d,e=b.documentElement,f=a.Date,g=a.HTMLPictureElement,h="addEventListener",i="getAttribute",j=a[h],k=a.setTimeout,l=a.requestAnimationFrame||k,m=a.requestIdleCallback,n=/^picture$/i,o=["load","error","lazyincluded","_lazyloaded"],p={},q=Array.prototype.forEach,r=function(a,b){return p[b]||(p[b]=new RegExp("(\\s|^)"+b+"(\\s|$)")),p[b].test(a[i]("class")||"")&&p[b]},s=function(a,b){r(a,b)||a.setAttribute("class",(a[i]("class")||"").trim()+" "+b)},t=function(a,b){var c;(c=r(a,b))&&a.setAttribute("class",(a[i]("class")||"").replace(c," "))},u=function(a,b,c){var d=c?h:"removeEventListener";c&&u(a,b),o.forEach(function(c){a[d](c,b)})},v=function(a,d,e,f,g){var h=b.createEvent("Event");return e||(e={}),e.instance=c,h.initEvent(d,!f,!g),h.detail=e,a.dispatchEvent(h),h},w=function(b,c){var e;!g&&(e=a.picturefill||d.pf)?(c&&c.src&&!b[i]("srcset")&&b.setAttribute("srcset",c.src),e({reevaluate:!0,elements:[b]})):c&&c.src&&(b.src=c.src)},x=function(a,b){return(getComputedStyle(a,null)||{})[b]},y=function(a,b,c){for(c=c||a.offsetWidth;c
49?function(){m(h,{timeout:g}),g!==d.ricTimeout&&(g=d.ricTimeout)}:A(function(){k(h)},!0);return function(a){var d;(a=!0===a)&&(g=33),b||(b=!0,d=e-(f.now()-c),d<0&&(d=0),a||d<9?i():k(i,d))}},C=function(a){var b,c,d=99,e=function(){b=null,a()},g=function(){var a=f.now()-c;a0)&&"visible"!=x(f,"overflow")&&(d=f.getBoundingClientRect(),g=H>d.left&&Gd.top-1&&F500&&e.clientWidth>500?500:370:d.expand,c._defEx=r,s=r*d.expFactor,t=d.hFac,J=null,O2&&o>2&&!b.hidden?(O=s,Q=0):O=o>1&&Q>1&&P<6?r:N;f=n&&(F=h.top)<=D&&(H=h.right)>=n*t&&(G=h.left)<=y&&(I||H||G||F)&&(d.loadHidden||S(u[f]))&&(l&&P<3&&!p&&(o<3||Q<4)||T(u[f],m))){if(aa(u[f]),k=!0,P>9)break}else!k&&l&&!j&&P<4&&Q<4&&o>2&&(g[0]||d.preloadAfterLoad)&&(g[0]||!p&&(I||H||G||F||"auto"!=u[f][i](d.sizesAttr)))&&(j=g[0]||u[f]);else aa(u[f]);j&&!k&&aa(j)}},V=B(U),W=function(a){var b=a.target;if(b._lazyCache)return void delete b._lazyCache;R(a),s(b,d.loadedClass),t(b,d.loadingClass),u(b,Y),v(b,"lazyloaded")},X=A(W),Y=function(a){X({target:a.target})},Z=function(a,b){try{a.contentWindow.location.replace(b)}catch(c){a.src=b}},$=function(a){var b,c=a[i](d.srcsetAttr);(b=d.customMedia[a[i]("data-media")||a[i]("media")])&&a.setAttribute("media",b),c&&a.setAttribute("srcset",c)},_=A(function(a,b,c,e,f){var g,h,j,l,o,p;(o=v(a,"lazybeforeunveil",b)).defaultPrevented||(e&&(c?s(a,d.autosizesClass):a.setAttribute("sizes",e)),h=a[i](d.srcsetAttr),g=a[i](d.srcAttr),f&&(j=a.parentNode,l=j&&n.test(j.nodeName||"")),p=b.firesLoad||"src"in a&&(h||g||l),o={target:a},s(a,d.loadingClass),p&&(clearTimeout(m),m=k(R,2500),u(a,Y,!0)),l&&q.call(j.getElementsByTagName("source"),$),h?a.setAttribute("srcset",h):g&&!l&&(L.test(a.nodeName)?Z(a,g):a.src=g),f&&(h||l)&&w(a,{src:g})),a._lazyRace&&delete a._lazyRace,t(a,d.lazyClass),z(function(){var b=a.complete&&a.naturalWidth>1;p&&!b||(b&&s(a,"ls-is-cached"),W(o),a._lazyCache=!0,k(function(){"_lazyCache"in a&&delete a._lazyCache},9))},!0)}),aa=function(a){var b,c=K.test(a.nodeName),e=c&&(a[i](d.sizesAttr)||a[i]("sizes")),f="auto"==e;(!f&&l||!c||!a[i]("src")&&!a.srcset||a.complete||r(a,d.errorClass)||!r(a,d.lazyClass))&&(b=v(a,"lazyunveilread").detail,f&&E.updateElem(a,!0,a.offsetWidth),a._lazyRace=!0,P++,_(a,b,f,e,c))},ba=function(){if(!l){if(f.now()-p<999)return void k(ba,999);var a=C(function(){d.loadMode=3,V()});l=!0,d.loadMode=3,V(),j("scroll",function(){3==d.loadMode&&(d.loadMode=2),a()},!0)}};return{_:function(){p=f.now(),c.elements=b.getElementsByClassName(d.lazyClass),g=b.getElementsByClassName(d.lazyClass+" "+d.preloadClass),j("scroll",V,!0),j("resize",V,!0),a.MutationObserver?new MutationObserver(V).observe(e,{childList:!0,subtree:!0,attributes:!0}):(e[h]("DOMNodeInserted",V,!0),e[h]("DOMAttrModified",V,!0),setInterval(V,999)),j("hashchange",V,!0),["focus","mouseover","click","load","transitionend","animationend","webkitAnimationEnd"].forEach(function(a){b[h](a,V,!0)}),/d$|^c/.test(b.readyState)?ba():(j("load",ba),b[h]("DOMContentLoaded",V),k(ba,2e4)),c.elements.length?(U(),z._lsFlush()):V()},checkElems:V,unveil:aa}}(),E=function(){var a,c=A(function(a,b,c,d){var e,f,g;if(a._lazysizesWidth=d,d+="px",a.setAttribute("sizes",d),n.test(b.nodeName||""))for(e=b.getElementsByTagName("source"),f=0,g=e.length;f