v1/web/modules/contrib/blazy/js/components/grid/blazy.flex.min.js

2 lines
1.2 KiB
JavaScript

!function(h,t,e){"use strict";var i=e,n="b-flex",o="is-b-loading",a=".block-flex",u=0,m=!1,l={$el:null};function s(s){var i,c=".grid",r={},n=h.find(s,c);h.isElm(n)&&(i=h.findAll(s,c),setTimeout(function(){var t=h.rect(s).width,e=h.rect(n).width,o=h.computeStyle(n),o=e+parseFloat(o.marginLeft)+parseFloat(o.marginRight),l=Math.round(1/(o/t));h.each(i,function(n,a){var t=n.target,e=h.isUnd(a);n=t?h.closest(t,c):n,a=e?i.indexOf(n):a;t=function(){var t,e,o,i=h.find(n,c+"__content");h.isElm(i)&&((o=(t=h.rect(i)).height)<60&&(o=(t=h.rect(n)).height),o<60||(e=a%l,i=h.computeStyle(n),h.isUnd(r[e])&&(r[e]=0),n.style.height=o+"px",r[e]+=o+parseFloat(i.marginBottom),0<=a-l&&(o=a-l+1,o=h.find(s,c+":nth-of-type("+o+")"),h.isElm(o)&&(o=h.rect(o).bottom,i=t.top-parseFloat(i.marginBottom),n.style.top="-"+(i-o)+"px"))))};e||m?(m&&(n.style.height="",n.style.top=""),setTimeout(t,m?100:600)):t()}),(t=Math.max.apply(null,Object.values(r)))<0&&(t=u),s.style.height=m?u+360+"px":t+"px",u=t},m?1200:200),m||(h.addClass(s,o),setTimeout(function(){h.removeClass(s,o)},600)),l.$el=s,m=!1)}t.behaviors.blazyFlex={attach:function(t){i=h.context(t),h.once(s,n,a,i)},detach:function(t,e,o){(m="unload"===o)&&h.once.removeSafely(n,a,i)}}}(dBlazy,Drupal,this.document);