/*! * progressively 1.1.5 * https://github.com/thinker3197/progressively * @license MIT licensed * * Copyright (C) 2016 Ashish */ !function(e,t){"function"==typeof define&&define.amd?define(function(){return t(e)}):"object"==typeof exports?module.exports=t:e.progressively=t(e)}(this,function(e){"use strict";function t(e,t){var n={};for(var o in e)n[o]=t.hasOwnProperty(o)?t[o]:e[o];return n}function n(e){var t=e.getBoundingClientRect(),n=t.top,o=t.height;e=e.parentNode;do{if(t=e.getBoundingClientRect(),!(n<=t.bottom))return!1;if(n+o<=t.top)return!1;e=e.parentNode}while(e!==document.body&&e!==document);return n<=document.documentElement.clientHeight}function o(e,t){setTimeout(function(){var n=new Image;n.onload=function(){e.classList.remove("progressive--not-loaded"),e.classList.add("progressive--is-loaded"),e.classList.contains("progressive__bg")?e.style["background-image"]='url("'+this.src+'")':e.src=this.src,a(e)},s()=0;--t)e=d[t],n(e)&&(e.classList.contains("progressive--not-loaded")||e.classList.contains("progressive--loaded-sm"))&&(o(e,i),e.classList.contains("progressive--loaded-sm")&&l.push(e),d.splice(t,1));if(s()>=i.smBreakpoint)for(var r=l.length-1;r>=0;--r)e=l[r],n(e)&&(e.classList.contains("progressive--not-loaded")||e.classList.contains("progressive--loaded-sm"))&&(o(e,i),l.splice(t,1));this.check()},u.check=function(){d.length||l.length||(i.onLoadComplete(),this.drop())},u.drop=function(){document.removeEventListener?(e.removeEventListener("scroll",r),e.removeEventListener("resize",r)):(e.detachEvent("onscroll",r),e.detachEvent("onresize",r)),clearTimeout(c)},u});