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

layzr.js

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

layzr.js - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

dist/layzr.html

4

dist/layzr.min.js
/*!
* Layzr.js 2.0.0 - A small, fast, and modern library for lazy loading images.
* Layzr.js 2.0.1 - A small, fast, and modern library for lazy loading images.
* Copyright (c) 2016 Michael Cavalea - http://callmecavs.github.io/layzr.js/
* License: MIT
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Layzr=e()}}(function(){var e;return function t(e,n,r){function o(u,f){if(!n[u]){if(!e[u]){var s="function"==typeof require&&require;if(!f&&s)return s(u,!0);if(i)return i(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var a=n[u]={exports:{}};e[u][0].call(a.exports,function(t){var n=e[u][1][t];return o(n?n:t)},a,a.exports,t,e,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(t,n,r){(function(o){!function(t){if("object"==typeof r&&"undefined"!=typeof n)n.exports=t();else if("function"==typeof e&&e.amd)e([],t);else{var i;i="undefined"!=typeof window?window:"undefined"!=typeof o?o:"undefined"!=typeof self?self:this,i.Knot=t()}}(function(){return function e(n,r,o){function i(f,s){if(!r[f]){if(!n[f]){var c="function"==typeof t&&t;if(!s&&c)return c(f,!0);if(u)return u(f,!0);var a=new Error("Cannot find module '"+f+"'");throw a.code="MODULE_NOT_FOUND",a}var d=r[f]={exports:{}};n[f][0].call(d.exports,function(e){var t=n[f][1][e];return i(t?t:e)},d,d.exports,e,n,r,o)}return r[f].exports}for(var u="function"==typeof t&&t,f=0;f<o.length;f++)i(o[f]);return i}({1:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return e.events={},e.on=function(t,n){return e.events[t]=e.events[t]||[],e.events[t].push(n),e},e.once=function(t,n){return n._once=!0,e.on(t,n),e},e.off=function(t,n){return 2===arguments.length?e.events[t].splice(e.events[t].indexOf(n),1):delete e.events[t],e},e.emit=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];var i=e.events[t]&&e.events[t].slice();return i&&i.forEach(function(n){n._once&&e.off(t,n),n.apply(e,r)}),e},e},t.exports=n["default"]},{}]},{},[1])(1)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var o=e("knot.js"),i=r(o);n["default"]=function(){function e(){a=window.scrollY||window.pageYOffset,t()}function t(){d||(requestAnimationFrame(function(){return f()}),d=!0)}function n(e){return e.getBoundingClientRect().top+a}function r(e){var t=a,r=t+v,o=n(e),i=o+e.offsetHeight,u=100*p.threshold/v;return i>=t-u&&r+u>=o}function o(e){if(w.emit("src:before",e),m&&e.hasAttribute(p.srcset))e.setAttribute("srcset",e.getAttribute(p.srcset));else{var t=h>1&&e.getAttribute(p.retina);e.setAttribute("src",t||e.getAttribute(p.normal))}w.emit("src:after",e),[p.normal,p.retina,p.srcset].forEach(function(t){return e.removeAttribute(t)}),s()}function u(t){var n=t?"addEventListener":"removeEventListener";return["scroll","resize"].forEach(function(t){return window[n](t,e)}),this}function f(){return v=window.innerHeight,l.forEach(function(e){return r(e)&&o(e)}),d=!1,this}function s(){return l=Array.prototype.slice.call(document.querySelectorAll("["+p.normal+"]")),this}var c=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],a=void 0,d=void 0,l=void 0,v=void 0,p={normal:c.normal||"data-normal",retina:c.retina||"data-retina",srcset:c.srcset||"data-srcset",threshold:c.threshold||0},m=document.body.classList.contains("srcset")||"srcset"in document.createElement("img"),h=window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI,w=(0,i["default"])({handlers:u,check:f,update:s});return w},t.exports=n["default"]},{"knot.js":1}]},{},[2])(2)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Layzr=e()}}(function(){var e;return function t(e,n,r){function o(u,f){if(!n[u]){if(!e[u]){var s="function"==typeof require&&require;if(!f&&s)return s(u,!0);if(i)return i(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var a=n[u]={exports:{}};e[u][0].call(a.exports,function(t){var n=e[u][1][t];return o(n?n:t)},a,a.exports,t,e,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(t,n,r){(function(o){!function(t){if("object"==typeof r&&"undefined"!=typeof n)n.exports=t();else if("function"==typeof e&&e.amd)e([],t);else{var i;i="undefined"!=typeof window?window:"undefined"!=typeof o?o:"undefined"!=typeof self?self:this,i.Knot=t()}}(function(){return function e(n,r,o){function i(f,s){if(!r[f]){if(!n[f]){var c="function"==typeof t&&t;if(!s&&c)return c(f,!0);if(u)return u(f,!0);var a=new Error("Cannot find module '"+f+"'");throw a.code="MODULE_NOT_FOUND",a}var d=r[f]={exports:{}};n[f][0].call(d.exports,function(e){var t=n[f][1][e];return i(t?t:e)},d,d.exports,e,n,r,o)}return r[f].exports}for(var u="function"==typeof t&&t,f=0;f<o.length;f++)i(o[f]);return i}({1:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return e.events={},e.on=function(t,n){return e.events[t]=e.events[t]||[],e.events[t].push(n),e},e.once=function(t,n){return n._once=!0,e.on(t,n),e},e.off=function(t,n){return 2===arguments.length?e.events[t].splice(e.events[t].indexOf(n),1):delete e.events[t],e},e.emit=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];var i=e.events[t]&&e.events[t].slice();return i&&i.forEach(function(n){n._once&&e.off(t,n),n.apply(e,r)}),e},e},t.exports=n["default"]},{}]},{},[1])(1)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var o=e("knot.js"),i=r(o);n["default"]=function(){function e(){a=window.scrollY||window.pageYOffset,t()}function t(){d||(requestAnimationFrame(function(){return f()}),d=!0)}function n(e){return e.getBoundingClientRect().top+a}function r(e){var t=a,r=t+v,o=n(e),i=o+e.offsetHeight,u=p.threshold/100*v;return i>=t-u&&r+u>=o}function o(e){if(w.emit("src:before",e),m&&e.hasAttribute(p.srcset))e.setAttribute("srcset",e.getAttribute(p.srcset));else{var t=h>1&&e.getAttribute(p.retina);e.setAttribute("src",t||e.getAttribute(p.normal))}w.emit("src:after",e),[p.normal,p.retina,p.srcset].forEach(function(t){return e.removeAttribute(t)}),s()}function u(t){var n=t?"addEventListener":"removeEventListener";return["scroll","resize"].forEach(function(t){return window[n](t,e)}),this}function f(){return v=window.innerHeight,l.forEach(function(e){return r(e)&&o(e)}),d=!1,this}function s(){return l=Array.prototype.slice.call(document.querySelectorAll("["+p.normal+"]")),this}var c=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],a=void 0,d=void 0,l=void 0,v=void 0,p={normal:c.normal||"data-normal",retina:c.retina||"data-retina",srcset:c.srcset||"data-srcset",threshold:c.threshold||0},m=document.body.classList.contains("srcset")||"srcset"in document.createElement("img"),h=window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI,w=(0,i["default"])({handlers:u,check:f,update:s});return w},t.exports=n["default"]},{"knot.js":1}]},{},[2])(2)});

@@ -31,2 +31,3 @@ // install from npm, then import

.update() // track initial elements
.check() // check initial elements
.handlers(true) // bind scroll and resize handlers

@@ -33,0 +34,0 @@ })

@@ -24,3 +24,4 @@ // use custom options

.update() // track initial elements
.check() // check initial elements
.handlers(true) // bind scroll and resize handlers
})

@@ -10,3 +10,4 @@ // use the default options

.update() // track initial elements
.check() // check initial elements
.handlers(true) // bind scroll and resize handlers
})
{
"name": "layzr.js",
"version": "2.0.0",
"version": "2.0.1",
"description": "A small, fast, and modern library for lazy loading images.",

@@ -5,0 +5,0 @@ "homepage": "http://callmecavs.github.io/layzr.js/",

@@ -70,3 +70,3 @@ import knot from 'knot.js'

const offset = (settings.threshold * 100) / windowHeight
const offset = (settings.threshold / 100) * windowHeight

@@ -73,0 +73,0 @@ return nodeBot >= viewTop - offset

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