Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yall-js

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yall-js - npm Package Compare versions

Comparing version 2.3.0 to 2.3.1

13

dist/yall.js

@@ -18,7 +18,6 @@ 'use strict';

const lazyBackgroundClass = options.lazyBackgroundClass || "lazy-bg";
const idleLoadTimeout = options.idleLoadTimeout || 100;
const threshold = options.threshold || 200;
const idleLoadTimeout = "idleLoadTimeout" in options ? options.idleLoadTimeout : 100;
const threshold = "threshold" in options ? options.threshold : 200;
const observeChanges = options.observeChanges || false;
const selectorString = `img.${lazyClass},video.${lazyClass},iframe.${lazyClass},.${lazyBackgroundClass}`;
const dataAttrs = ["srcset", "src", "poster"];
const idleCallbackOptions = {

@@ -79,3 +78,3 @@ timeout: idleLoadTimeout

const yallFlipDataAttrs = element => {
dataAttrs.forEach(dataAttr => {
["srcset", "src", "poster"].forEach(dataAttr => {
if (dataAttr in element.dataset) {

@@ -118,3 +117,3 @@ element[dataAttr] = element.dataset[dataAttr];

}
}, options.throttleTime || 200);
}, "throttleTime" in options ? options.throttleTime : 200);
}

@@ -152,2 +151,6 @@ };

lazyElements = lazyElements.filter(lazyElement => lazyElement != element);
if (!lazyElements.length && !observeChanges) {
intersectionListener.disconnect();
}
}

@@ -154,0 +157,0 @@ });

@@ -1,2 +0,2 @@

