PageSourceSearch

https://therestishistory.com/hubfs/hub_generated/module_assets/1/2…/module_Home_Collection_Slider.min.js

js therestishistory.com collected 2026-10-02 02:55:17 UTC 6,907 bytes, 2 lines download raw bytes

1var module_273206720717=void function(){const BG_FALLBACK="https://146396756.fs1.hubspotusercontent-eu1.net/hubfs/146396756/TRIH/bg-wall.png";function esc(s){return String(s??"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function cleanPath(p){return String(p||"").replace(/^\/+/,"")}function formatDate(v){if(!v)return"";const d=new Date(v);return isNaN(d.getTime())?"":d.toLocaleDateString(void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric"})}function getCollectionIdForSwiper(swiperEl){let cid=swiperEl.getAttribute("data-collection-id");if(cid)return cid;const parent=swiperEl.closest("[data-collection-id]");return parent?parent.getAttribute("data-collection-id"):""}async function injectOnce(){const swipers=function(){const nodes=[];return document.querySelectorAll(".swiper.collectionsSlider[data-collection-id]").forEach(el=>nodes.push(el)),document.querySelectorAll("[data-collection-id] .swiper.collectionsSlider").forEach(el=>{nodes.includes(el)||nodes.push(el)}),document.querySelectorAll(".tab[data-collection-id] .swiper.collectionsSlider").forEach(el=>{nodes.includes(el)||nodes.push(el)}),nodes}();if(console.log("swipers found:",swipers.length),!swipers.length)return!1;const ids=swipers.map(el=>getCollectionIdForSwiper(el)).filter(Boolean);if(!ids.length)return console.warn("No collection IDs found on swipers/parents."),!1;const endpoint=`/hs/serverless/collections-feed?seriesTableId=702491864&episodesTableId=689865918&collectionIds=${encodeURIComponent(ids.join(","))}&fkCol=${encodeURIComponent("collections")}`;console.log("fetching:",endpoint);const json=await fetch(endpoint).then(r=>r.json()).catch(err=>({ok:!1,error:String(err)}));if(!json?.ok)return console.error("❌ serverless failed:",json),!1;const data=json.data||{};return swipers.forEach(swiperEl=>{if("1"===swiperEl.dataset.injected)return;const cid=getCollectionIdForSwiper(swiperEl),bucket=data[cid]||{items:[]},mixed=Array.isArray(bucket.items)&&bucket.items.length?bucket.items:[].concat(bucket.series||[]).concat(bucket.episodes||[]),wrapper=swiperEl.querySelector(".swiper-wrapper");if(!wrapper)return;const slides=function(mixed){const slides=[];return mixed.forEach(item=>{if(item){if("series"===item.type){const p=cleanPath(item.hs_path||item.path);return void slides.push(`\n          <div class="swiper-slide !w-[26.3125rem] h-auto">\n            <a href="/series/${p}"\n              class="h-full min-h-[16.8125rem] flex justify-between flex-col gap-2 p-8 group bg-no-repeat bg-center bg-cover"\n              style="background-image:url('${BG_FALLBACK}');">\n              <h3 class="text-black text-32 font-bold leading-none group-hover:text-color_red transition-all duration-200">\n                ${esc(item.name)}\n              </h3>\n              <div class="flex justify-between items-end">\n                <div class="[&>p]:leading-8 [&>p]:font-light [&>p]:text-3 [&>p]:group-hover:text-color_red [&>p]:transition-all [&>p]:duration-200">\n                  <p>${esc(formatDate(item.publish_date))}</p>\n                </div>\n                <div class="flex gap-3 [&>p]:font-light [&>p]:text-3 [&>p]:group-hover:text-color_red [&>p]:transition-all [&>p]:duration-200">\n                  <p>${esc(item.episodes_count??"")} ${1===Number(item.episodes_count)?"Episode":"Episodes"}</p>\n                  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">\n                    <g clip-path="url(#clip0_677_1415)">\n                      <path d="M3.46365 0V1.73227H1.73227V3.46365H0V20H16.5355V18.2677H18.2677V16.5355H20V0H3.46365ZM15.4656 18.9301H1.06985V4.5335H15.4656V18.9301ZM17.1979 17.1979H16.5355V3.46365H2.80212V2.80212H17.1979V17.1979ZM18.9301 15.4656H18.2677V1.73227H4.5335V1.06985H18.9301V15.4656Z"\n                        fill="black" class="group-hover:fill-color_red transition-all duration-200" />\n                    </g>\n                    <defs><clipPath id="clip0_677_1415"><rect width="20" height="20" fill="white" /></clipPath></defs>\n                  </svg>\n                </div>\n              </div>\n            </a>\n          </div>\n        `)}if("episode"===item.type){const p=cleanPath(item.hs_path||item.path),bg=item.episode_image||BG_FALLBACK,seriesPrefix=(item.series||[]).filter(s=>s?.name&&"Full Episodes"!==s.name).map(s=>esc(s.name)).join(" | "),finalTitle=`${seriesPrefix?seriesPrefix+" | ":""}${item.title||""}`;return void slides.push(`\n          <div class="swiper-slide !w-[26.3125rem] h-auto">\n            <a href="/episodes/${p}"\n              class="h-full min-h-[16.8125rem] flex justify-between flex-col gap-2 p-8 group bg-no-repeat bg-center bg-cover"\n              style="background-image:url('${bg}');">\n              <h3 class="text-black text-32 font-bold leading-none group-hover:text-color_red transition-all duration-200">\n                ${esc(finalTitle)}\n              </h3>\n              <div class="flex justify-between items-end">\n                <div class="[&>p]:leading-8 [&>p]:font-light [&>p]:text-3 [&>p]:group-hover:text-color_red [&>p]:transition-all [&>p]:duration-200">\n                  <p>${esc(formatDate(item.publish_date))}</p>\n                </div>\n                <div class="flex gap-3 [&>p]:font-light [&>p]:text-3 [&>p]:group-hover:text-color_red [&>p]:transition-all [&>p]:duration-200">\n                  <p>${esc(item.episode_no??"")}</p>\n                </div>\n              </div>\n            </a>\n          </div>\n        `)}}}),slides}(mixed);wrapper.innerHTML=slides.join("")||'<div class="swiper-slide !w-[26.3125rem] h-auto"><div class="p-8">No items in this collection.</div></div>';const{prev:prev,next:next}=function(swiperEl){const scope=swiperEl.closest(".holder.relative")||swiperEl.closest(".holder")||swiperEl.parentElement||document;return{prev:scope.querySelector(".collections-prev"),next:scope.querySelector(".collections-next")}}(swiperEl);
1swiperEl.swiper?swiperEl.swiper.update():window.Swiper?new Swiper(swiperEl,{slidesPerView:"auto",spaceBetween:24,navigation:{prevEl:prev,nextEl:next}}):console.warn("⚠️ Swiper missing: slides injected but slider not initialized"),swiperEl.dataset.injected="1"}),console.log("✅ curated collections injected"),!0}async function main(){if(console.log("✅ curated collections inject script loaded"),await injectOnce())return;const startedAt=Date.now(),obs=new MutationObserver(async()=>{(Date.now()-startedAt>5e3||await injectOnce())&&obs.disconnect()});obs.observe(document.documentElement,{childList:!0,subtree:!0})}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",main):main()}();
2//# sourceURL=https://146396756.fs1.hubspotusercontent-eu1.net/hubfs/146396756/hub_generated/module_assets/1/273206720717/1769950667649/module_Home_Collection_Slider.js

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.