biofriction-wp-theme/node_modules/foundation-sites/dist/js/plugins/foundation.equalizer.min.js

3 lines
8.0 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./foundation.core"),require("./foundation.core.plugin"),require("./foundation.core.utils"),require("./foundation.util.imageLoader"),require("./foundation.util.mediaQuery"),require("jquery")):"function"==typeof define&&define.amd?define(["./foundation.core","./foundation.core.plugin","./foundation.core.utils","./foundation.util.imageLoader","./foundation.util.mediaQuery","jquery"],t):"object"==typeof exports?exports["foundation.equalizer"]=t(require("./foundation.core"),require("./foundation.core.plugin"),require("./foundation.core.utils"),require("./foundation.util.imageLoader"),require("./foundation.util.mediaQuery"),require("jquery")):(e.__FOUNDATION_EXTERNAL__=e.__FOUNDATION_EXTERNAL__||{},e.__FOUNDATION_EXTERNAL__["foundation.equalizer"]=t(e.__FOUNDATION_EXTERNAL__["foundation.core"],e.__FOUNDATION_EXTERNAL__["foundation.core"],e.__FOUNDATION_EXTERNAL__["foundation.core"],e.__FOUNDATION_EXTERNAL__["foundation.util.imageLoader"],e.__FOUNDATION_EXTERNAL__["foundation.util.mediaQuery"],e.jQuery))}(window,function(i,n,o,r,u,a){return function(i){var n={};function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return i[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=i,o.c=n,o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(o.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(i,n,function(e){return t[e]}.bind(null,n));return i},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=6)}({"./foundation.core":function(e,t){e.exports=i},"./foundation.core.plugin":function(e,t){e.exports=n},"./foundation.core.utils":function(e,t){e.exports=o},"./foundation.util.imageLoader":function(e,t){e.exports=r},"./foundation.util.mediaQuery":function(e,t){e.exports=u},"./js/entries/plugins/foundation.equalizer.js":function(e,t,i){"use strict";i.r(t);var n=i("./foundation.core");i.d(t,"Foundation",function(){return n.Foundation});var o=i("./js/foundation.equalizer.js");i.d(t,"Equalizer",function(){return o.Equalizer}),n.Foundation.plugin(o.Equalizer,"Equalizer")},"./js/foundation.equalizer.js":function(e,t,i){"use strict";i.r(t),i.d(t,"Equalizer",function(){return p});var n=i("jquery"),d=i.n(n),r=i("./foundation.util.mediaQuery"),u=i("./foundation.util.imageLoader"),a=i("./foundation.core.utils"),s=i("./foundation.core.plugin");function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var p=function(e){function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),f(this,h(i).apply(this,arguments))}var t,n,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(i,s["Plugin"]),t=i,(n=[{key:"_setup",value:function(e,t){this.$element=e,this.options=d.a.extend({},i.defaults,this.$element.data(),t),this.className="Equalizer",this._init()}},{key:"_init",value:function(){var e=this.$element.attr("data-equalizer")||"",t=this.$element.find('[data-equalizer-watch="'.concat(e,'"]'));r.MediaQuery._init(),this.$watched=t.length?t:this.$element.find("[data-equalizer-watch]"),this.$element.attr("data-resize",e||Object(a.GetYoDigits)(6,"eq")),this.$element.attr("data-mutate",e||Object(a.GetYoDigits)(6,"eq")),this.hasNested=0<this.$element.find("[data-equalizer]").length,this.isNested=0<this.$element.parentsUntil(document.body,"[data-equalizer]").length,this.isOn=!1,this._bindHandler={onResizeMeBound:this._onResizeMe.bind(this),onPostEqualizedBound:this._onPostEqualized.bind(this)};var i,n=this.$element.find("img");this.options.equalizeOn?(i=this._checkMQ(),d()(window).on("changed.zf.mediaquery",this._checkMQ.bind(this))):this._events(),(void 0!==i&&!1===i||void 0===i)&&(n.length?Object(u.onImagesLoaded)(n,this._reflow.bind(this)):this._reflow())}},{key:"_pauseEvents",value:function(){this.isOn=!1,this.$element.off({".zf.equalizer":this._bindHandler.onPostEqualizedBound,"resizeme.zf.trigger":this._bindHandler.onResizeMeBound,"mutateme.zf.trigger":this._bindHandler.onResizeMeBound})}},{key:"_onResizeMe",value:function(e){this._reflow()}},{key:"_onPostEqualized",value:function(e){e.target!==this.$element[0]&&this._reflow()}},{key:"_events",value:function(){this._pauseEvents(),this.hasNested?this.$element.on("postequalized.zf.equalizer",this._bindHandler.onPostEqualizedBound):(this.$element.on("resizeme.zf.trigger",this._bindHandler.onResizeMeBound),this.$element.on("mutateme.zf.trigger",this._bindHandler.onResizeMeBound)),this.isOn=!0}},{key:"_checkMQ",value:function(){var e=!r.MediaQuery.is(this.options.equalizeOn);return e?this.isOn&&(this._pauseEvents(),this.$watched.css("height","auto")):this.isOn||this._events(),e}},{key:"_killswitch",value:function(){}},{key:"_reflow",value:function(){if(!this.options.equalizeOnStack&&this._isStacked())return this.$watched.css("height","auto"),!1;this.options.equalizeByRow?this.getHeightsByRow(this.applyHeightByRow.bind(this)):this.getHeights(this.applyHeight.bind(this))}},{key:"_isStacked",value:function(){return!this.$watched[0]||!this.$watched[1]||this.$watched[0].getBoundingClientRect().top!==this.$watched[1].getBoundingClientRect().top}},{key:"getHeights",value:function(e){for(var t=[],i=0,n=this.$watched.length;i<n;i++)this.$watched[i].style.height="auto",t.push(this.$watched[i].offsetHeight);e(t)}},{key:"getHeightsByRow",value:function(e){var t=this.$watched.length?this.$watched.first().offset().top:0,i=[],n=0;i[n]=[];for(var o=0,r=this.$watched.length;o<r;o++){this.$watched[o].style.height="auto";var u=d()(this.$watched[o]).offset().top;u!=t&&(i[++n]=[],t=u),i[n].push([this.$watched[o],this.$watched[o].offsetHeight])}for(var a=0,s=i.length;a<s;a++){var l=d()(i[a]).map(function(){return this[1]}).get(),f=Math.max.apply(null,l);i[a].push(f)}e(i)}},{key:"applyHeight",value:function(e){var t=Math.max.apply(null,e);this.$element.trigger("preequalized.zf.equalizer"),this.$watched.css("height",t),this.$element.trigger("postequalized.zf.equalizer")}},{key:"applyHeightByRow",value:function(e){this.$element.trigger("preequalized.zf.equalizer");for(var t=0,i=e.length;t<i;t++){var n=e[t].length,o=e[t][n-1];if(n<=2)d()(e[t][0][0]).css({height:"auto"});else{this.$element.trigger("preequalizedrow.zf.equalizer");for(var r=0,u=n-1;r<u;r++)d()(e[t][r][0]).css({height:o});this.$element.trigger("postequalizedrow.zf.equalizer")}}this.$element.trigger("postequalized.zf.equalizer")}},{key:"_destroy",value:function(){this._pauseEvents(),this.$watched.css("height","auto")}}])&&l(t.prototype,n),o&&l(t,o),i}();p.defaults={equalizeOnStack:!1,equalizeByRow:!1,equalizeOn:""}},6:function(e,t,i){e.exports=i("./js/entries/plugins/foundation.equalizer.js")},jquery:function(e,t){e.exports=a}})});
//# sourceMappingURL=foundation.equalizer.min.js.map