%PDF- %PDF-
Direktori : /var/www/hudvard.eco-n-tech.co.uk/wp-content/themes/jupiter/assets/js/plugins/async/min/ |
Current File : /var/www/hudvard.eco-n-tech.co.uk/wp-content/themes/jupiter/assets/js/plugins/async/min/minigrid.js |
!function(exports){"use strict";function minigrid(props){var containerEle=props.container instanceof Node?props.container:document.querySelector(props.container);if(!containerEle)return!1;var itemsNodeList=props.item instanceof NodeList?props.item:containerEle.querySelectorAll(props.item);return!(!itemsNodeList||0===itemsNodeList.length)&&(props.containerLoaded&&"string"==typeof props.containerLoaded||(props.containerLoaded=!1),props.containerLoaded&&"string"==typeof props.itemLoaded||(props.itemLoaded=!1),loaded||props.skipWindowOnLoad,void init(containerEle,itemsNodeList,props))}function init(containerEle,itemsNodeList,props){props.containerLoaded?containerEle.classList.add(props.containerLoaded):/loaded/.test(containerEle.className)||containerEle.classList.add(containerEle.className.split(" ")[0]+"--loaded"),loaded=!0;var gutter="number"==typeof props.gutter&&isFinite(props.gutter)&&Math.floor(props.gutter)===props.gutter?props.gutter:0,done=props.done;containerEle.style.width="";var forEach=Array.prototype.forEach,containerWidth=containerEle.getBoundingClientRect().width,firstChildWidth=itemsNodeList[0].getBoundingClientRect().width+gutter,cols=Math.max(Math.floor((containerWidth-gutter)/firstChildWidth),1),isRTL="rtl"===getComputedStyle(containerEle,null).getPropertyValue("direction"),count=0;containerWidth=firstChildWidth*cols+gutter+"px",containerEle.style.width=containerWidth,containerEle.style.position="relative";for(var itemsGutter=[],itemsPosX=[],g=0;g<cols;++g)itemsPosX.push(g*firstChildWidth+gutter),itemsGutter.push(gutter);isRTL&&itemsPosX.reverse(),forEach.call(itemsNodeList,function(item){var itemIndex=itemsGutter.slice(0).sort(function(a,b){return a-b}).shift();itemIndex=itemsGutter.indexOf(itemIndex);var posX=itemsPosX[itemIndex],posY=itemsGutter[itemIndex];if(item.style.position="absolute",item.style.webkitBackfaceVisibility=item.style.backfaceVisibility="hidden",props.itemLoaded?item.classList.add(props.itemLoaded):/loaded/.test(item.className)||item.classList.add(item.className.split(" ")[0]+"--loaded"),!props.animate&&transformProp&&(item.style.top=posY+"px",item.style.left=posX+"px"),itemsGutter[itemIndex]+=item.getBoundingClientRect().height+gutter,count+=1,props.animate)return props.animate(item,posX,posY,count)});var containerHeight=itemsGutter.slice(0).sort(function(a,b){return a-b}).pop();containerEle.style.height=containerHeight+"px","function"==typeof done&&done(itemsNodeList)}var transformProp,loaded;!function(){var style=document.createElement("a").style,prop;void 0!==style[prop="webkitTransform"]&&(transformProp=prop),void 0!==style[prop="msTransform"]&&(transformProp=prop),void 0!==style[prop="transform"]&&(transformProp=prop)}(),"function"==typeof define&&define.amd?define(function(){return minigrid}):"undefined"!=typeof module&&module.exports?module.exports=minigrid:exports.minigrid=minigrid}(this);