forked from aFarkas/lazysizes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ls.unveilhooks.min.js
3 lines (3 loc) · 1.21 KB
/
ls.unveilhooks.min.js
1
2
3
/*! lazysizes - v0.9.0 - 2015-02-06
Licensed MIT */
!function(a,b){"use strict";function c(a,c){if(!f[a]){var d=b.createElement(c?"link":"script"),e=b.getElementsByTagName("script")[0];c?(d.rel="stylesheet",d.href=a):d.src=a,f[a]=!0,f[d.src||d.href]=!0,e.parentNode.insertBefore(d,e)}}var d,e,f={};b.addEventListener&&a.getComputedStyle&&(d=a.lazySizes&&lazySizes.cfg||a.lazySizesConfig||{},e=function(a,c){var d=b.createElement("img");d.onload=function(){d.onload=null,d.onerror=null,d=null,c()},d.onerror=d.onload,d.src=a,d&&d.complete&&d.onload&&d.onload()},addEventListener("lazybeforeunveil",function(b){var d,f,g,h;b.defaultPrevented||("none"==b.target.preload&&(b.target.preload="auto"),d=b.target.getAttribute("data-link"),d&&c(d,!0),d=b.target.getAttribute("data-script"),d&&c(d),d=b.target.getAttribute("data-require"),d&&a.require&&require([d]),g=b.target.getAttribute("data-bg"),g&&(b.details.firesLoad=!0,f=function(){b.target.style.backgroundImage="url("+g+")",b.details.firesLoad=!1,lazySizes.fire(b.target,"_lazyloaded")},e(g,f)),h=b.target.getAttribute("data-poster"),h&&(b.details.firesLoad=!0,f=function(){b.target.poster=h,b.details.firesLoad=!1,lazySizes.fire(b.target,"_lazyloaded")},e(h,f)))},!1))}(window,document);