/*! * imagesloaded packaged v4.1.4 * javascript is all like "you images are done yet or what?" * mit license */ !function (e, t) { "function" == typeof define && define.amd ? define("ev-emitter/ev-emitter", t) : "object" == typeof module && module.exports ? module.exports = t() : e.evemitter = t() }("undefined" != typeof window ? window : this, function () { function e() { } var t = e.prototype; return t.on = function (e, t) { if (e && t) { var i = this._events = this._events || {}, n = i[e] = i[e] || []; return n.indexof(t) == -1 && n.push(t), this } }, t.once = function (e, t) { if (e && t) { this.on(e, t); var i = this._onceevents = this._onceevents || {}, n = i[e] = i[e] || {}; return n[t] = !0, this } }, t.off = function (e, t) { var i = this._events && this._events[e]; if (i && i.length) { var n = i.indexof(t); return n != -1 && i.splice(n, 1), this } }, t.emitevent = function (e, t) { var i = this._events && this._events[e]; if (i && i.length) { i = i.slice(0), t = t || []; for (var n = this._onceevents && this._onceevents[e], o = 0; o < i.length; o++) { var r = i[o], s = n && n[r]; s && (this.off(e, r), delete n[r]), r.apply(this, t) } return this } }, t.alloff = function () { delete this._events, delete this._onceevents }, e }), function (e, t) { "use strict"; "function" == typeof define && define.amd ? define(["ev-emitter/ev-emitter"], function (i) { return t(e, i) }) : "object" == typeof module && module.exports ? module.exports = t(e, require("ev-emitter")) : e.imagesloaded = t(e, e.evemitter) }("undefined" != typeof window ? window : this, function (e, t) { function i(e, t) { for (var i in t) e[i] = t[i]; return e } function n(e) { if (array.isarray(e)) return e; var t = "object" == typeof e && "number" == typeof e.length; return t ? d.call(e) : [e] } function o(e, t, r) { if (!(this instanceof o)) return new o(e, t, r); var s = e; return "string" == typeof e && (s = document.queryselectorall(e)), s ? (this.elements = n(s), this.options = i({}, this.options), "function" == typeof t ? r = t : i(this.options, t), r && this.on("always", r), this.getimages(), h && (this.jqdeferred = new h.deferred), void settimeout(this.check.bind(this))) : void a.error("bad element for imagesloaded " + (s || e)) } function r(e) { this.img = e } function s(e, t) { this.url = e, this.element = t, this.img = new image } var h = e.jquery, a = e.console, d = array.prototype.slice; o.prototype = object.create(t.prototype), o.prototype.options = {}, o.prototype.getimages = function () { this.images = [], this.elements.foreach(this.addelementimages, this) }, o.prototype.addelementimages = function (e) { "img" == e.nodename && this.addimage(e), this.options.background === !0 && this.addelementbackgroundimages(e); var t = e.nodetype; if (t && u[t]) { for (var i = e.queryselectorall("img"), n = 0; n < i.length; n++) { var o = i[n]; this.addimage(o) } if ("string" == typeof this.options.background) { var r = e.queryselectorall(this.options.background); for (n = 0; n < r.length; n++) { var s = r[n]; this.addelementbackgroundimages(s) } } } }; var u = { 1: !0, 9: !0, 11: !0 }; return o.prototype.addelementbackgroundimages = function (e) { var t = getcomputedstyle(e); if (t) for (var i = /url\((['"])?(.*?)\1\)/gi, n = i.exec(t.backgroundimage) ; null !== n;) { var o = n && n[2]; o && this.addbackground(o, e), n = i.exec(t.backgroundimage) } }, o.prototype.addimage = function (e) { var t = new r(e); this.images.push(t) }, o.prototype.addbackground = function (e, t) { var i = new s(e, t); this.images.push(i) }, o.prototype.check = function () { function e(e, i, n) { settimeout(function () { t.progress(e, i, n) }) } var t = this; return this.progressedcount = 0, this.hasanybroken = !1, this.images.length ? void this.images.foreach(function (t) { t.once("progress", e), t.check() }) : void this.complete() }, o.prototype.progress = function (e, t, i) { this.progressedcount++, this.hasanybroken = this.hasanybroken || !e.isloaded, this.emitevent("progress", [this, e, t]), this.jqdeferred && this.jqdeferred.notify && this.jqdeferred.notify(this, e), this.progressedcount == this.images.length && this.complete(), this.options.debug && a && a.log("progress: " + i, e, t) }, o.prototype.complete = function () { var e = this.hasanybroken ? "fail" : "done"; if (this.iscomplete = !0, this.emitevent(e, [this]), this.emitevent("always", [this]), this.jqdeferred) { var t = this.hasanybroken ? "reject" : "resolve"; this.jqdeferred[t](this) } }, r.prototype = object.create(t.prototype), r.prototype.check = function () { var e = this.getisimagecomplete(); return e ? 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)) }, r.prototype.getisimagecomplete = function () { return this.img.complete && this.img.naturalwidth }, r.prototype.confirm = function (e, t) { this.isloaded = e, this.emitevent("progress", [this, this.img, t]) }, r.prototype.handleevent = function (e) { var t = "on" + e.type; this[t] && this[t](e) }, r.prototype.onload = function () { this.confirm(!0, "onload"), this.unbindevents() }, r.prototype.onerror = function () { this.confirm(!1, "onerror"), this.unbindevents() }, r.prototype.unbindevents = function () { this.proxyimage.removeeventlistener("load", this), this.proxyimage.removeeventlistener("error", this), this.img.removeeventlistener("load", this), this.img.removeeventlistener("error", this) }, s.prototype = object.create(r.prototype), s.prototype.check = function () { this.img.addeventlistener("load", this), this.img.addeventlistener("error", this), this.img.src = this.url; var e = this.getisimagecomplete(); e && (this.confirm(0 !== this.img.naturalwidth, "naturalwidth"), this.unbindevents()) }, s.prototype.unbindevents = function () { this.img.removeeventlistener("load", this), this.img.removeeventlistener("error", this) }, s.prototype.confirm = function (e, t) { this.isloaded = e, this.emitevent("progress", [this, this.element, t]) }, o.makejqueryplugin = function (t) { t = t || e.jquery, t && (h = t, h.fn.imagesloaded = function (e, t) { var i = new o(this, e, t); return i.jqdeferred.promise(h(this)) }) }, o.makejqueryplugin(), o });