novicell-lazyload
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -1,4 +0,6 @@ | ||
parcelRequire=function(e,r,n,t){var i="function"==typeof parcelRequire&&parcelRequire,o="function"==typeof require&&require;function u(n,t){if(!r[n]){if(!e[n]){var f="function"==typeof parcelRequire&&parcelRequire;if(!t&&f)return f(n,!0);if(i)return i(n,!0);if(o&&"string"==typeof n)return o(n);var c=new Error("Cannot find module '"+n+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[n][1][r]||r},p.cache={};var l=r[n]=new u.Module(n);e[n][0].call(l.exports,p,l,l.exports,this)}return r[n].exports;function p(e){return u(p.resolve(e))}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=r,u.parent=i,u.register=function(r,n){e[r]=[function(e,r){r.exports=n},{}]};for(var f=0;f<n.length;f++)u(n[f]);if(n.length){var c=u(n[n.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):t&&(this[t]=c)}return u}({"c8dR":[function(require,module,exports) { | ||
!function(t,e){var i=function(t,e){"use strict";if(!e.getElementsByClassName)return;var i,n,a=e.documentElement,r=t.Date,s=t.HTMLPictureElement,o=t.addEventListener,l=t.setTimeout,d=t.requestAnimationFrame||l,u=t.requestIdleCallback,c=/^picture$/i,f=["load","error","lazyincluded","_lazyloaded"],m={},g=Array.prototype.forEach,v=function(t,e){return m[e]||(m[e]=new RegExp("(\\s|^)"+e+"(\\s|$)")),m[e].test(t.getAttribute("class")||"")&&m[e]},z=function(t,e){v(t,e)||t.setAttribute("class",(t.getAttribute("class")||"").trim()+" "+e)},y=function(t,e){var i;(i=v(t,e))&&t.setAttribute("class",(t.getAttribute("class")||"").replace(i," "))},h=function(t,e,i){var n=i?"addEventListener":"removeEventListener";i&&h(t,e),f.forEach(function(i){t[n](i,e)})},b=function(t,n,a,r,s){var o=e.createEvent("CustomEvent");return a||(a={}),a.instance=i,o.initCustomEvent(n,!r,!s,a),t.dispatchEvent(o),o},p=function(e,i){var a;!s&&(a=t.picturefill||n.pf)?a({reevaluate:!0,elements:[e]}):i&&i.src&&(e.src=i.src)},A=function(t,e){return(getComputedStyle(t,null)||{})[e]},C=function(t,e,i){for(i=i||t.offsetWidth;i<n.minSize&&e&&!t._lazysizesWidth;)i=e.offsetWidth,e=e.parentNode;return i},E=(L=[],W=[],x=L,T=function(){var t=x;for(x=L.length?W:L,N=!0,_=!1;t.length;)t.shift()();N=!1},B=function(t,i){N&&!i?t.apply(this,arguments):(x.push(t),_||(_=!0,(e.hidden?l:d)(T)))},B._lsFlush=T,B),w=function(t,e){return e?function(){E(t)}:function(){var e=this,i=arguments;E(function(){t.apply(e,i)})}},M=function(t){var e,i,n=function(){e=null,t()},a=function(){var t=r.now()-i;t<99?l(a,99-t):(u||n)(n)};return function(){i=r.now(),e||(e=l(a,99))}};var N,_,L,W,x,T,B;!function(){var e,i={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:300};for(e in n=t.lazySizesConfig||t.lazysizesConfig||{},i)e in n||(n[e]=i[e]);t.lazySizesConfig=n,l(function(){n.init&&R()})}();var F=function(){var s,d,f,m,C,N,_,L,W,x,T,B,F,R,k,H,O,P,$,D,I=/^img$/i,q=/^iframe$/i,j="onscroll"in t&&!/glebot/.test(navigator.userAgent),G=0,J=0,K=-1,Q=function(t){J--,t&&t.target&&h(t.target,Q),(!t||J<0||!t.target)&&(J=0)},U=function(t,i){var n,r=t,s="hidden"==A(e.body,"visibility")||"hidden"!=A(t,"visibility");for(L-=i,T+=i,W-=i,x+=i;s&&(r=r.offsetParent)&&r!=e.body&&r!=a;)(s=(A(r,"opacity")||1)>0)&&"visible"!=A(r,"overflow")&&(n=r.getBoundingClientRect(),s=x>n.left&&W<n.right&&T>n.top-1&&L<n.bottom+1);return s},V=function(){var t,r,o,l,u,c,f,g,v,z=i.elements;if((m=n.loadMode)&&J<8&&(t=z.length)){r=0,K++,null==F&&("expand"in n||(n.expand=a.clientHeight>500&&a.clientWidth>500?500:370),B=n.expand,F=B*n.expFactor),G<F&&J<1&&K>2&&m>2&&!e.hidden?(G=F,K=0):G=m>1&&K>1&&J<6?B:0;for(;r<t;r++)if(z[r]&&!z[r]._lazyRace)if(j)if((g=z[r].getAttribute("data-expand"))&&(c=1*g)||(c=G),v!==c&&(N=innerWidth+c*R,_=innerHeight+c,f=-1*c,v=c),o=z[r].getBoundingClientRect(),(T=o.bottom)>=f&&(L=o.top)<=_&&(x=o.right)>=f*R&&(W=o.left)<=N&&(T||x||W||L)&&(n.loadHidden||"hidden"!=A(z[r],"visibility"))&&(d&&J<3&&!g&&(m<3||K<4)||U(z[r],c))){if(nt(z[r]),u=!0,J>9)break}else!u&&d&&!l&&J<4&&K<4&&m>2&&(s[0]||n.preloadAfterLoad)&&(s[0]||!g&&(T||x||W||L||"auto"!=z[r].getAttribute(n.sizesAttr)))&&(l=s[0]||z[r]);else nt(z[r]);l&&!u&&nt(l)}},X=(k=V,O=0,P=n.ricTimeout,$=function(){H=!1,O=r.now(),k()},D=u&&n.ricTimeout?function(){u($,{timeout:P}),P!==n.ricTimeout&&(P=n.ricTimeout)}:w(function(){l($)},!0),function(t){var e;(t=!0===t)&&(P=33),H||(H=!0,(e=125-(r.now()-O))<0&&(e=0),t||e<9&&u?D():l(D,e))}),Y=function(t){z(t.target,n.loadedClass),y(t.target,n.loadingClass),h(t.target,tt),b(t.target,"lazyloaded")},Z=w(Y),tt=function(t){Z({target:t.target})},et=function(t){var e,i=t.getAttribute(n.srcsetAttr);(e=n.customMedia[t.getAttribute("data-media")||t.getAttribute("media")])&&t.setAttribute("media",e),i&&t.setAttribute("srcset",i)},it=w(function(t,e,i,a,r){var s,o,d,u,m,v;(m=b(t,"lazybeforeunveil",e)).defaultPrevented||(a&&(i?z(t,n.autosizesClass):t.setAttribute("sizes",a)),o=t.getAttribute(n.srcsetAttr),s=t.getAttribute(n.srcAttr),r&&(d=t.parentNode,u=d&&c.test(d.nodeName||"")),v=e.firesLoad||"src"in t&&(o||s||u),m={target:t},v&&(h(t,Q,!0),clearTimeout(f),f=l(Q,2500),z(t,n.loadingClass),h(t,tt,!0)),u&&g.call(d.getElementsByTagName("source"),et),o?t.setAttribute("srcset",o):s&&!u&&(q.test(t.nodeName)?function(t,e){try{t.contentWindow.location.replace(e)}catch(i){t.src=e}}(t,s):t.src=s),r&&(o||u)&&p(t,{src:s})),t._lazyRace&&delete t._lazyRace,y(t,n.lazyClass),E(function(){(!v||t.complete&&t.naturalWidth>1)&&(v?Q(m):J--,Y(m))},!0)}),nt=function(t){var e,i=I.test(t.nodeName),a=i&&(t.getAttribute(n.sizesAttr)||t.getAttribute("sizes")),r="auto"==a;(!r&&d||!i||!t.getAttribute("src")&&!t.srcset||t.complete||v(t,n.errorClass)||!v(t,n.lazyClass))&&(e=b(t,"lazyunveilread").detail,r&&S.updateElem(t,!0,t.offsetWidth),t._lazyRace=!0,J++,it(t,e,r,a,i))},at=function(){if(!d)if(r.now()-C<999)l(at,999);else{var t=M(function(){n.loadMode=3,X()});d=!0,n.loadMode=3,X(),o("scroll",function(){3==n.loadMode&&(n.loadMode=2),t()},!0)}};return{_:function(){C=r.now(),i.elements=e.getElementsByClassName(n.lazyClass),s=e.getElementsByClassName(n.lazyClass+" "+n.preloadClass),R=n.hFac,o("scroll",X,!0),o("resize",X,!0),t.MutationObserver?new MutationObserver(X).observe(a,{childList:!0,subtree:!0,attributes:!0}):(a.addEventListener("DOMNodeInserted",X,!0),a.addEventListener("DOMAttrModified",X,!0),setInterval(X,999)),o("hashchange",X,!0),["focus","mouseover","click","load","transitionend","animationend","webkitAnimationEnd"].forEach(function(t){e.addEventListener(t,X,!0)}),/d$|^c/.test(e.readyState)?at():(o("load",at),e.addEventListener("DOMContentLoaded",X),l(at,2e4)),i.elements.length?(V(),E._lsFlush()):X()},checkElems:X,unveil:nt}}(),S=(H=w(function(t,e,i,n){var a,r,s;if(t._lazysizesWidth=n,n+="px",t.setAttribute("sizes",n),c.test(e.nodeName||""))for(a=e.getElementsByTagName("source"),r=0,s=a.length;r<s;r++)a[r].setAttribute("sizes",n);i.detail.dataAttr||p(t,i.detail)}),O=function(t,e,i){var n,a=t.parentNode;a&&(i=C(t,a,i),(n=b(t,"lazybeforesizes",{width:i,dataAttr:!!e})).defaultPrevented||(i=n.detail.width)&&i!==t._lazysizesWidth&&H(t,a,n,i))},P=M(function(){var t,e=k.length;if(e)for(t=0;t<e;t++)O(k[t])}),{_:function(){k=e.getElementsByClassName(n.autosizesClass),o("resize",P)},checkElems:P,updateElem:O}),R=function(){R.i||(R.i=!0,S._(),F._())};var k,H,O,P;return i={cfg:n,autoSizer:S,loader:F,init:R,uP:p,aC:z,rC:y,hC:v,fire:b,gW:C,rAF:E}}(t,t.document);t.lazySizes=i,"object"==typeof module&&module.exports&&(module.exports=i)}(window); | ||
},{}],"u9vI":[function(require,module,exports) { | ||
parcelRequire=function(e,r,n,t){var i="function"==typeof parcelRequire&&parcelRequire,o="function"==typeof require&&require;function u(n,t){if(!r[n]){if(!e[n]){var f="function"==typeof parcelRequire&&parcelRequire;if(!t&&f)return f(n,!0);if(i)return i(n,!0);if(o&&"string"==typeof n)return o(n);var c=new Error("Cannot find module '"+n+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[n][1][r]||r},p.cache={};var l=r[n]=new u.Module(n);e[n][0].call(l.exports,p,l,l.exports,this)}return r[n].exports;function p(e){return u(p.resolve(e))}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=r,u.parent=i,u.register=function(r,n){e[r]=[function(e,r){r.exports=n},{}]};for(var f=0;f<n.length;f++)u(n[f]);if(n.length){var c=u(n[n.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):t&&(this[t]=c)}return u}({"Woiq":[function(require,module,exports) { | ||
var t=null;function r(){return t||(t=e()),t}function e(){try{throw new Error}catch(r){var t=(""+r.stack).match(/(https?|file|ftp):\/\/[^)\n]+/g);if(t)return n(t[0])}return"/"}function n(t){return(""+t).replace(/^((?:https?|file|ftp):\/\/.+)\/[^\/]+$/,"$1")+"/"}exports.getBundleURL=r,exports.getBaseURL=n; | ||
},{}],"fQ//":[function(require,module,exports) { | ||
var r=require("./bundle-url").getBundleURL;function e(r){Array.isArray(r)||(r=[r]);var e=r[r.length-1];try{return Promise.resolve(require(e))}catch(n){if("MODULE_NOT_FOUND"===n.code)return new s(function(n,i){t(r.slice(0,-1)).then(function(){return require(e)}).then(n,i)});throw n}}function t(r){return Promise.all(r.map(u))}var n={};function i(r,e){n[r]=e}module.exports=exports=e,exports.load=t,exports.register=i;var o={};function u(e){var t;if(Array.isArray(e)&&(t=e[1],e=e[0]),o[e])return o[e];var i=(e.substring(e.lastIndexOf(".")+1,e.length)||e).toLowerCase(),u=n[i];return u?o[e]=u(r()+e).then(function(r){return r&&module.bundle.register(t,r),r}).catch(function(r){throw delete o[e],r}):void 0}function s(r){this.executor=r,this.promise=null}s.prototype.then=function(r,e){return null===this.promise&&(this.promise=new Promise(this.executor)),this.promise.then(r,e)},s.prototype.catch=function(r){return null===this.promise&&(this.promise=new Promise(this.executor)),this.promise.catch(r)}; | ||
},{"./bundle-url":"Woiq"}],"u9vI":[function(require,module,exports) { | ||
function n(n){var o=typeof n;return null!=n&&("object"==o||"function"==o)}module.exports=n; | ||
@@ -31,4 +33,8 @@ },{}],"j3D9":[function(require,module,exports) { | ||
},{}],"97Si":[function(require,module,exports) { | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("lazysizes");var e=a(require("lodash/debounce")),t=require("./novicell.dynamic-image");function a(e){return e&&e.__esModule?e:{default:e}}var i=0,r=50;window.lazySizesConfig=window.lazySizesConfig||{},window.lazySizesConfig.expand=1e3;var s={lazyLoad:function(e){e.preventDefault=function(){Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})};var a=e.target,i=a.classList.contains("lazyload-measure")||a.classList.contains("lazyload-bg"),r=a.classList.contains("lazyload-measure"),s=a.hasAttribute("data-srcset")&&a.hasAttribute("data-query-obj"),n=a.hasAttribute("data-src")&&a.hasAttribute("data-query-obj");if(i&&e.preventDefault(),r){var d=a.classList.contains("lazyload-bg"),l=(0,t.dynamicImage)().getUrl(a);d?(a.parentNode.style.backgroundImage="url("+l+")",a.style.visibility="hidden"):a.src=l}else if(s){var o=a.getAttribute("data-query-obj"),u=a.getAttribute("data-srcset").split(","),c=a.getAttribute("data-src"),y=[];u.forEach(function(e){var a=(e=(e=e.trim()).split(" "))[0],i=e[1],r=(0,t.dynamicImage)().queryUrl(a,o);y.push(r+" "+i)}),a.setAttribute("srcset",y.join(", ")),a.setAttribute("src",(0,t.dynamicImage)().queryUrl(c,o))}else if(n){o=a.getAttribute("data-query-obj"),c=a.getAttribute("data-src"),l=(0,t.dynamicImage)().queryUrl(c,o);a.setAttribute("src",l)}},checkImages:function(){if(window.innerWidth>i+r||window.innerWidth<i-r){var e=Array.prototype.slice.call(document.body.querySelectorAll(".lazyloaded"));e.length>0&&e.map(function(e){e.classList.remove("lazyloaded"),e.classList.add("lazyload")}),i=window.innerWidth}}},n=s;exports.default=n,document.addEventListener("lazybeforeunveil",s.lazyLoad,!0),window.addEventListener("resize",(0,e.default)(s.checkImages),100,!1); | ||
},{"lazysizes":"c8dR","lodash/debounce":"CXfR","./novicell.dynamic-image":"9AMa"}]},{},["97Si"], null) | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=a(require("lodash/debounce")),t=require("./novicell.dynamic-image");function a(e){return e&&e.__esModule?e:{default:e}}require("_bundle_loader")(require.resolve("lazysizes"));var r=0,i=50;window.lazySizesConfig=window.lazySizesConfig||{},window.lazySizesConfig.expand=1e3;var s={lazyLoad:function(e){e.preventDefault=function(){Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})};var a=e.target,r=a.classList.contains("lazyload-measure")||a.classList.contains("lazyload-bg"),i=a.classList.contains("lazyload-measure"),s=a.hasAttribute("data-srcset")&&a.hasAttribute("data-query-obj"),n=a.hasAttribute("data-src")&&a.hasAttribute("data-query-obj");if(r&&e.preventDefault(),i){var d=a.classList.contains("lazyload-bg"),l=(0,t.dynamicImage)().getUrl(a);d?(a.parentNode.style.backgroundImage="url("+l+")",a.style.visibility="hidden"):a.src=l}else if(s){var o=a.getAttribute("data-query-obj"),u=a.getAttribute("data-srcset").split(","),c=a.getAttribute("data-src"),y=[];u.forEach(function(e){var a=(e=(e=e.trim()).split(" "))[0],r=e[1],i=(0,t.dynamicImage)().queryUrl(a,o);y.push(i+" "+r)}),a.setAttribute("srcset",y.join(", ")),a.setAttribute("src",(0,t.dynamicImage)().queryUrl(c,o))}else if(n){o=a.getAttribute("data-query-obj"),c=a.getAttribute("data-src"),l=(0,t.dynamicImage)().queryUrl(c,o);a.setAttribute("src",l)}},checkImages:function(){if(window.innerWidth>r+i||window.innerWidth<r-i){var e=Array.prototype.slice.call(document.body.querySelectorAll(".lazyloaded"));e.length>0&&e.map(function(e){e.classList.remove("lazyloaded"),e.classList.add("lazyload")}),r=window.innerWidth}}},n=s;exports.default=n,document.addEventListener("lazybeforeunveil",s.lazyLoad,!0),window.addEventListener("resize",(0,e.default)(s.checkImages),100,!1); | ||
},{"_bundle_loader":"fQ//","lazysizes":[["lazysizes.a97f36ec.js","c8dR"],"lazysizes.a97f36ec.map","c8dR"],"lodash/debounce":"CXfR","./novicell.dynamic-image":"9AMa"}],"IR2W":[function(require,module,exports) { | ||
module.exports=function(n){return new Promise(function(e,o){var r=document.createElement("script");r.async=!0,r.type="text/javascript",r.charset="utf-8",r.src=n,r.onerror=function(n){r.onerror=r.onload=null,o(n)},r.onload=function(){r.onerror=r.onload=null,e()},document.getElementsByTagName("head")[0].appendChild(r)})}; | ||
},{}],0:[function(require,module,exports) { | ||
var b=require("fQ//");b.register("js",require("IR2W")); | ||
},{}]},{},[0,"97Si"], null) | ||
//# sourceMappingURL=/lazy-images.map |
@@ -7,3 +7,3 @@ 'use strict'; | ||
*/ | ||
import 'lazysizes'; | ||
import('lazysizes'); | ||
import debounce from 'lodash/debounce'; | ||
@@ -10,0 +10,0 @@ import {dynamicImage} from './novicell.dynamic-image'; |
{ | ||
"name": "novicell-lazyload", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Novicell script for lazyloading images.", | ||
@@ -5,0 +5,0 @@ "main": "dist/lazy-images.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
88579
10
221
1
4
4