-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathgandul.min.js
2 lines (2 loc) · 1.67 KB
/
gandul.min.js
1
2
/*! accessible-image-lazy-load v1.3.3 (c) 2024 Jorge Moreno, moro.es (@alterebro) https://moro.es/projects/gandul-accessible-image-lazy-loading/ */
"use strict";!function(e){var t=function(){return function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"a.gandul",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=Object.assign({},{root:null,rootMargin:"50px 0px 50px 0px",threshold:0},t),r=function(e){var t=e.parentNode,n=document.createElement("img");n.alt=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:100,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"...";return e.length>t?e.substring(0,t-n.length)+n:e}(e.innerText),n.addEventListener("load",function(e){var t=this;window.setTimeout(function(){t.classList.add("gandul-active")},50),a&&"function"==typeof a&&a(n)});for(var r,i,o=e.attributes,s=0;s<o.length;s++)n.setAttribute((r=o[s].nodeName)in(i={href:"src","data-href":"src","data-srcset":"srcset","data-sizes":"sizes","data-width":"width"})?i[r]:r,o[s].nodeValue);t.replaceChild(n,e)},i=document.querySelectorAll(e),o="IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype&&"isIntersecting"in window.IntersectionObserverEntry.prototype,s=o&&new IntersectionObserver(function(e){[].forEach.call(e,function(e){e.isIntersecting&&(s.unobserve(e.target),r(e.target))})},n);return[].forEach.call(i,function(e){o?s.observe(e):r(e)}),!!i.length}};"function"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define([],t):e.gandul=t()}("undefined"!=typeof self?self:void 0);