(function(n){n.fn.unveil=function(t){function f(){var t=o.filter(function(){var t=n(this);if(t.is(":hidden"))return!1;var f=i.scrollTop(),o=f+u,e=t.offset().top,s=e+t.height();return s>=f-r&&e<=o+r});h=t.trigger("unveil");o=o.not(h)}function e(){var t=s.filter(function(){var t=n(this);if(t.is(":hidden"))return!1;var f=i.scrollTop(),o=f+u,e=t.offset().top,s=e+t.height();return s>=f-r&&e<=o+r});c=t.trigger("upgrade");s=s.not(c)}function v(){debounce(u=i.height(),100);f()}function y(){debounce(u=i.height(),100);e()}t=t||{};var i=n(window),l=t.container||i,r=t.threshold||0,u=i.height(),a=t.upgrade||!1,o=this,s=this,h,c;this.one("unveil",function(){var t=n(this),i=t.attr("data-original");i&&(this.nodeName==="IMG"?t.attr("src",i).trigger("unveiled"):t.css("background-image",'url("'+i+'")').trigger("unveiled"))});this.one("upgrade",function(){if(a){var t=n(this),i=t.attr("data-upgrade");i&&(this.nodeName==="IMG"?t.attr("src",i).trigger("upgraded"):t.css("background-image",'url("'+i+'")').trigger("upgraded"))}});l.on({"resize.unveil":debounce(v,100),"resize.upgrade":debounce(y,200),"scroll.unveil":debounce(f,20),"lookup.unveil":debounce(f,20),"scroll.upgrade":debounce(e,1e3),"lookup.upgrade":debounce(e,1e3)});return f(),window.setTimeout(function(){e()},1e3),this}})(window.jQuery)