/*yall.js 2.3.0*/
var yall=function(){"use strict";return function(e){e||(e={});var t="IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype,n="requestIdleCallback"in window,o=[[document,"scroll"],[document,"touchmove"],[window,"resize"],[window,"orientationchange"]],r=e.lazyClass||"lazy",i=e.lazyBackgroundClass||"lazy-bg",c=e.idleLoadTimeout||100,a=e.threshold||200,s=e.observeChanges||!1,l="img."+r+",video."+r+",iframe."+r+",."+i,u=["srcset","src","poster"],d={timeout:c},f=function(e){return[].slice.call(e)},v=function(t){switch(t.nodeName){case"IMG":var n=t.parentNode;"PICTURE"==n.nodeName&&f(n.querySelectorAll("source")).forEach(function(e){b(e)}),b(t);break;case"VIDEO":f(t.querySelectorAll("source")).forEach(function(e){b(e)}),b(t),t.autoplay&&t.load();break;case"IFRAME":b(t)}t.classList.contains(i)&&(t.classList.remove(i),t.classList.add(e.lazyBackgroundLoaded||"lazy-bg-loaded"))},b=function(e){u.forEach(function(t){t in e.dataset&&(e[t]=e.dataset[t])})},g=function yallBack(){var t=!1;!t&&h.length&&(t=!0,setTimeout(function(){h.forEach(function(e){e.getBoundingClientRect().top<=window.innerHeight+a&&e.getBoundingClientRect().bottom>=-a&&"none"!=getComputedStyle(e).display&&(n&&c?requestIdleCallback(function(){v(e)},d):v(e),e.classList.remove(r),h=h.filter(function(t){return t!=e}))}),t=!1,h.length||s||o.forEach(function(e){e[0].removeEventListener(e[1],yallBack)})},e.throttleTime||200))},h=f(document.querySelectorAll(l));if(/(google|bing|yandex|duckduck)bot/i.test(navigator.userAgent))h.forEach(function(e){v(e)});else{if(t){var m=new IntersectionObserver(function(e,t){e.forEach(function(e){if(e.isIntersecting){var o=e.target;n&&c?requestIdleCallback(function(){v(o)},d):v(o),o.classList.remove(r),t.unobserve(o),h=h.filter(function(e){return e!=o})}})},{rootMargin:a+"px 0%"});h.forEach(function(e){m.observe(e)})}else o.forEach(function(e){e[0].addEventListener(e[1],g)}),g();"MutationObserver"in window&&s&&new MutationObserver(function(e){e.forEach(function(){f(document.querySelectorAll(l)).forEach(function(e){-1==h.indexOf(e)&&(h.push(e),t?m.observe(e):g())})})}).observe(document.querySelector(e.observeRootSelector||"body"),e.mutationObserverOptions||{childList:!0,subtree:!0})}}}();
/*yall.js 2.3.1*/
var yall=function(){"use strict";return function(e){e||(e={});var t="IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype,n="requestIdleCallback"in window,o=[[document,"scroll"],[document,"touchmove"],[window,"resize"],[window,"orientationchange"]],r=e.lazyClass||"lazy",i=e.lazyBackgroundClass||"lazy-bg",c="idleLoadTimeout"in e?e.idleLoadTimeout:100,a="threshold"in e?e.threshold:200,s=e.observeChanges||!1,l="img."+r+",video."+r+",iframe."+r+",."+i,u={timeout:c},d=function(e){return[].slice.call(e)},f=function(t){switch(t.nodeName){case"IMG":var n=t.parentNode;"PICTURE"==n.nodeName&&d(n.querySelectorAll("source")).forEach(function(e){v(e)}),v(t);break;case"VIDEO":d(t.querySelectorAll("source")).forEach(function(e){v(e)}),v(t),t.autoplay&&t.load();break;case"IFRAME":v(t)}t.classList.contains(i)&&(t.classList.remove(i),t.classList.add(e.lazyBackgroundLoaded||"lazy-bg-loaded"))},v=function(e){["srcset","src","poster"].forEach(function(t){t in e.dataset&&(e[t]=e.dataset[t])})},h=function yallBack(){var t=!1;!t&&b.length&&(t=!0,setTimeout(function(){b.forEach(function(e){e.getBoundingClientRect().top<=window.innerHeight+a&&e.getBoundingClientRect().bottom>=-a&&"none"!=getComputedStyle(e).display&&(n&&c?requestIdleCallback(function(){f(e)},u):f(e),e.classList.remove(r),b=b.filter(function(t){return t!=e}))}),t=!1,b.length||s||o.forEach(function(e){e[0].removeEventListener(e[1],yallBack)})},"throttleTime"in e?e.throttleTime:200))},b=d(document.querySelectorAll(l));if(/(google|bing|yandex|duckduck)bot/i.test(navigator.userAgent))b.forEach(function(e){f(e)});else{if(t){var g=new IntersectionObserver(function(e,t){e.forEach(function(e){if(e.isIntersecting){var o=e.target;n&&c?requestIdleCallback(function(){f(o)},u):f(o),o.classList.remove(r),t.unobserve(o),(b=b.filter(function(e){return e!=o})).length||s||g.disconnect()}})},{rootMargin:a+"px 0%"});b.forEach(function(e){g.observe(e)})}else o.forEach(function(e){e[0].addEventListener(e[1],h)}),h();"MutationObserver"in window&&s&&new MutationObserver(function(e){e.forEach(function(){d(document.querySelectorAll(l)).forEach(function(e){-1==b.indexOf(e)&&(b.push(e),t?g.observe(e):h())})})}).observe(document.querySelector(e.observeRootSelector||"body"),e.mutationObserverOptions||{childList:!0,subtree:!0})}}}();
{
"name": "yall-js",
"version": "2.3.0",
"version": "2.3.1",
"description": "Yet Another Lazy Loader",

@@ -35,5 +35,4 @@ "main": "./dist/yall.js",

"@babel/core": "^7.3.4",
"@babel/plugin-proposal-object-rest-spread": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"eslint": "^5.15.2",
"eslint": "^5.15.3",
"express": "^4.16.4",

@@ -40,0 +39,0 @@ "rimraf": "^2.6.3",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc