1 line
6.4 KiB
JavaScript
1 line
6.4 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{HToz:function(t,n,e){t.exports=function(){"use strict";function n(){return(n=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t}).apply(this,arguments)}var a="undefined"!=typeof window,o=a&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),i=a&&"IntersectionObserver"in window,e=a&&"classList"in document.createElement("p"),r=a&&window.devicePixelRatio>1,l={elements_selector:"img",container:o||a?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",load_delay:0,auto_unobserve:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,use_native:!1},c=function(t){return n({},l,t)},s=function(t,n){var e,a=new t(n);try{e=new CustomEvent("LazyLoad::Initialized",{detail:{instance:a}})}catch(t){(e=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:a})}window.dispatchEvent(e)},u=function(t,n){return t.getAttribute("data-"+n)},d=function(t,n,e){var a="data-"+n;null!==e?t.setAttribute(a,e):t.removeAttribute(a)},f=function(t,n){return d(t,"ll-status",n)},_=function(t,n){return d(t,"ll-timeout",n)},g=function(t){return u(t,"ll-timeout")},v=function(t,n,e,a){t&&(void 0===a?void 0===e?t(n):t(n,e):t(n,e,a))},p=function(t,n){e?t.classList.add(n):t.className+=(t.className?" ":"")+n},b=function(t,n){e?t.classList.remove(n):t.className=t.className.replace(new RegExp("(^|\\s+)"+n+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},h=function(t){return t.llTempImage},m=function(t){t&&(t.loadingCount+=1)},w=function(t){for(var n,e=[],a=0;n=t.children[a];a+=1)"SOURCE"===n.tagName&&e.push(n);return e},E=function(t,n,e){e&&t.setAttribute(n,e)},y=function(t,n){E(t,"sizes",u(t,n.data_sizes)),E(t,"srcset",u(t,n.data_srcset)),E(t,"src",u(t,n.data_src))},k={IMG:function(t,n){var e=t.parentNode;e&&"PICTURE"===e.tagName&&w(e).forEach(function(t){y(t,n)});y(t,n)},IFRAME:function(t,n){E(t,"src",u(t,n.data_src))},VIDEO:function(t,n){w(t).forEach(function(t){E(t,"src",u(t,n.data_src))}),E(t,"poster",u(t,n.data_poster)),E(t,"src",u(t,n.data_src)),t.load()}},I=function(t,n,e){var a=k[t.tagName];a&&(a(t,n),m(e),p(t,n.class_loading),f(t,"loading"),v(n.callback_loading,t,e),v(n.callback_reveal,t,e))},L=["IMG","IFRAME","VIDEO"],C=function(t,n){!n||n.toLoadCount||n.loadingCount||v(t.callback_finish,n)},A=function(t,n,e){t.addEventListener(n,e)},z=function(t,n,e){t.removeEventListener(n,e)},O=function(t,n,e){z(t,"load",n),z(t,"loadeddata",n),z(t,"error",e)},N=function(t,n,e){!function(t){delete t.llTempImage}(t),function(t,n){n&&(n.loadingCount-=1)}(0,e),b(t,n.class_loading)},x=function(e,a,o){var i=h(e)||e,r=function t(n){!function(t,n,e,a){N(n,e,a),p(n,e.class_loaded),f(n,"loaded"),v(e.callback_loaded,n,a),C(e,a)}(0,e,a,o),O(i,t,l)},l=function t(n){!function(t,n,e,a){N(n,e,a),p(n,e.class_error),f(n,"error"),v(e.callback_error,n,a),C(e,a)}(0,e,a,o),O(i,r,t)};!function(t,n,e){A(t,"load",n),A(t,"loadeddata",n),A(t,"error",e)}(i,r,l)},M=function(t,n){n&&(n.toLoadCount-=1)},R=function(t,n,e){!function(t){t.llTempImage=document.createElement("img")}(t),x(t,n,e),function(t,n,e){var a=u(t,n.data_bg),o=u(t,n.data_bg_hidpi),i=r&&o?o:a;i&&(t.style.backgroundImage='url("'.concat(i,'")'),h(t).setAttribute("src",i),m(e),p(t,n.class_loading),f(t,"loading"),v(n.callback_loading,t,e),v(n.callback_reveal,t,e))}(t,n,e),function(t,n,e){var a=u(t,n.data_bg_multi),o=u(t,n.data_bg_multi_hidpi),i=r&&o?o:a;i&&(t.style.backgroundImage=i,p(t,n.class_applied),f(t,"applied"),v(n.callback_applied,t,e))}(t,n,e)},T=function(t,n,e){!function(t){return L.indexOf(t.tagName)>-1}(t)?R(t,n,e):function(t,n,e){x(t,n,e),I(t,n,e)}(t,n,e),M(0,e),function(t,n){if(n){var e=n._observer;e&&n._settings.auto_unobserve&&e.unobserve(t)}}(t,e),C(n,e)},F=function(t){var n=g(t);n&&(clearTimeout(n),_(t,null))},G=function(t,n,e){var a=e._settings;v(a.callback_enter,t,n,e),a.load_delay?function(t,n,e){var a=n.load_delay,o=g(t);o||(o=setTimeout(function(){T(t,n,e),F(t)},a),_(t,o))}(t,a,e):T(t,a,e)},P=["IMG","IFRAME"],j=function(t){return t.use_native&&"loading"in HTMLImageElement.prototype},D=function(t,n,e){t.forEach(function(t){-1!==P.indexOf(t.tagName)&&(t.setAttribute("loading","lazy"),function(t,n,e){x(t,n,e),I(t,n,e),M(0,e),f(t,"native"),C(n,e)}(t,n,e))}),e.toLoadCount=0},H=function(t,n){!function(t){t.disconnect()}(t),function(n,t){t.forEach(function(t){n.observe(t),f(t,"observed")})}(t,n)},J=function(n){var t;i&&!j(n._settings)&&(n._observer=new IntersectionObserver(function(t){t.forEach(function(t){return function(t){return t.isIntersecting||t.intersectionRatio>0}(t)?G(t.target,t,n):function(t,n,e){var a=e._settings;v(a.callback_exit,t,n,e),a.load_delay&&F(t)}(t.target,t,n)})},{root:(t=n._settings).container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}))},S=function(t){return Array.prototype.slice.call(t)},U=function(t){return t.container.querySelectorAll(t.elements_selector)},V=function(t){return!function(t){return null!==u(t,"ll-status")}(t)||function(t){return"observed"===u(t,"ll-status")}(t)},$=function(t){return function(t){return"error"===u(t,"ll-status")}(t)},q=function(t,n){return function(t){return S(t).filter(V)}(t||U(n))},B=function(t){var n,e=t._settings;(n=U(e),S(n).filter($)).forEach(function(t){b(t,e.class_error),function(t){d(t,"ll-status",null)}(t)}),t.update()},t=function(t,n){var e;this._settings=c(t),this.loadingCount=0,J(this),e=this,a&&window.addEventListener("online",function(t){B(e)}),this.update(n)};return t.prototype={update:function(t){var n=this._settings,e=q(t,n);this.toLoadCount=e.length,!o&&i?j(n)?D(e,n,this):H(this._observer,e):this.loadAll(e)},destroy:function(){this._observer&&this._observer.disconnect(),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){var n=this,e=this._settings;q(t,e).forEach(function(t){T(t,e,n)})},load:function(t){T(t,this._settings,this)}},t.load=function(t,n){var e=c(n);T(t,e)},a&&function(t,n){if(n)if(n.length)for(var e,a=0;e=n[a];a+=1)s(t,e);else s(t,n)}(t,window.lazyLoadOptions),t}()}}]); |