Server IP : 15.235.198.142 / Your IP : 216.73.216.14 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/kim_LIVE/wp-content/themes/oceanwp/assets/src/js/theme/ |
Upload File : |
import InfiniteScroll from "infinite-scroll"; import ResponsiveAutoHeight from "responsive-auto-height"; class OWInfiniteScroll { #elements = { infiniteScrollNav: document.querySelector(".infinite-scroll-nav"), }; #infiniteScroll; constructor() { if ( !!this.#elements.infiniteScrollNav && !!this.#elements.infiniteScrollNav.querySelector(".older-posts a") ) { this.#setElements(); this.#start(); this.#setupEventListeners(); } } #setElements = () => { this.#elements = { ...this.#elements, infiniteScrollWrapper: document.querySelector(".infinite-scroll-wrap"), }; }; #start = () => { this.#infiniteScroll = new InfiniteScroll( this.#elements.infiniteScrollWrapper, { path: ".older-posts a", append: ".item-entry", status: ".scroller-status", hideNav: ".infinite-scroll-nav", history: false, prefill: true, scrollThreshold: 500, } ); }; #setupEventListeners = () => { this.#infiniteScroll.on("load", function (body, path, response) { const items = body.querySelectorAll(".item-entry"); imagesLoaded(items, () => { // Blog masonry isotope if (this.element.classList.contains("blog-masonry-grid")) { oceanwp?.blogMasonry?.isotop.appended(items); // Fix Gallery posts if (!!this.element.querySelector(".gallery-format")) { setTimeout(() => { oceanwp?.blogMasonry?.isotop.layout(); }, 600 + 1); } } // Gallery posts slider if (!document.body.classList.contains("no-carousel")) { oceanwp?.owSlider?.start( this.element.querySelectorAll( ".gallery-format, .product-entry-slider" ) ); } if (!document.body.classList.contains("no-lightbox")) { oceanwp?.owLightbox?.initSingleImageLightbox(); oceanwp?.owLightbox?.initGalleryLightbox(); } // Force the images to be parsed to fix Safari issue items.forEach((item) => { item.querySelectorAll("img")?.forEach((img) => { img.outerHTML = img.outerHTML; }); }); }); }); this.#infiniteScroll.on("append", function (body, path, items, response) { imagesLoaded(items, () => { // Equal height elements if (!document.body.classList.contains("no-matchheight")) { let entryItemsSelectors = Array.from(items).map((item) => { if ( item.id ) { return `#${item.id} .blog-entry-inner`; } else { return; } }); entryItemsSelectors = entryItemsSelectors.filter(function( element ) { return element !== undefined; }); if ( entryItemsSelectors.length > 0 ) { new ResponsiveAutoHeight(entryItemsSelectors.join(",")); } } }); }); }; } ("use script"); window.oceanwp = window.oceanwp || {}; document.addEventListener("DOMContentLoaded", () => { oceanwp.owInfiniteScroll = new OWInfiniteScroll(); });