PageSourceSearch

https://www.playthegame.org/search-Ch9ewhdT.js

js playthegame.org collected 2026-10-02 02:42:43 UTC 3,247 bytes, 11 lines download raw bytes

1import{g as r}from"./index-xgxdCp6f.js";import{c,b as h,f as o,d as l,m as d,a as p}from"./distinctUntilChanged-D-bJFftd.js";import"./main-bEkJpQz2.js";class v{constructor(e,t,i){this.searchService=t,this.dictionary=i,this.domainId=e.getAttribute("data-domain"),this.search=e.querySelector("#searchInput"),this.searchContainer=e.querySelector(".search-container"),this.prevActions=e.querySelectorAll(".search-prev-action"),this.nextActions=e.querySelectorAll(".search-next-action"),this.searchResult=e.querySelector(".search-result");const a=e.getAttribute("data-query");if(a?.length>0){this.search.value=a;const s={domainId:this.domainId,query:a.toLowerCase()};this.getResults(s)}c(h(this.search,"keyup").pipe(o(()=>this.search.value.length===0||this.search.value.length>2)),h(this.search,"change")).pipe(l(400)).pipe(d(()=>({domainId:this.domainId,query:this.search.value}))).pipe(p()).subscribe(s=>{const n=new URL(window.location.href);n.searchParams.delete("q"),n.searchParams.delete("category"),window.history.pushState({},"",n.href),this.getResults(s)}),this.prevActions.forEach(s=>s.addEventListener("click",()=>{this.pagingLink(this.prevLink)})),this.nextActions.forEach(s=>s.addEventListener("click",()=>{this.pagingLink(this.nextLink)}))}getResults(e){this.searchService.query(e,"search").then(t=>{this.searchResult?.classList?.remove("d-none"),this.updatePaging(t),this.showArticles(t)})}pagingLink(e){e?.length>1&&fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}}).then(t=>t.json()).then(t=>{this.updatePaging(t),this.showArticles(t)})}updatePaging(e){this.prevLink=e.pagination.previousPageLink,this.nextLink=e.pagination.nextPageLink,!this.prevLink?.length&&!this.nextLink?.length?(this.prevActions.forEach(t=>t.classList.add("d-none")),this.nextActions.forEach(t=>t.classList.add("d-none"))):(this.prevActions.forEach(t=>t.classList.remove("d-none")),this.nextActions.forEach(t=>t.classList.remove("d-none")),this.prevActions.forEach(t=>t.disabled=!this.prevLink?.length),this.nextActions.forEach(t=>t.disabled=!this.nextLink?.length))}showArticles(e){if(this.searchContainer.innerHTML="",e.items.length>0){const t=e.items.map(i=>this.itemsHtml(i));this.hideAll(t),this.searchContainer.append(...t),this.staggerIn(t)}else this.searchContainer.innerHTML=`<h3>${this.dictionary.get("No results")}</h3>`}itemsHtml(e){const t=document.createElement("div");return t.classList.add("col-12","col-sm-6","col-md-4","col-lg-3"),t.innerHTML=`<figure class="card-figure h-100">
2
3            <figcaption class="card-caption p-3">
4            <div class="mb-2">
5            ${this.areas(e.areas)}
6            <span class="article-small">${e.type?this.dictionary.get(e.type):""} ${e.date}</span>
7            </div>
8                <h5 class="card-title">${e.title}</h5>
9            </figcaption>
10            <a href="${e.url}" class="card-link-overlay" title="${e.title}"></a>
11        </figure>`,t}areas(e){return e.map(t=>` <span class="badge ${t.toLowerCase()}">${this.dictionary.get("Areas."+t)}</span>`).join("")}hideAll(e){r.set(e,{translateY:"150px",opacity:0})}staggerIn(e){r.to(e,{translateY:"0",opacity:1,ease:"expo.out",duration:.5,stagger:.025,onComplete:()=>{e.forEach(t=>t.style.opacity="")}})}}export{v as Search};

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.