WordPress/wp-includes/js/imagesloaded.min.js

8 lines
5.5 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
Once upon a midnight dreary, while I coded, weak and weary, In many a strange and curious file of forgotten lore— While I pondered, blaming Nacin, my notifications suddenly awakened, As of someone quietly DMing;—DMing me, I can’t ignore. “’Tis some contributor,” I muttered, “DMing me an idea or four— Only this and nothing more.” Ah, distinctly I remember, at WordCamp US, last December; A mad proposal nearly laid me—down out cold—upon the floor. Curious, I listened closely;—to a plan I agreed with, mostly— A way to make our JavaScript—JavaScript which was a chore— Maintainable, extendable, for the future, is what I saw. Guten-ready for evermore. Open here I switch to Slack, when, with many a patch and hack, In there stepped Omar, a JavaScript developer hardcore; Pronouncing all the changes fit; ready now to be commit; “There’s nothing else for us to do,” DMing me, “It’s done!” he swore— “No longer random guessing at which file need next be explored— Let’s move on, we’re all aboard.” Moved all together, grouped and managed, in folders all is packaged, The code had all been cleaned and tidied, important parts moved to the fore, “Though this change be useful here,” I said, “it is too large, I fear, We couldn’t manage such a patch, we’ve done nothing like this before— Tell me where doth go this change, change to make our codebase soar!” Quoth Omar, “In WordPress Core.” Props omarreis for shepherding this significant change. Props adamsilverstein, aduth, atimmer, dingo_bastard, frank-klein, gziolo, herregroen, jaswrks, jeremyfelt, jipmoors, jorbin, netweb, ocean90, pento, tjnowell, and youknowriad for testing, feedback, discussion, encouragement, commiserations, etc. I make no apologies for this commit message. Fixes #43055. Built from https://develop.svn.wordpress.org/trunk@43309 git-svn-id: http://core.svn.wordpress.org/trunk@43138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-23 12:05:31 +02:00
/*!
* imagesLoaded PACKAGED v4.1.4
Once upon a midnight dreary, while I coded, weak and weary, In many a strange and curious file of forgotten lore— While I pondered, blaming Nacin, my notifications suddenly awakened, As of someone quietly DMing;—DMing me, I can’t ignore. “’Tis some contributor,” I muttered, “DMing me an idea or four— Only this and nothing more.” Ah, distinctly I remember, at WordCamp US, last December; A mad proposal nearly laid me—down out cold—upon the floor. Curious, I listened closely;—to a plan I agreed with, mostly— A way to make our JavaScript—JavaScript which was a chore— Maintainable, extendable, for the future, is what I saw. Guten-ready for evermore. Open here I switch to Slack, when, with many a patch and hack, In there stepped Omar, a JavaScript developer hardcore; Pronouncing all the changes fit; ready now to be commit; “There’s nothing else for us to do,” DMing me, “It’s done!” he swore— “No longer random guessing at which file need next be explored— Let’s move on, we’re all aboard.” Moved all together, grouped and managed, in folders all is packaged, The code had all been cleaned and tidied, important parts moved to the fore, “Though this change be useful here,” I said, “it is too large, I fear, We couldn’t manage such a patch, we’ve done nothing like this before— Tell me where doth go this change, change to make our codebase soar!” Quoth Omar, “In WordPress Core.” Props omarreis for shepherding this significant change. Props adamsilverstein, aduth, atimmer, dingo_bastard, frank-klein, gziolo, herregroen, jaswrks, jeremyfelt, jipmoors, jorbin, netweb, ocean90, pento, tjnowell, and youknowriad for testing, feedback, discussion, encouragement, commiserations, etc. I make no apologies for this commit message. Fixes #43055. Built from https://develop.svn.wordpress.org/trunk@43309 git-svn-id: http://core.svn.wordpress.org/trunk@43138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-23 12:05:31 +02:00
* 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.addEv