PageSourceSearch

https://northspore.com/cdn/shop/t/221/assets/search-load-more-3nqopL1M.js

js northspore.com collected 2026-09-25 18:20:56 UTC 2,677 bytes, 1 lines download raw bytes

1import{m as n}from"./module.esm-S4M4TpEG.js";n.data("searchLoadMore",()=>({articlesPerLoad:9,totalArticles:0,currentlyVisible:0,isLoading:!1,error:null,init(){try{this.totalArticles=parseInt(this.$el.dataset.totalArticles)||0;const t=parseInt(this.$el.dataset.articlesPerPage)||9;this.articlesPerLoad=t;const r=this.$el.querySelectorAll(".article-item:not(.hidden)");this.currentlyVisible=r.length,this.totalArticles<0&&(this.showError("Invalid total articles count"),this.totalArticles=0)}catch(t){console.error("searchLoadMore: Error during initialization:",t),this.showError("Failed to initialize article loading"),this.totalArticles=0,this.currentlyVisible=0}},async loadMore(){if(!this.isLoading){this.isLoading=!0,this.error=null;try{let t=this.$el;if(t&&t.tagName==="BUTTON"&&(t=t.closest('[x-data="searchLoadMore"]')||t.closest("[x-data]")),!t)throw new Error("Container with x-data not found");const r=t.querySelectorAll(".article-item.hidden");if(r.length===0){this.showError("No more articles to load");return}const o=Array.from(r).slice(0,this.articlesPerLoad);if(o.length===0){this.showError("No articles found to display");return}await new Promise(i=>setTimeout(i,200));let e=0;if(o.forEach((i,l)=>{try{i.classList.remove("hidden"),e++}catch(a){console.warn(`Failed to show article ${l}:`,a)}}),e===0)throw new Error("Failed to show any articles");this.currentlyVisible+=e;const s=t.querySelectorAll(".article-item:not(.hidden)").length;s!==this.currentlyVisible&&(console.warn("State inconsistency detected, correcting..."),this.currentlyVisible=s),this.announce(`Loaded ${e} more articles. ${this.currentlyVisible} of ${this.totalArticles} articles now visible.`)}catch(t){console.error("searchLoadMore: Error loading more articles:",t),this.showError("Failed to load more articles. Please try again.")}finally{this.isLoading=!1}}},get showLoadMoreButton(){return this.error?!1:this.totalArticles>this.articlesPerLoad&&this.currentlyVisible<this.totalArticles},get hasError(){return this.error!==null},get loadMoreButtonText(){return this.isLoading?"Loading...":"Load More"},get loadMoreButtonClass(){const t="button button-outline load-more button--light";return this.isLoading?`${t} opacity-50 cursor-not-allowed`:t},showError(t){this.error=t,this.announce(`Error: ${t}`),setTimeout(()=>{this.error=null},5e3)},clearError(){this.error=null},announce(t){const r=document.createElement("div");r.setAttribute("aria-live","polite"),r.setAttribute("aria-atomic","true"),r.setAttribute("role","status"),r.setAttribute("class","sr-only"),r.textContent=t,document.body.appendChild(r),setTimeout(()=>{document.body.contains(r)&&document.body.removeChild(r)},1e3)}}));

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.