()
| 24 | * MIT License |
| 25 | */ |
| 26 | (function(){function a(){}function g(h,j){for(var i=h.length;i--;){if(h[i].listener===j){return i}}return -1}function c(h){return function(){return this[h].apply(this,arguments)}}var b=a.prototype,f=this,d=f.EventEmitter;b.getListeners=function(h){var l,k,j=this._getEvents();if("object"==typeof h){l={};for(k in j){j.hasOwnProperty(k)&&h.test(k)&&(l[k]=j[k])}}else{l=j[h]||(j[h]=[])}return l},b.flattenListeners=function(h){var j,i=[];for(j=0;j<h.length;j+=1){i.push(h[j].listener)}return i},b.getListenersAsObject=function(h){var j,i=this.getListeners(h);return i instanceof Array&&(j={},j[h]=i),j||i},b.addListener=function(h,k){var j,m=this.getListenersAsObject(h),l="object"==typeof k;for(j in m){m.hasOwnProperty(j)&&-1===g(m[j],k)&&m[j].push(l?k:{listener:k,once:!1})}return this},b.on=c("addListener"),b.addOnceListener=function(h,i){return this.addListener(h,{listener:i,once:!0})},b.once=c("addOnceListener"),b.defineEvent=function(h){return this.getListeners(h),this},b.defineEvents=function(h){for(var i=0;i<h.length;i+=1){this.defineEvent(h[i])}return this},b.removeListener=function(h,k){var j,m,l=this.getListenersAsObject(h);for(m in l){l.hasOwnProperty(m)&&(j=g(l[m],k),-1!==j&&l[m].splice(j,1))}return this},b.off=c("removeListener"),b.addListeners=function(h,i){return this.manipulateListeners(!1,h,i)},b.removeListeners=function(h,i){return this.manipulateListeners(!0,h,i)},b.manipulateListeners=function(h,q,k){var j,m,l=h?this.removeListener:this.addListener,p=h?this.removeListeners:this.addListeners;if("object"!=typeof q||q instanceof RegExp){for(j=k.length;j--;){l.call(this,q,k[j])}}else{for(j in q){q.hasOwnProperty(j)&&(m=q[j])&&("function"==typeof m?l.call(this,j,m):p.call(this,j,m))}}return this},b.removeEvent=function(h){var l,k=typeof h,j=this._getEvents();if("string"===k){delete j[h]}else{if("object"===k){for(l in j){j.hasOwnProperty(l)&&h.test(l)&&delete j[l]}}else{delete this._events}}return this},b.removeAllListeners=c("removeEvent"),b.emitEvent=function(h,q){var k,j,m,l,p=this.getListenersAsObject(h);for(m in p){if(p.hasOwnProperty(m)){for(j=p[m].length;j--;){k=p[m][j],k.once===!0&&this.removeListener(h,k.listener),l=k.listener.apply(this,q||[]),l===this._getOnceReturnValue()&&this.removeListener(h,k.listener)}}}return this},b.trigger=c("emitEvent"),b.emit=function(h){var i=Array.prototype.slice.call(arguments,1);return this.emitEvent(h,i)},b.setOnceReturnValue=function(h){return this._onceReturnValue=h,this},b._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},b._getEvents=function(){return this._events||(this._events={})},a.noConflict=function(){return f.EventEmitter=d,a},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return a}):"object"==typeof module&&module.exports?module.exports=a:this.EventEmitter=a}).call(this),function(a){function g(h){var e=a.event;return e.target=e.target||e.srcElement||h,e}var c=document.documentElement,b=function(){};c.addEventListener?b=function(h,j,i){h.addEventListener(j,i,!1)}:c.attachEvent&&(b=function(h,k,j){h[k+j]=j.handleEvent?function(){var e=g(h);j.handleEvent.call(j,e)}:function(){var e=g(h);j.call(h,e)},h.attachEvent("on"+k,h[k+j])});var f=function(){};c.removeEventListener?f=function(h,j,i){h.removeEventListener(j,i,!1)}:c.detachEvent&&(f=function(h,l,k){h.detachEvent("on"+l,h[l+k]);try{delete h[l+k]}catch(j){h[l+k]=void 0}});var d={bind:b,unbind:f};"function"==typeof define&&define.amd?define("eventie/eventie",d):a.eventie=d}(this),function(a,b){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(d,c){return b(a,d,c)}):"object"==typeof exports?module.exports=b(a,require("wolfy87-eventemitter"),require("eventie")):a.imagesLoaded=b(a,a.EventEmitter,a.eventie)}(window,function(k,z,q){function p(a,d){for(var c in d){a[c]=d[c]}return a}function x(a){return"[object Array]"===j.call(a)}function w(a){var f=[];if(x(a)){f=a}else{if("number"==typeof a.length){for(var d=0,c=a.length;c>d;d++){f.push(a[d])}}else{f.push(a)}}return f}function y(a,f,c){if(!(this instanceof y)){return new y(a,f)}"string"==typeof a&&(a=document.querySelectorAll(a)),this.elements=w(a),this.options=p({},this.options),"function"==typeof f?c=f:p(this.options,f),c&&this.on("always",c),this.getImages(),b&&(this.jqDeferred=new b.Deferred);var d=this;setTimeout(function(){d.check()})}function l(a){this.img=a}function g(a){this.src=a,B[a]=this}var b=k.jQuery,A=k.console,m="undefined"!=typeof A,j=Object.prototype.toString;y.prototype=new z,y.prototype.options={},y.prototype.getImages=function(){this.images=[];for(var a=0,D=this.elements.length;D>a;a++){var h=this.elements[a];"IMG"===h.nodeName&&this.addImage(h);var d=h.nodeType;if(d&&(1===d||9===d||11===d)){for(var v=h.querySelectorAll("img"),u=0,C=v.length;C>u;u++){var c=v[u];this.addImage(c)}}}},y.prototype.addImage=function(a){var c=new l(a);this.images.push(c)},y.prototype.check=function(){function a(i,n){return s.options.debug&&m&&A.log("confirm",i,n),s.progress(i),d++,d===c&&s.complete(),!0}var s=this,d=0,c=this.images.length;if(this.hasAnyBroken=!1,!c){return void this.complete()}for(var h=0;c>h;h++){var f=this.images[h];f.on("confirm",a),f.check()}},y.prototype.progress=function(a){this.hasAnyBroken=this.hasAnyBroken||!a.isLoaded;var c=this;setTimeout(function(){c.emit("progress",c,a),c.jqDeferred&&c.jqDeferred.notify&&c.jqDeferred.notify(c,a)})},y.prototype.complete=function(){var a=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var c=this;setTimeout(function(){if(c.emit(a,c),c.emit("always",c),c.jqDeferred){var d=c.hasAnyBroken?"reject":"resolve";c.jqDeferred[d](c)}})},b&&(b.fn.imagesLoaded=function(a,d){var c=new y(this,a,d);return c.jqDeferred.promise(b(this))}),l.prototype=new z,l.prototype.check=function(){var a=B[this.img.src]||new g(this.img.src);if(a.isConfirmed){return void this.confirm(a.isLoaded,"cached was confirmed")}if(this.img.complete&&void 0!==this.img.naturalWidth){return void this.confirm(0!==this.img.naturalWidth,"naturalWidth")}var c=this;a.on("confirm",function(d,f){return c.confirm(d.isLoaded,f),!0}),a.check()},l.prototype.confirm=function(a,c){this.isLoaded=a,this.emit("confirm",this,c)};var B={};return g.prototype=new z,g.prototype.check=function(){if(!this.isChecked){var a=new Image;q.bind(a,"load",this),q.bind(a,"error",this),a.src=this.src,this.isChecked=!0}},g.prototype.handleEvent=function(a){var c="on"+a.type;this[c]&&this[c](a)},g.prototype.onload=function(a){this.confirm(!0,"onload"),this.unbindProxyEvents(a)},g.prototype.onerror=function(a){this.confirm(!1,"onerror"),this.unbindProxyEvents(a)},g.prototype.confirm=function(a,c){this.isConfirmed=!0,this.isLoaded=a,this.emit("confirm",this,c)},g.prototype.unbindProxyEvents=function(a){q.unbind(a.target,"load",this),q.unbind(a.target,"error",this)},y}); |
| 27 | /* |
| 28 | * Retina.js v1.3.0 |
| 29 | * |
no outgoing calls
no test coverage detected