diff --git a/plugins/unveilhooks/ls.unveilhooks.js b/plugins/unveilhooks/ls.unveilhooks.js index 7fca26e0..531c88bd 100644 --- a/plugins/unveilhooks/ls.unveilhooks.js +++ b/plugins/unveilhooks/ls.unveilhooks.js @@ -159,6 +159,9 @@ For background images, use data-bg attribute: function addStyleScript(src, style, cb){ if(uniqueUrls[src]){ + if (typeof cb === 'function') { + cb(); + } return; } var elem = document.createElement(style ? 'link' : 'script'); diff --git a/plugins/unveilhooks/ls.unveilhooks.min.js b/plugins/unveilhooks/ls.unveilhooks.min.js index 553f5973..4487468a 100644 --- a/plugins/unveilhooks/ls.unveilhooks.min.js +++ b/plugins/unveilhooks/ls.unveilhooks.min.js @@ -1,3 +1,3 @@ /*! lazysizes - v5.3.2 */ -!function(e,t){var a=function(){t(e.lazySizes),e.removeEventListener("lazyunveilread",a,!0)};t=t.bind(null,e,e.document),"object"==typeof module&&module.exports?t(require("lazysizes")):"function"==typeof define&&define.amd?define(["lazysizes"],t):e.lazySizes?a():e.addEventListener("lazyunveilread",a,!0)}(window,function(e,i,o){"use strict";var l,d,u={};function s(e,t,a){var n,r;u[e]||(n=i.createElement(t?"link":"script"),r=i.getElementsByTagName("script")[0],t?(n.rel="stylesheet",n.href=e):(n.onload=function(){n.onerror=null,n.onload=null,a()},n.onerror=n.onload,n.src=e),u[e]=!0,u[n.src||n.href]=!0,r.parentNode.insertBefore(n,r))}i.addEventListener&&(l=function(e,t){var a=i.createElement("img");a.onload=function(){a.onload=null,a.onerror=null,a=null,t()},a.onerror=a.onload,a.src=e,a&&a.complete&&a.onload&&a.onload()},addEventListener("lazybeforeunveil",function(e){var t,a,n;if(e.detail.instance==o&&!e.defaultPrevented){var r=e.target;if("none"==r.preload&&(r.preload=r.getAttribute("data-preload")||"auto"),null!=r.getAttribute("data-autoplay"))if(r.getAttribute("data-expand")&&!r.autoplay)try{r.play()}catch(e){}else requestAnimationFrame(function(){r.setAttribute("data-expand","-10"),o.aC(r,o.cfg.lazyClass)});(t=r.getAttribute("data-link"))&&s(t,!0),(t=r.getAttribute("data-script"))&&(e.detail.firesLoad=!0,s(t,null,function(){e.detail.firesLoad=!1,o.fire(r,"_lazyloaded",{},!0,!0)})),(t=r.getAttribute("data-require"))&&(o.cfg.requireJs?o.cfg.requireJs([t]):s(t)),(a=r.getAttribute("data-bg"))&&(e.detail.firesLoad=!0,l(a,function(){r.style.backgroundImage="url("+(d.test(a)?JSON.stringify(a):a)+")",e.detail.firesLoad=!1,o.fire(r,"_lazyloaded",{},!0,!0)})),(n=r.getAttribute("data-poster"))&&(e.detail.firesLoad=!0,l(n,function(){r.poster=n,e.detail.firesLoad=!1,o.fire(r,"_lazyloaded",{},!0,!0)}))}},!(d=/\(|\)|\s|'/)))}); \ No newline at end of file +!function(e,t){var a=function(){t(e.lazySizes),e.removeEventListener("lazyunveilread",a,!0)};t=t.bind(null,e,e.document),"object"==typeof module&&module.exports?t(require("lazysizes")):"function"==typeof define&&define.amd?define(["lazysizes"],t):e.lazySizes?a():e.addEventListener("lazyunveilread",a,!0)}(window,function(e,t,a){"use strict";var r,n,i={};function o(e,a,r){if(i[e]){"function"==typeof r&&r();return}var n=t.createElement(a?"link":"script"),o=t.getElementsByTagName("script")[0];a?(n.rel="stylesheet",n.href=e):(n.onload=function(){n.onerror=null,n.onload=null,r()},n.onerror=n.onload,n.src=e),i[e]=!0,i[n.src||n.href]=!0,o.parentNode.insertBefore(n,o)}t.addEventListener&&(n=/\(|\)|\s|'/,r=function(e,a){var r=t.createElement("img");r.onload=function(){r.onload=null,r.onerror=null,r=null,a()},r.onerror=r.onload,r.src=e,r&&r.complete&&r.onload&&r.onload()},addEventListener("lazybeforeunveil",function(e){if(e.detail.instance==a&&!e.defaultPrevented){var t,i,l,d,u=e.target;if("none"==u.preload&&(u.preload=u.getAttribute("data-preload")||"auto"),null!=u.getAttribute("data-autoplay")){if(u.getAttribute("data-expand")&&!u.autoplay)try{u.play()}catch(s){}else requestAnimationFrame(function(){u.setAttribute("data-expand","-10"),a.aC(u,a.cfg.lazyClass)})}(t=u.getAttribute("data-link"))&&o(t,!0),(t=u.getAttribute("data-script"))&&(e.detail.firesLoad=!0,o(t,null,i=function(){e.detail.firesLoad=!1,a.fire(u,"_lazyloaded",{},!0,!0)})),(t=u.getAttribute("data-require"))&&(a.cfg.requireJs?a.cfg.requireJs([t]):o(t)),(l=u.getAttribute("data-bg"))&&(e.detail.firesLoad=!0,i=function(){u.style.backgroundImage="url("+(n.test(l)?JSON.stringify(l):l)+")",e.detail.firesLoad=!1,a.fire(u,"_lazyloaded",{},!0,!0)},r(l,i)),(d=u.getAttribute("data-poster"))&&(e.detail.firesLoad=!0,i=function(){u.poster=d,e.detail.firesLoad=!1,a.fire(u,"_lazyloaded",{},!0,!0)},r(d,i))}},!1))});