1 line
1.5 KiB
JavaScript
1 line
1.5 KiB
JavaScript
document.addEventListener("DOMContentLoaded",function(){var t,e,n,r=document.querySelector(".masonry-container");r&&(t=new Masonry(r,generateBlog.masonryInit),e=document.querySelector("#nav-below"),n=document.querySelector(".load-more"),imagesLoaded(r,function(){t.layout(),r.classList.remove("are-images-unloaded"),n&&n.classList.remove("are-images-unloaded"),e&&(e.style.opacity=1)}),e&&r.parentNode.insertBefore(e,r.nextSibling),window.addEventListener("orientationchange",function(){t.layout()}));var a,i,l,o,c,d=document.querySelector(".infinite-scroll"),u=document.querySelector(".infinite-scroll-path a");d&&u&&(a=document.querySelectorAll(".infinite-scroll-item")[0].parentNode,i=document.querySelector(".load-more a"),l="",generateBlog.icon&&(l=generateBlog.icon),(o=generateBlog.infiniteScrollInit).outlayer=t,c=new InfiniteScroll(a,o),i&&i.addEventListener("click",function(e){document.activeElement.blur(),e.target.innerHTML=l+generateBlog.loading,e.target.classList.add("loading")}),c.on("append",function(e,n,o){i&&!document.querySelector(".generate-columns-container")&&a.appendChild(i.parentNode),o.forEach(function(e){var n=e.querySelectorAll("img");n&&n.forEach(function(e){var n=e.outerHTML;e.outerHTML=n})}),r&&t&&imagesLoaded(r,function(){t.layout()}),i&&(i.innerHTML=l+generateBlog.more,i.classList.remove("loading")),document.body.dispatchEvent(new Event("post-load"))}),c.on("last",function(){var e=document.querySelector(".load-more");e&&(e.style.display="none")}))}); |