PageSourceSearch

https://confused.cz/web/js/lazyload.js

js confused.cz collected 2026-10-08 23:01:33 UTC 5,618 bytes, 1 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.