Skip to Content

JavaScript File

URL: https://thematrixonemetri.vn/wp-content/themes/vnnews/js/lozad.js
HTTP Status: 200 OK
MIME Type: application/javascript
Last Modified: Sun, 21 Nov 2021 09:57:22 GMT
Download Time: Less than a second
Cookies: None
Size: 4 KB
HTTP Headers:  6 headers
Links In:  8 pages
Links Out:  0 links
Images:  0 images
CSS:  0 files
JavaScript:  0 files
  
OK Issues: No issues found

1/*! lozad.js - v1.16.0 - 2020-09-06

2* https://github.com/ApoorvSaxena/lozad.js

3* Copyright (c) 2020 Apoorv Saxena; Licensed MIT */

4!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.lozad=e()}

5(this,function(){"use strict";

6/**

7 * Detect IE browser

8 * @const {boolean}

9

10 * @private

11 */var g="undefined"!=typeof document&&document.documentMode,f={rootMargin:"0px",threshold:0,load:function(t){if("picture"===t.nodeName.toLowerCase()){var e=t.querySelector("img"),r=!1;null===e&&(e=document.createElement("img"),r=!0),g&&t.getAttribute("data-iesrc")&&(e.src=t.getAttribute("data-iesrc")),t.getAttribute("data-alt")&&(e.alt=t.getAttribute("data-alt")),r&&t.append(e)}

12if("video"===t.nodeName.toLowerCase()&&!t.getAttribute("data-src")&&t.children){for(var a=t.children,o=void 0,i=0;i<=a.length-1;i++)(o=a[i].getAttribute("data-src"))&&(a[i].src=o);t.load()}

13t.getAttribute("data-poster")&&(t.poster=t.getAttribute("data-poster")),t.getAttribute("data-src")&&(t.src=t.getAttribute("data-src")),t.getAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"));var n=",";if(t.getAttribute("data-background-delimiter")&&(n=t.getAttribute("data-background-delimiter")),t.getAttribute("data-background-image"))t.style.backgroundImage="url('"+t.getAttribute("data-background-image").split(n).join("'),url('")+"')";else if(t.getAttribute("data-background-image-set")){var d=t.getAttribute("data-background-image-set").split(n),u=d[0].substr(0,d[0].indexOf(" "))||d[0];// Substring before ... 1x

14u=-1===u.indexOf("url(")?"url("+u+")":u,1===d.length?t.style.backgroundImage=u:t.setAttribute("style",(t.getAttribute("style")||"")+"background-image: "+u+"; background-image: -webkit-image-set("+d+"); background-image: image-set("+d+")")}

15t.getAttribute("data-toggle-class")&&t.classList.toggle(t.getAttribute("data-toggle-class"))}

16,loaded:function(){}

17}

18;function A(t){t.setAttribute("data-loaded",!0)}

19var m=function(t){return"true"===t.getAttribute("data-loaded")}

20,v=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:document;return t instanceof Element?[t]:t instanceof NodeList?t:e.querySelectorAll(t)}

21;return function(){var r,a,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:".lozad",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}

22,e=Object.assign({}

23,f,t),i=e.root,n=e.rootMargin,d=e.threshold,u=e.load,g=e.loaded,s=void 0;"undefined"!=typeof window&&window.IntersectionObserver&&(s=new IntersectionObserver((r=u,a=g,function(t,e){t.forEach(function(t){(0<t.intersectionRatio||t.isIntersecting)&&(e.unobserve(t.target),m(t.target)||(r(t.target),A(t.target),a(t.target)))}

24)}

25),{root:i,rootMargin:n,threshold:d}

26));for(var c,l=v(o,i),b=0;b<l.length;b++)(c=l[b]).getAttribute("data-placeholder-background")&&(c.style.background=c.getAttribute("data-placeholder-background"));return{observe:function(){for(var t=v(o,i),e=0;e<t.length;e++)m(t[e])||(s?s.observe(t[e]):(u(t[e]),A(t[e]),g(t[e])))}

27,triggerLoad:function(t){m(t)||(u(t),A(t),g(t))}

28,observer:s}

29}

30}

31);

32lozad('img:not(.no-lozad), iframe:not(.no-lozad)', {

33 load: function(el) {

34 if (el.getAttribute("data-src")) {

35 el.src = el.getAttribute("data-src");

36 }

37

38 }

39,

40 rootMargin: '200px 0px'

...

</html>