/*! * imagesLoaded PACKAGED v4.1.3 * JavaScript is all like "You images are done yet or what?" * MIT License */!function(b,a){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",a):"object"==typeof module&&module.exports?module.exports=a():b.EvEmitter=a()}("undefined"!=typeof window?window:this,function(){function b(){}var a=b.prototype;return a.on=function(a,b){if(a&&b){var c=this._events=this._events||{},d=c[a]=c[a]||[];return-1==d.indexOf(b)&&d.push(b),this}},a.once=function(a,b){if(a&&b){this.on(a,b);var c=this._onceEvents=this._onceEvents||{},d=c[a]=c[a]||{};return d[b]=!0,this}},a.off=function(c,d){var a=this._events&&this._events[c],b;if(a&&a.length)return b=a.indexOf(d),-1!=b&&a.splice(b,1),this},a.emitEvent=function(c,d){var b=this._events&&this._events[c],e,a,f,g;if(b&&b.length){e=0,a=b[e],d=d||[];for(f=this._onceEvents&&this._onceEvents[c];a;)g=f&&f[a],g&&(this.off(c,a),delete f[a]),a.apply(this,d),e+=g?0:1,a=b[e];return this}},a.allOff=a.removeAllListeners=function(){delete this._events,delete this._onceEvents},b}),function(a,b){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(c){return b(a,c)}):"object"==typeof module&&module.exports?module.exports=b(a,require("ev-emitter")):a.imagesLoaded=b(a,a.EvEmitter)}("undefined"!=typeof window?window:this,function(f,h){var c,e,g;function i(a,b){for(var c in b)a[c]=b[c];return a}function j(a){var b=[],c;if(Array.isArray(a))b=a;else if("number"==typeof a.length)for(c=0;c<a.length;c++)b.push(a[c]);else b.push(a);return b}function a(b,d,e){return this instanceof a?("string"==typeof b&&(b=document.querySelectorAll(b)),this.elements=j(b),this.options=i({},this.options),"function"==typeof d?e=d:i(this.options,d),e&&this.on("always",e),this.getImages(),c&&(this.jqDeferred=new c.Deferred),void setTimeout(function(){this.check()}.bind(this))):new a(b,d,e)}function b(a){this.img=a}function d(a,b){this.url=a,this.element=b,this.img=new Image}return c=f.jQuery,e=f.console,a.prototype=Object.create(h.prototype),a.prototype.options={},a.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},a.prototype.addElementImages=function(b){var c,d,a,f,e,h;if("IMG"==b.nodeName&&this.addImage(b),this.options.background===!0&&this.addElementBackgroundImages(b),c=b.nodeType,c&&g[c]){for(d=b.querySelectorAll("img"),a=0;a<d.length;a++)f=d[a],this.addImage(f);if("string"==typeof this.options.background){e=b.querySelectorAll(this.options.background);for(a=0;a<e.length;a++)h=e[a],this.addElementBackgroundImages(h)}}},g={1:!0,9:!0,11:!0},a.prototype.addElementBackgroundImages=function(c){var b=getComputedStyle(c),d,a,e;if(b)for(d=/url\((['"])?(.*?)\1\)/gi,a=d.exec(b.backgroundImage);null!==a;)e=a&&a[2],e&&this.addBackground(e,c),a=d.exec(b.backgroundImage)},a.prototype.addImage=function(a){var c=new b(a);this.images.push(c)},a.prototype.addBackground=function(a,b){var c=new d(a,b);this.images.push(c)},a.prototype.check=function(){function a(a,c,d){setTimeout(function(){b.progress(a,c,d)})}var b=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(b){b.once("progress",a),b.check()}):void this.complete()},a.prototype.progress=function(a,b,c){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!a.isLoaded,this.emitEvent("progress",[this,a,b]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,a),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&e&&e.log("progress: "+c,a,b)},a.prototype.complete=function(){var a=this.hasAnyBroken?"fail":"done",b;this.isComplete=!0,this.emitEvent(a,[this]),this.emitEvent("always",[this]),this.jqDeferred&&(b=this.hasAnyBroken?"reject":"resolve",this.jqDeferred[b](this))},b.prototype=Object.create(h.prototype),b.prototype.check=function(){var a=this.getIsImageComplete();return a?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},b.prototype.getIsImageComplete=function(){return this.img.complete&&void 0!==this.img.naturalWidth},b.prototype.confirm=function(a,b){this.isLoaded=a,this.emitEvent("progress",[this,this.img,b])},b.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},b.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},b.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},b.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},d.prototype=Object.create(b.prototype),d.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url;var a=this.getIsImageComplete();a&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},d.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},d.prototype.confirm=function(a,b){this.isLoaded=a,this.emitEvent("progress",[this,this.element,b])},a.makeJQueryPlugin=function(b){b=b||f.jQuery,b&&(c=b,c.fn.imagesLoaded=function(b,d){var e=new a(this,b,d);return e.jqDeferred.promise(c(this))})},a.makeJQueryPlugin(),a})