1(()=> { 2window.BreakdancePostsList={ 3loadMorePostsInit, 4infiniteScrollInit 5}; 6async function loadMorePostsAndAppend({ 7selector, 8postId, 9id, 10paged, 11ssrFilePath 12}){ 13const body=new FormData(); 14body.append("action", "breakdance_posts_pagination_load_more"); 15body.append("postId", postId); 16body.append("elementId", id); 17body.append("paged", `${paged}`); 18body.append("ssrFilePath", ssrFilePath); 19const { makeAjaxRequest }=window.BreakdanceFrontend.utils; 20const response=await makeAjaxRequest(BreakdanceFrontend.data.ajaxUrl, { 21method: "POST", 22credentials: "same-origin", 23body 24}) 25.then(res=> res.json()) 26.then(data=> data?.data) 27.catch(e=> { 28console.error(e); 29}); 30if(response?.html){ 31const element=document.querySelector(selector); 32const container=element.querySelector(".ee-posts"); 33const parser=new DOMParser(); 34const parsedDocument=parser.parseFromString(response.html, "text/html"); 35const newPosts=parsedDocument.querySelectorAll(".ee-post"); 36const fragment=document.createDocumentFragment(); 37newPosts.forEach((post)=> { 38fragment.appendChild(post); 39}); 40container.appendChild(fragment); 41const event=new CustomEvent("breakdance_infinite_scroll_loaded", { 42detail: newPosts 43}); 44element.dispatchEvent(event); 45} 46if(response?.inlineScripts){ 47response.inlineScripts.forEach(scriptText=> { 48const scriptEle=document.createElement("script"); 49scriptEle.textContent=scriptText; 50document.body.appendChild(scriptEle); 51}); 52} 53return response; 54} 55function loadMorePostsInit({ selector, postId, id }){ 56const loadMoreButton=document.querySelector(`${selector} .bde-posts-pagination-loadmore-button` 57); 58if(!loadMoreButton) return; 59const ssrFilePath = 60loadMoreButton.closest("[data-ssr-path]")?.dataset.ssrPath||""; 61let paged=1; 62loadMoreButton.addEventListener("click", async function(){ 63paged++; 64loadMoreButton.classList.add("is-loading"); 65const response=await loadMorePostsAndAppend({ 66selector, 67postId, 68id, 69paged, 70ssrFilePath 71}); 72if(!response||!response.html||response.maxNumberOfPages <=paged){ 73loadMoreButton.style.display="none"; 74return; 75} 76loadMoreButton.classList.remove("is-loading"); 77}); 78} 79function throttle(func, timeFrame){ 80let lastTime=0; 81return function(...args){ 82const now=new Date(); 83if(now - lastTime >=timeFrame){ 84func(...args); 85lastTime=now; 86}};} 87function infiniteScrollInit({ selector, postId, id }){ 88const element=document.querySelector(selector); 89const loadingIndicatorElement=document.querySelector(`${selector} .breakdance-form-loader` 90); 91let paged=2; 92let loading=false; 93const ssrFilePath = 94element.querySelector("[data-ssr-path]")?.dataset?.ssrPath||""; 95async function scrollFunction(){ 96const scrollTop = 97window.pageYOffset||document.documentElement.scrollTop; 98const scrollBottom=scrollTop + window.innerHeight; 99const { top, height }=element.getBoundingClientRect(); 100const elementBottom=top + scrollTop + height; 101if(scrollBottom >=elementBottom + 50&&!loading){ 102if(loadingIndicatorElement){ 103loadingIndicatorElement.style.display="inline"; 104} 105loading=true; 106const response=await loadMorePostsAndAppend({ 107selector, 108postId, 109id, 110paged, 111ssrFilePath 112}); 113loading=false; 114if(loadingIndicatorElement){ 115loadingIndicatorElement.style.display="none"; 116} 117if(!response||!response.html||response.maxNumberOfPages <=paged){ 118document.removeEventListener("scroll", throttledScrollFunc); 119} 120paged++; 121}} 122const throttledScrollFunc=throttle(scrollFunction, 150); 123document.addEventListener("scroll", throttledScrollFunc); 124}})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.