### Microsoft Clarity Tracking Setup Source: https://www.erveysa.com/guide-bush-and-collet-manufacturing/ Integrates Microsoft Clarity for website analytics, session recording, and heatmaps. This snippet initializes the Clarity tracking script with a unique ID. ```javascript (function(c, l, a, r, i, t, y) { c[a] = c[a] || function() { (c[a].q = c[a].q || []).push(arguments) }; t = l.createElement(r); t.async = 1; t.src = "https://www.clarity.ms/tag/" + i + "?ref=wordpress"; y = l.getElementsByTagName(r)[0]; y.parentNode.insertBefore(t, y) })(window, document, "clarity", "script", "q1g3okqjg0"); ``` -------------------------------- ### Google Analytics and Tag Manager Setup Source: https://www.erveysa.com/guide-bush-and-collet-manufacturing/ Configures Google Analytics (gtag) and initializes Google Tag Manager. It sets up linker domains, developer ID, and a specific measurement ID for analytics tracking, and pushes page-specific data to the dataLayer. ```javascript window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag("set", "linker", {"domains": ["www.erveysa.com"]}); gtag("js", new Date()); gtag("set", "developer_id.dZTNiMT", true); gtag("config", "GT-NMKK4Z23"); var dataLayer_content = { "pagePostType": "post", "pagePostType2": "single-post", "pageCategory": ["general"], "pageAttributes": [ "collet", "guide-bush", "hydromat-rotary-transfer-collet", "multi-spindle-collet", "schutte-multispindle-collet", "tornos-multispindle-collet" ], "pagePostAuthor": "admin" }; dataLayer.push(dataLayer_content); (function(w, d, s, l, i) { w[l] = w[l] || []; w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'}); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = '//www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); })(window, document, 'script', 'dataLayer', 'GTM-WKWV26MD'); ``` -------------------------------- ### Microsoft Clarity Tracking Setup Source: https://www.erveysa.com/de/f66-spannzangen-din-185e/ Initializes the Microsoft Clarity tracking script, which helps in understanding user behavior through session recordings and heatmaps. ```javascript (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r); t.async=1; t.src="https://www.clarity.ms/tag/"+i+"?ref=wordpress"; y=l.getElementsByTagName(r)[0]; y.parentNode.insertBefore(t,y) })(window,document,"clarity","script","q1g3okqjg0") ``` -------------------------------- ### Microsoft Clarity Tracking Setup Source: https://www.erveysa.com/de/f32-spannzangen-din-161e/ Initializes the Microsoft Clarity tracking script, which helps in understanding user behavior through session recordings and heatmaps. ```javascript (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r); t.async=1; t.src="https://www.clarity.ms/tag/"+i+"?ref=wordpress"; y=l.getElementsByTagName(r)[0]; y.parentNode.insertBefore(t,y) })(window,document,"clarity","script","q1g3okqjg0") ``` -------------------------------- ### Intersection Observer Setup Source: https://www.erveysa.com/tr/kayar-otomat-pensi-nedir-temel-tanim-ve-islevi/ Initializes and configures an IntersectionObserver to monitor elements for visibility changes, setting up root, rootMargin, and threshold options. ```javascript function B(e,n){tt&&!q(e)&&(n._observer=new IntersectionObserver(function(t){H(t,e,n)},{root:(t=e).container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}))} ``` -------------------------------- ### Helper Functions and Constants Source: https://www.erveysa.com/ Contains various helper functions and constants used throughout the library for DOM manipulation, attribute access, and state checking. Examples include checking for native loading support, getting elements, and managing attributes. ```javascript var Y = "undefined" != typeof window, Z = Y && !("onscroll" in window) || "undefined" != typeof navigator && /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent), tt = Y && "IntersectionObserver" in window, et = Y && "classList" in document.createElement("p"), nt = Y && 1 < window.devicePixelRatio, ot = "src", it = "srcset", rt = "sizes", ct = "poster", lt = "llOriginalAttrs", st = "loading", ut = "loaded", dt = "applied", ft = "error", _t = "native", gt = "data-", vt = "ll-status", bt = [st, ut, dt, ft], pt = [ot], ht = [ot, ct], mt = [ot, it, rt], Et = { IMG: function(t, e) { h(t, function(t) { y(t, mt), O(t, e) }), y(t, mt), O(t, e) }, IFRAME: function(t, e) { y(t, pt), A(t, ot, l(t, e.data_src)) }, VIDEO: function(t, e) { a(t, function(t) { y(t, pt), A(t, ot, l(t, e.data_src)) }), y(t, ht), A(t, ct, l(t, e.data_poster)), A(t, ot, l(t, e.data_src)), t.load() } }, It = ["IMG", "IFRAME", "VIDEO"], yt = { IMG: j, IFRAME: function(t) { L(t, pt) }, VIDEO: function(t) { a(t, function(t) { L(t, pt) }), L(t, ht), t.load() } }, Lt = ["IMG", "IFRAME", "VIDEO"]; ``` -------------------------------- ### Lazy Loader Initialization and Configuration Source: https://www.erveysa.com/tr/iletisim/ This snippet describes the main constructor for the lazy loading library and its default configuration options. It outlines how to initialize the library with custom settings and details the various parameters available for controlling lazy loading behavior, including selectors, callbacks, and native feature usage. ```javascript /** * Initializes the lazy loading library. * @param {object} options - Configuration options for the lazy loader. * @param {string} [options.elements_selector=".lazy"] - CSS selector for elements to lazy load. * @param {Element|null} [options.container=document] - The scroll container for observing intersections. * @param {number} [options.threshold=300] - The distance in pixels to the root element that the observer's rootBounds are offset by. * @param {number[]|null} [options.thresholds=null] - An array of thresholds. * @param {string} [options.data_src="src"] - Data attribute for the image source. * @param {string} [options.data_srcset="srcset"] - Data attribute for the image srcset. * @param {string} [options.data_sizes="sizes"] - Data attribute for the image sizes. * @param {string} [options.data_bg="bg"] - Data attribute for background image URL. * @param {string} [options.data_bg_hidpi="bg-hidpi"] - Data attribute for high-resolution background image URL. * @param {string} [options.data_bg_multi="bg-multi"] - Data attribute for multiple background image URLs. * @param {string} [options.data_bg_multi_hidpi="bg-multi-hidpi"] - Data attribute for high-resolution multiple background image URLs. * @param {string} [options.data_poster="poster"] - Data attribute for video poster image. * @param {string} [options.class_applied="applied"] - Class added when an element is applied. * @param {string} [options.class_loading="litespeed-loading"] - Class added during loading. * @param {string} [options.class_loaded="litespeed-loaded"] - Class added when loading is complete. * @param {string} [options.class_error="error"] - Class added on error. * @param {string} [options.class_entered="entered"] - Class added when element enters viewport. * @param {string} [options.class_exited="exited"] - Class added when element exits viewport. * @param {boolean} [options.unobserve_completed=true] - Whether to unobserve elements after they are loaded. * @param {boolean} [options.unobserve_entered=false] - Whether to unobserve elements when they enter the viewport. * @param {boolean} [options.cancel_on_exit=true] - Whether to cancel loading if element exits viewport before completion. * @param {function|null} [options.callback_enter=null] - Callback function when an element enters the viewport. * @param {function|null} [options.callback_exit=null] - Callback function when an element exits the viewport. * @param {function|null} [options.callback_applied=null] - Callback function after an element's attributes are applied. * @param {function|null} [options.callback_loading=null] - Callback function when an element starts loading. * @param {function|null} [options.callback_loaded=null] - Callback function when an element finishes loading. * @param {function|null} [options.callback_error=null] - Callback function if an error occurs during loading. * @param {function|null} [options.callback_finish=null] - Callback function when all loading is finished. * @param {function|null} [options.callback_cancel=null] - Callback function if loading is cancelled. * @param {boolean} [options.use_native=false] - Whether to use native browser lazy loading. */ function LazyLoader(options) { var settings = assignDefaults(options, defaultSettings); this.loadingCount = 0; initObserver(settings, this); if (settings.use_native) { window.addEventListener("online", function() { handleOnlineStatus(settings, this); }); } this.update(options.initialElements); } var defaultSettings = { elements_selector: ".lazy", container: (isWindowDefined && !isBot) ? window : 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: "litespeed-loading", class_loaded: "litespeed-loaded", class_error: "error", class_entered: "entered", class_exited: "exited", unobserve_completed: true, unobserve_entered: false, cancel_on_exit: true, callback_enter: null, callback_exit: null, callback_applied: null, callback_loading: null, callback_loaded: null, callback_error: null, callback_finish: null, callback_cancel: null, use_native: false }; // Helper functions like assignDefaults, initObserver, handleOnlineStatus, etc. are defined elsewhere in the library. ``` -------------------------------- ### Lazy Loader Initialization and Configuration Source: https://www.erveysa.com/tr/anasayfa/ This snippet describes the main constructor for the lazy loading library and its default configuration options. It outlines how to initialize the library with custom settings and details the various parameters available for controlling lazy loading behavior, including selectors, callbacks, and native feature usage. ```javascript /** * Initializes the lazy loading library. * @param {object} options - Configuration options for the lazy loader. * @param {string} [options.elements_selector=".lazy"] - CSS selector for elements to lazy load. * @param {Element|null} [options.container=document] - The scroll container for observing intersections. * @param {number} [options.threshold=300] - The distance in pixels to the root element that the observer's rootBounds are offset by. * @param {number[]|null} [options.thresholds=null] - An array of thresholds. * @param {string} [options.data_src="src"] - Data attribute for the image source. * @param {string} [options.data_srcset="srcset"] - Data attribute for the image srcset. * @param {string} [options.data_sizes="sizes"] - Data attribute for the image sizes. * @param {string} [options.data_bg="bg"] - Data attribute for background image URL. * @param {string} [options.data_bg_hidpi="bg-hidpi"] - Data attribute for high-resolution background image URL. * @param {string} [options.data_bg_multi="bg-multi"] - Data attribute for multiple background image URLs. * @param {string} [options.data_bg_multi_hidpi="bg-multi-hidpi"] - Data attribute for high-resolution multiple background image URLs. * @param {string} [options.data_poster="poster"] - Data attribute for video poster image. * @param {string} [options.class_applied="applied"] - Class added when an element is applied. * @param {string} [options.class_loading="litespeed-loading"] - Class added during loading. * @param {string} [options.class_loaded="litespeed-loaded"] - Class added when loading is complete. * @param {string} [options.class_error="error"] - Class added on error. * @param {string} [options.class_entered="entered"] - Class added when element enters viewport. * @param {string} [options.class_exited="exited"] - Class added when element exits viewport. * @param {boolean} [options.unobserve_completed=true] - Whether to unobserve elements after they are loaded. * @param {boolean} [options.unobserve_entered=false] - Whether to unobserve elements when they enter the viewport. * @param {boolean} [options.cancel_on_exit=true] - Whether to cancel loading if element exits viewport before completion. * @param {function|null} [options.callback_enter=null] - Callback function when an element enters the viewport. * @param {function|null} [options.callback_exit=null] - Callback function when an element exits the viewport. * @param {function|null} [options.callback_applied=null] - Callback function after an element's attributes are applied. * @param {function|null} [options.callback_loading=null] - Callback function when an element starts loading. * @param {function|null} [options.callback_loaded=null] - Callback function when an element finishes loading. * @param {function|null} [options.callback_error=null] - Callback function if an error occurs during loading. * @param {function|null} [options.callback_finish=null] - Callback function when all loading is finished. * @param {function|null} [options.callback_cancel=null] - Callback function if loading is cancelled. * @param {boolean} [options.use_native=false] - Whether to use native browser lazy loading. */ function LazyLoader(options) { var settings = assignDefaults(options, defaultSettings); this.loadingCount = 0; initObserver(settings, this); if (settings.use_native) { window.addEventListener("online", function() { handleOnlineStatus(settings, this); }); } this.update(options.initialElements); } var defaultSettings = { elements_selector: ".lazy", container: (isWindowDefined && !isBot) ? window : 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: "litespeed-loading", class_loaded: "litespeed-loaded", class_error: "error", class_entered: "entered", class_exited: "exited", unobserve_completed: true, unobserve_entered: false, cancel_on_exit: true, callback_enter: null, callback_exit: null, callback_applied: null, callback_loading: null, callback_loaded: null, callback_error: null, callback_finish: null, callback_cancel: null, use_native: false }; // Helper functions like assignDefaults, initObserver, handleOnlineStatus, etc. are defined elsewhere in the library. ``` -------------------------------- ### Helper Functions and Constants Source: https://www.erveysa.com/about/ Contains various helper functions and constants used throughout the library for DOM manipulation, attribute access, and state checking. Examples include checking for native loading support, getting elements, and managing attributes. ```javascript var Y = "undefined" != typeof window, Z = Y && !("onscroll" in window) || "undefined" != typeof navigator && /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent), tt = Y && "IntersectionObserver" in window, et = Y && "classList" in document.createElement("p"), nt = Y && 1 < window.devicePixelRatio, ot = "src", it = "srcset", rt = "sizes", ct = "poster", lt = "llOriginalAttrs", st = "loading", ut = "loaded", dt = "applied", ft = "error", _t = "native", gt = "data-", vt = "ll-status", bt = [st, ut, dt, ft], pt = [ot], ht = [ot, ct], mt = [ot, it, rt], Et = { IMG: function(t, e) { h(t, function(t) { y(t, mt), O(t, e) }), y(t, mt), O(t, e) }, IFRAME: function(t, e) { y(t, pt), A(t, ot, l(t, e.data_src)) }, VIDEO: function(t, e) { a(t, function(t) { y(t, pt), A(t, ot, l(t, e.data_src)) }), y(t, ht), A(t, ct, l(t, e.data_poster)), A(t, ot, l(t, e.data_src)), t.load() } }, It = ["IMG", "IFRAME", "VIDEO"], yt = { IMG: j, IFRAME: function(t) { L(t, pt) }, VIDEO: function(t) { a(t, function(t) { L(t, pt) }), L(t, ht), t.load() } }, Lt = ["IMG", "IFRAME", "VIDEO"]; ``` -------------------------------- ### Lazy Loader Initialization and Configuration Source: https://www.erveysa.com/tr/hakkimizda/ This snippet describes the main constructor for the lazy loading library and its default configuration options. It outlines how to initialize the library with custom settings and details the various parameters available for controlling lazy loading behavior, including selectors, callbacks, and native feature usage. ```javascript /** * Initializes the lazy loading library. * @param {object} options - Configuration options for the lazy loader. * @param {string} [options.elements_selector=".lazy"] - CSS selector for elements to lazy load. * @param {Element|null} [options.container=document] - The scroll container for observing intersections. * @param {number} [options.threshold=300] - The distance in pixels to the root element that the observer's rootBounds are offset by. * @param {number[]|null} [options.thresholds=null] - An array of thresholds. * @param {string} [options.data_src="src"] - Data attribute for the image source. * @param {string} [options.data_srcset="srcset"] - Data attribute for the image srcset. * @param {string} [options.data_sizes="sizes"] - Data attribute for the image sizes. * @param {string} [options.data_bg="bg"] - Data attribute for background image URL. * @param {string} [options.data_bg_hidpi="bg-hidpi"] - Data attribute for high-resolution background image URL. * @param {string} [options.data_bg_multi="bg-multi"] - Data attribute for multiple background image URLs. * @param {string} [options.data_bg_multi_hidpi="bg-multi-hidpi"] - Data attribute for high-resolution multiple background image URLs. * @param {string} [options.data_poster="poster"] - Data attribute for video poster image. * @param {string} [options.class_applied="applied"] - Class added when an element is applied. * @param {string} [options.class_loading="litespeed-loading"] - Class added during loading. * @param {string} [options.class_loaded="litespeed-loaded"] - Class added when loading is complete. * @param {string} [options.class_error="error"] - Class added on error. * @param {string} [options.class_entered="entered"] - Class added when element enters viewport. * @param {string} [options.class_exited="exited"] - Class added when element exits viewport. * @param {boolean} [options.unobserve_completed=true] - Whether to unobserve elements after they are loaded. * @param {boolean} [options.unobserve_entered=false] - Whether to unobserve elements when they enter the viewport. * @param {boolean} [options.cancel_on_exit=true] - Whether to cancel loading if element exits viewport before completion. * @param {function|null} [options.callback_enter=null] - Callback function when an element enters the viewport. * @param {function|null} [options.callback_exit=null] - Callback function when an element exits the viewport. * @param {function|null} [options.callback_applied=null] - Callback function after an element's attributes are applied. * @param {function|null} [options.callback_loading=null] - Callback function when an element starts loading. * @param {function|null} [options.callback_loaded=null] - Callback function when an element finishes loading. * @param {function|null} [options.callback_error=null] - Callback function if an error occurs during loading. * @param {function|null} [options.callback_finish=null] - Callback function when all loading is finished. * @param {function|null} [options.callback_cancel=null] - Callback function if loading is cancelled. * @param {boolean} [options.use_native=false] - Whether to use native browser lazy loading. */ function LazyLoader(options) { var settings = assignDefaults(options, defaultSettings); this.loadingCount = 0; initObserver(settings, this); if (settings.use_native) { window.addEventListener("online", function() { handleOnlineStatus(settings, this); }); } this.update(options.initialElements); } var defaultSettings = { elements_selector: ".lazy", container: (isWindowDefined && !isBot) ? window : 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: "litespeed-loading", class_loaded: "litespeed-loaded", class_error: "error", class_entered: "entered", class_exited: "exited", unobserve_completed: true, unobserve_entered: false, cancel_on_exit: true, callback_enter: null, callback_exit: null, callback_applied: null, callback_loading: null, callback_loaded: null, callback_error: null, callback_finish: null, callback_cancel: null, use_native: false }; // Helper functions like assignDefaults, initObserver, handleOnlineStatus, etc. are defined elsewhere in the library. ``` -------------------------------- ### Native Loading Attribute Setup Source: https://www.erveysa.com/ Applies the 'loading="lazy"' attribute to elements if native lazy loading is supported and enabled in the settings. This allows the browser to handle the lazy loading natively. ```javascript function S(t, e, n) { t.setAttribute("loading", "lazy"), R(t, e, n), a = e, (e = Et[n.tagName]) && e(n, a), s(t, _t) } ``` -------------------------------- ### LazyLoad Constructor and Initialization Source: https://www.erveysa.com/fr/a-propos/ Initializes the LazyLoad library. It sets up the observer, handles initial updates, and optionally listens for network status changes to retry loading failed elements. ```javascript function LazyLoad(t, e) { var n, a; t = o(t); this._settings = t; this.loadingCount = 0; B(t, this); n = t; a = this; Y && window.addEventListener("online", function() { X(n, a) }); this.update(e) } ``` -------------------------------- ### Helper Functions and Constants Source: https://www.erveysa.com/contact/ Contains various helper functions and constants used throughout the library for DOM manipulation, attribute access, and state checking. Examples include checking for native loading support, getting elements, and managing attributes. ```javascript var Y = "undefined" != typeof window, Z = Y && !("onscroll" in window) || "undefined" != typeof navigator && /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent), tt = Y && "IntersectionObserver" in window, et = Y && "classList" in document.createElement("p"), nt = Y && 1 < window.devicePixelRatio, ot = "src", it = "srcset", rt = "sizes", ct = "poster", lt = "llOriginalAttrs", st = "loading", ut = "loaded", dt = "applied", ft = "error", _t = "native", gt = "data-", vt = "ll-status", bt = [st, ut, dt, ft], pt = [ot], ht = [ot, ct], mt = [ot, it, rt], Et = { IMG: function(t, e) { h(t, function(t) { y(t, mt), O(t, e) }), y(t, mt), O(t, e) }, IFRAME: function(t, e) { y(t, pt), A(t, ot, l(t, e.data_src)) }, VIDEO: function(t, e) { a(t, function(t) { y(t, pt), A(t, ot, l(t, e.data_src)) }), y(t, ht), A(t, ct, l(t, e.data_poster)), A(t, ot, l(t, e.data_src)), t.load() } }, It = ["IMG", "IFRAME", "VIDEO"], yt = { IMG: j, IFRAME: function(t) { L(t, pt) }, VIDEO: function(t) { a(t, function(t) { L(t, pt) }), L(t, ht), t.load() } }, Lt = ["IMG", "IFRAME", "VIDEO"]; ``` -------------------------------- ### LazyLoad Library Implementation Source: https://www.erveysa.com/ This snippet initializes and configures the LazyLoad JavaScript library. It sets options for the observer threshold and merges them with any existing configurations, preparing the library for use. ```javascript window.lazyLoadOptions = Object.assign({}, { "threshold": 300 }, window.lazyLoadOptions || {}); !function (t, e) { "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).LazyLoad = e(); }(this, function () { "use strict"; function e() { return (e = Object.assign || function (t) { for (var e = 1; e < arguments.length; e++) { var n, a = arguments[e]; for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (t[n] = a[n]); } return t; }).apply(this, arguments); } function o(t) { return e({}, at, t); } function l(t, e) { return t.getAttribute(gt + e); } function c(t) { return l(t, vt); } function s(t, e) { return function (t, e, n) { e = gt + e; null !== n ? t.setAttribute(e, n) : t.removeAttribute(e); }(t, vt, e); } function i(t) { return s(t, null), 0; } function r(t) { return null === c(t); } function u(t) { return c(t) === _t; } function d(t, e, n, a) { t && (void 0 === a ? void 0 === n ? t(e) : t(e, n) : t(e, n, a)); } function f(t, e) { et ? t.classList.add(e) : t.className += (t.className ? " " : "") + e; } function _(t, e) { et ? t.classList.remove(e) : t.className = t.className.replace(new RegExp("(^|\\s+)" + e + "(\\s+|$)"), " ").replace(/^\\s+/, "").replace(/\\s+$/, ""); } function g(t) { return t.llTempImage; } function v(t, e) { !e || (e = e._observer) && e.unobserve(t); } function b(t, e) { t && (t.loadingCount += e); } function p(t, e) { t && (t.toLoadCount = e); } function n(t) { for (var e, n = [], a = 0; e = t.children[a]; a += 1) "SOURCE" === e.tagName && n.push(e); return n; } function h(t, e) { (t = t.parentNode) && "PICTURE" === t.tagName && n(t).forEach(e); } function a(t, e) { n(t).forEach(e); } function m(t) { return !!t[lt]; } function E(t) { return t[lt]; } function I(t) { return delete t[lt]; } function y(e, t) { m(e) || (n = {}, t.forEach(function (t) { n[t] = e.getAttribute(t); }), e[lt] = n); } function L(a, t) { m(a) && (o = E(a), t.forEach(function (t) { var e, n; e = a, (t = o[n = t]) ? e.setAttribute(n, t) : e.removeAttribute(n); })); } function k(t, e, n) { f(t, e.class_loading), s(t, st), n && (b(n, 1), d(e.callback_loading, t, n)); } function A(t, e, n) { A(t, rt, l(t, e.data_sizes)), A(t, it, l(t, e.data_srcset)), A(t, ot, l(t, e.data_src)); } function O(t, e) { var a = l(t, e.data_bg_multi), o = l(t, e.data_bg_multi_hidpi); (a = nt && o ? o : a) && (t.style.backgroundImage = a, n = n, f(t = t, (e = e).class_ap); } var gt = "data-", vt = "loading", _t = "loaded", st = "pending", lt = "ll-custom-attribute", rt = "sizes", it = "srcset", ot = "src", at = { elements_selector: ".lazy", container: "body", threshold: 300, thresholds: null, data_src: "src", data_srcset: "srcset", data_sizes: "sizes", data_bg: "bg", 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_load: null, callback_load_all: null, callback_error: null, callback_intersection: null, callback_loading: null }; return function t(n) { this._settings = o(n), this._queryElements = function (t) { return Array.prototype.slice.call(t.querySelectorAll(this._settings.elements_selector)); }.bind(this), this._updateLoadingCount = function (t) { b(this._settings, t); var e = this._settings.toLoadCount; if (!e) { var n = this._settings.callback_load_all; n && d(n, this); } }.bind(this), this._load = function (t, e, n) { var a = this._settings; if (m(t)) { var o = E(t); t.setAttribute(ot, o.src), o.srcset && t.setAttribute(it, o.srcset), o.sizes && t.setAttribute(rt, o.sizes); I(t); _(t, a.class_loading); f(t, a.class_loaded); s(t, _t); d(a.callback_load, t, n, e); this._updateLoadingCount(-1); } }.bind(this), this._loadAndDestroy = function (t, e, n) { var a = this._settings; this._load(t, n, e), v(t, this), I(t); }.bind(this), this._removeClass = _, this._initLoading = k.bind(null, this._settings), this._initBackground = O.bind(null, this._settings), this._initPicture = h.bind(null, this._settings), this._initIframe = function (t, e) { var n = l(t, "src"); n && (t.setAttribute(ot, n), s(t, _t), f(t, e.class_loaded), d(e.callback_load, t)); }.bind(this), this._addLL = y.bind(null, this._settings), this._removeLL = L.bind(null, this._settings), this._mergeAttrData = A.bind(null, this._settings), this._observer = new IntersectionObserver(function (t) { t.forEach(function (t) { var n = t.target; t.isIntersecting ? (d(this._settings.callback_intersection, n, t), function (t, e) { var n = c(t); if (n === st || n === void 0) { var a = this._settings; if (a.load_delay) { var o = k.bind(null, a, t, e); setTimeout(o, a.load_delay); } else k(a, t, e); a.auto_unobserve && v(t, this); } }.bind(this)(n, t.intersectionRatio)) : (d(this._settings.callback_loading, n, t.intersectionRatio), s(n, st)); }.bind(this)); }.bind(this), { root: null, rootMargin: "0px", threshold: this._settings.thresholds || [this._settings.threshold / 100] }); }; }); ``` -------------------------------- ### Intersection Observer Setup Source: https://www.erveysa.com/ Configures and creates an IntersectionObserver instance based on the provided settings. It handles the root element, root margin, and the callback function for intersection changes. This is crucial for the native lazy loading mechanism. ```javascript function B(e, n) { tt && !q(e) && (n._observer = new IntersectionObserver(function(t) { H(t, e, n) }, { root: (t = e).container === document ? null : t.container, rootMargin: t.thresholds || t.threshold + "px" })) } ``` -------------------------------- ### Helper Functions and Constants Source: https://www.erveysa.com/ai-sitemap-2/ Contains various helper functions and constants used throughout the library for DOM manipulation, attribute access, and state checking. Examples include checking for native loading support, getting elements, and managing attributes. ```javascript var Y = "undefined" != typeof window, Z = Y && !("onscroll" in window) || "undefined" != typeof navigator && /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent), tt = Y && "IntersectionObserver" in window, et = Y && "classList" in document.createElement("p"), nt = Y && 1 < window.devicePixelRatio, ot = "src", it = "srcset", rt = "sizes", ct = "poster", lt = "llOriginalAttrs", st = "loading", ut = "loaded", dt = "applied", ft = "error", _t = "native", gt = "data-", vt = "ll-status", bt = [st, ut, dt, ft], pt = [ot], ht = [ot, ct], mt = [ot, it, rt], Et = { IMG: function(t, e) { h(t, function(t) { y(t, mt), O(t, e) }), y(t, mt), O(t, e) }, IFRAME: function(t, e) { y(t, pt), A(t, ot, l(t, e.data_src)) }, VIDEO: function(t, e) { a(t, function(t) { y(t, pt), A(t, ot, l(t, e.data_src)) }), y(t, ht), A(t, ct, l(t, e.data_poster)), A(t, ot, l(t, e.data_src)), t.load() } }, It = ["IMG", "IFRAME", "VIDEO"], yt = { IMG: j, IFRAME: function(t) { L(t, pt) }, VIDEO: function(t) { a(t, function(t) { L(t, pt) }), L(t, ht), t.load() } }, Lt = ["IMG", "IFRAME", "VIDEO"]; ``` -------------------------------- ### Lazy Load Initialization Source: https://www.erveysa.com/guide-bush-and-collet-manufacturing/ Configuration for the LazyLoad JavaScript library, setting options like the threshold for image loading and merging with existing configurations. ```javascript window.lazyLoadOptions=Object.assign({},{threshold:300},window.lazyLoadOptions||{}); !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).LazyLoad=e()}(this,function(){"use strict";function e(){return(e=Object.assign||function(t){for(var e=1;e