console.log("loading config for themarysue");window.gamursInfScrollCustomSiteConfig={site:"themarysue",useCategories:true,useTags:true,categories:undefined,tags:undefined};window.gamursInfScroll={infScrollURL:"https://infinite-scroll-system.gamurs.workers.dev"};console.log("Infinite scroll initialised");(function(){var $,I,E,O;let s=window.gamursInfScrollCustomSiteConfig,h=window.gamursInfScroll,T=s&&($=s.categories)!=null?$:"",x=s&&(I=s.tags)!=null?I:"",R=!(s&&s.useCategories===!1),U=!(s&&s.useTags===!1),w=h&&(E=h.infScrollURL)!=null?E:"",y=document.getElementsByClassName("gamurs-inf-scroll-post")[0].attributes["data-categories"].value,S=document.getElementsByClassName("gamurs-inf-scroll-post")[0].attributes["data-tags"].value,A=document.getElementsByClassName("gamurs-inf-scroll-post")[0].dataset.id,r=window.location.hostname.split(".")[window.location.hostname.split(".").length-2];r==="lndo"?r=window.location.hostname.split(".")[0]:r==="go-vip"&&(r=window.location.hostname.split(".")[0],r=r.split("-")[0],r==="www"&&(r=window.location.hostname.split(".")[0].split("-")[1]));let i=`${w}/infscroll/${r}/${A}?categories=${y}&tags=${S}&useCategories=${R}&useTags=${U}&forceCategories=${T}&forceTags=${x}`,L={root:document.querySelector("#scroll-area"),rootMargin:"0px",threshold:.5},N={rootMargin:"-50% 0% -50% 0%",threshold:0};function v(e,o,t){let l;return t==="middle"?l=new IntersectionObserver(o,N):l=new IntersectionObserver(o,L),l=a(e,l),l}function B(e){if(typeof window.gamursInfScrollOnInfiniteScrollAppend=="function")try{window.gamursInfScrollOnUrlChange(e)}catch(o){console.log(o)}}function M(e,o){e[0].isIntersecting&&(f(),o.unobserve(e[0].target))}function a(e,o){return o.observe(e),o}let c=[],u=document.querySelector(".gamurs-inf-scroll-post");c[u&&(O=u.dataset.id)!=null?O:0]=document.URL;let q=!1;history.scrollRestoration="manual";let g=!0,C=0;function j(e,o){e.forEach(t=>{if(t.isIntersecting&&window.location.href!==t.target.dataset.url){let l=c[t.target.dataset.id];if(t.boundingClientRect.y>C?history.pushState(null,"",l):(g=!1,history.back()),document.title=t.target.dataset.title,typeof window.gamursInfScrollOnUrlChange=="function")try{window.gamursInfScrollOnUrlChange(l)}catch(n){console.log(n)}window.snowplow&&window.snowplow("trackStructEvent",{category:"gamurs-infinite-scroll",action:"impression"})}C=t.boundingClientRect.y}),Array.from(document.getElementsByClassName("gamurs-inf-scroll-post")).map(t=>o.observe(t))}addEventListener("popstate",e=>{try{g&&document.querySelector(`[data-url="${e.target.location.href.split("?")[0]}"]`).scrollIntoView()}catch(o){console.log(o)}g=!0});function f(){q?fetch(i).then(e=>{if(e.status!==200)throw`request failed: ${e.text()}`;return e.json()}).then(function(o){let t=o;if(t.html!=null){c[t.id]=t.url,i=t.nextUrl;let l=document.createElement("div");l.innerHTML=t.html;let n=document.querySelector("#gamurs-inf-scroll-main");if(n)n.appendChild(l);else throw"did not find #gamurs-inf-scroll-main";Array.from(l.querySelectorAll("script")).forEach(m=>{try{(0,eval)(m.innerText)}catch(p){console.log(p)}}),a(document.querySelectorAll(".gamurs-inf-scroll-post")[document.querySelectorAll(".gamurs-inf-scroll-post").length-1],d),a(document.querySelectorAll(".gamurs-inf-scroll-post")[document.querySelectorAll(".gamurs-inf-scroll-post").length-1],b),d.unobserve(document.querySelectorAll(".gamurs-inf-scroll-post")[document.querySelectorAll(".gamurs-inf-scroll-post").length-2])}}).catch(e=>{let o=i.split("?")[1].split("&").filter(l=>l.slice(0,5)==="page="),t=o.length?parseInt(o[0].split("=")[1]):1;if(t<20){if(e.slice(0,15)==="request failed:"){let l=i.split("?");i=l[0]+"?page="+(t+1).toString()+"&"+l[1].split("&").filter(n=>n.slice(0,5)!=="page=").join("&")}e!=="did not find #gamurs-inf-scroll-main"&&f()}}):(q=!0,fetch(`${w}/campaign/${r}/${A}?categories=${y}&tags=${S}`).then(e=>{if(e.status!==200)throw"No Campaign";return e.json()}).then(function(o){let t=o;if(t.html!=null){c[t.id]=t.url;let l=document.createElement("div");l.innerHTML=t.html;let n=document.querySelector("#gamurs-inf-scroll-main");if(n)n.appendChild(l);else throw"did not find #gamurs-inf-scroll-main";Array.from(l.querySelectorAll("script")).forEach(m=>{try{(0,eval)(m.innerText)}catch(p){console.log(p)}}),a(document.querySelectorAll(".gamurs-inf-scroll-post")[document.querySelectorAll(".gamurs-inf-scroll-post").length-1],d),a(document.querySelectorAll(".gamurs-inf-scroll-post")[document.querySelectorAll(".gamurs-inf-scroll-post").length-1],b),d.unobserve(document.querySelectorAll(".gamurs-inf-scroll-post")[document.querySelectorAll(".gamurs-inf-scroll-post").length-2])}}).catch(e=>{console.log(e),e!=="did not find #gamurs-inf-scroll-main"&&f()}))}let b=v(u,j,"middle"),d=v(u,M,"middle")})();
