kollapsminoriteten/wp-content/plugins/jetpack/_inc/blocks/tiled-gallery/view.js

1 line
11 KiB
JavaScript
Raw Normal View History

2025-12-12 13:13:07 +01:00
(()=>{var t={74993:(t,e,n)=>{"object"==typeof window&&window.Jetpack_Block_Assets_Base_Url&&(n.p=window.Jetpack_Block_Assets_Base_Url)},81204:(t,e,n)=>{"use strict";n.d(e,{hE:()=>r});const r=4},89705:(t,e,n)=>{"use strict";n.d(e,{r:()=>o});var r=n(81204);function i(t,e){const n=(e-t.reduce((t,e)=>t+e,0))/t.length;return t.map(t=>t+n)}function o(t,e){return function(t,[e,n],o){const h=2*r.hE*(t.childElementCount-1),d=o-h;return function(t,{rawHeight:e,rowWidth:n}){const o=s(t),h=o.map(t=>(e-r.hE*(t.childElementCount-1))*a(t)[0]),d=i(h,n);o.forEach((t,n)=>{const o=h[n],s=d[n];!function(t,{colHeight:e,width:n,rawWidth:r}){const o=c(t).map(t=>r/u(t)),s=i(o,e);Array.from(t.children).forEach((t,e)=>{const r=s[e];t.setAttribute("style",`height:${r}px;width:${n}px;`)})}(t,{colHeight:e-r.hE*(t.childElementCount-1),width:s,rawWidth:o})});return d.map(t=>parseFloat(t/n*100).toFixed(5))}(t,{rawHeight:1/e*(d-n),rowWidth:d})}(t,function(t){const e=s(t).map(a).reduce(([t,e],[n,r])=>[t+n,e+r],[0,0]);return e}(t),e)}function s(t){return Array.from(t.querySelectorAll(".tiled-gallery__col"))}function c(t){return Array.from(t.querySelectorAll(".tiled-gallery__item > img, .tiled-gallery__item > a > img"))}function a(t){const e=c(t),n=e.length,r=1/e.map(u).reduce((t,e)=>t+1/e,0);return[r,r*n||1]}function u(t){const e=parseInt(t.dataset.width,10),n=parseInt(t.dataset.height,10);return e&&!Number.isNaN(e)&&n&&!Number.isNaN(n)?e/n:1}},94107:(t,e,n)=>{"use strict";n.d(e,{A:()=>A});var r=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some(function(t,r){return t[0]===e&&(n=r,!0)}),n}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var n=t(this.__entries__,e),r=this.__entries__[n];return r&&r[1]},e.prototype.set=function(e,n){var r=t(this.__entries__,e);~r?this.__entries__[r][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,r=t(n,e);~r&&n.splice(r,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,r=this.__entries__;n<r.length;n++){var i=r[n];t.call(e,i[1],i[0])}},e}()}(),i="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,o="undefined"!=typeof window&&window.Math===Math?window:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),s="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(o):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)};var c=["top","right","bottom","left","width","height","size","weight"],a="undefined"!=typeof MutationObserver,u=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t,e){var n=!1,r=!1,i=0;function o(){n&&(n=!1,t()),r&&a()}function c(){s(o)}function a(){var t=Date.now();if(n){if(t-i<2)return;r=!0}else n=!0,r=!1,setTimeout(c,e);i=t}return a}(this.refresh.bind(this),20)}return t.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},t.prototype.removeObserver=function(t){var e=this.observers_,n=e.indexOf(t);~n&&e.splice(n,1),!e.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},t.prototype.updateObservers_=function(){var t=this.observers_.filter(function(t){return t.gatherActive(),t.hasActive()});return t.forEach(function(t){return t.broadcastActive()}),t.length>0},t.prototype.connect_=function(){i&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),a?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes: