Current Path : /home/e/p/h/ephorei/www/wp-content/plugins/ultimate-addons-for-gutenberg/assets/js/ |
Current File : /home/e/p/h/ephorei/www/wp-content/plugins/ultimate-addons-for-gutenberg/assets/js/post.min.js |
let loadStatus=!0;function uagb_carousel_height(e){e=document.querySelector("#wpwrap .is-carousel.uagb-block-"+e);e&&window.UAGBPostCarousel._setHeight(e)}function uagb_carousel_unset_height(e){e=document.querySelector("#wpwrap .is-carousel.uagb-block-"+e);e&&window.UAGBPostCarousel._unSetHeight(e)}window.UAGBPostCarousel={_setHeight(e){if(0<e.length){const s=e[0].querySelectorAll(".slick-slide"),l=e[0].querySelectorAll(".slick-slide.slick-active");let a=-1,o=-1,n=-1,r=(Object.keys(l).forEach(e=>{var t=l[e].offsetHeight,e=l[e].querySelector(".uagb-post__inner-wrap")?.offsetHeight;a<e&&(a=e,n=a+15),o<t&&(o=t)}),Object.keys(l).forEach(e=>{const t=l[e].querySelector(".uagb-post__inner-wrap");t&&(t.style.height=a+"px")}),e[0].querySelector(".slick-list"));r&&(r.style.height=n+"px"),a=-1,o=-1,Object.keys(s).forEach(e=>{const t=s[e];if(t.classList.contains("slick-active"))return!0;e=(r=t.querySelector(".uagb-post__inner-wrap"))?.offsetHeight;e&&(r.style.height=e+"px")})}},_unSetHeight(e){if(0<e.length){const o=e[0].querySelectorAll(".slick-slide"),a=e[0].querySelectorAll(".slick-slide.slick-active");Object.keys(a).forEach(e=>{const t=a[e].querySelector(".uagb-post__inner-wrap");t.style.height="auto"}),Object.keys(a).forEach(e=>{const t=o[e];if(t.classList.contains("slick-active"))return!0;const a=t.querySelector(".uagb-post__inner-wrap");a.style.height="auto"})}}},window.UAGBPostMasonry={_init(o,e){let n=2;const r=window.innerHeight/1.25;let s=document.querySelector(e);const l=s?.querySelectorAll(".uagb-post-inf-loader");"none"!==o.paginationType&&"scroll"===o.paginationEventType&&window.addEventListener("scroll",function(){let e=s.querySelector(".uagb-post__items");var t,a=(e=e||s).lastElementChild.getBoundingClientRect().top+window.scrollY;window.pageYOffset+r>=a&&(a={page_number:n},t=s.getAttribute("data-total"),!0===loadStatus&&n<=t&&(0<l.length&&(l[0].style.display="none"),window.UAGBPostMasonry._callAjax(s,a,o,l,!1,n),n++,loadStatus=!1))}),"button"===o.paginationEventType&&s?.querySelector(".uagb-post-pagination-button")&&(s.style.marginBottom="40px",s.querySelector(".uagb-post-pagination-button").onclick=function(){var e=(s=this.closest(".uagb-post-grid")).getAttribute("data-total"),t={total:e,page_number:n};s.querySelector(".uagb-post__load-more-wrap").style.display="none",!0===loadStatus&&n<=e&&(0<l.length&&(l[0].style.display="none"),s.querySelector(".uagb-post__load-more-wrap").style.display="block",window.UAGBPostMasonry._callAjax(s,t,o,l,!0,n),n++,loadStatus=!1)})},createElementFromHTML(e){const t=document.createElement("div");return t.innerHTML=e.trim(),t},_callAjax(l,i,c,u,g=!1,p){const e=new FormData;e.append("action","uagb_get_posts"),e.append("nonce",uagb_data.uagb_masonry_ajax_nonce),e.append("page_number",i.page_number),e.append("attr",JSON.stringify(c)),fetch(uagb_data.ajax_url,{method:"POST",credentials:"same-origin",body:e}).then(e=>e.json()).then(function(r){let s=l.querySelector(".is-masonry");s=s||l,setTimeout(function(){const e=new Isotope(s,{itemSelector:"article"});e.insert(window.UAGBPostMasonry.createElementFromHTML(r.data)),loadStatus=!0,0<u.length&&(u[0].style.display="none"),!0===g&&(l.querySelector(".uagb-post__load-more-wrap").style.display="block"),p===parseInt(i.total)&&(l.querySelector(".uagb-post__load-more-wrap").style.display="none");for(const o of document.querySelectorAll(".uagb-post__image-position-background .uagb-post__inner-wrap")){var t=o.offsetWidth,a=c.rowGap,t=100-a/t*100;const n=o.getElementsByClassName("uagb-post__image");n[0]&&(n[0].style.width=t+"%",n[0].style.marginLeft=a/2+"px")}},500)}).catch(function(e){})}},window.UAGBPostGrid={_callAjax(r,e,s){const t=new FormData;t.append("action","uagb_post_pagination_grid"),t.append("nonce",uagb_data.uagb_grid_ajax_nonce),t.append("page_number",e),t.append("attr",JSON.stringify(r)),fetch(uagb_data.ajax_url,{method:"POST",credentials:"same-origin",body:t}).then(e=>e.json()).then(function(e){const t=document.querySelector(".uagb-block-"+s);if(t){const o=e.data.replace(/\n|\t/g,"");e=(t.outerHTML=o).match(/uagb-block-([\w-]+)/)?.[1]||"";{var a=e;const n=document.querySelectorAll(`.uagb-post-grid.uagb-block-${a} .uagb-post-pagination-wrap a`);n.forEach(e=>{e.addEventListener("click",e=>{e.preventDefault();const t=e.target.getAttribute("href").match(/admin-ajax.*/)?.[0]||"";e=t.match(/\d+/)?.[0]||1;window.UAGBPostGrid._callAjax(r,parseInt(e),a)})})}}else;})}};