console.log("loading config for attackofthefanboy");console.log("no config found");window.gamursInfScroll={infScrollURL:"https://infinity-api.attackofthefanboy.com"};"use strict";console.log("Infinite scroll initialised");(function(){var V,Y,z,G,K,Q,X,Z;if(typeof window>"u")return;let n=window.gamursInfScrollCustomSiteConfig;if(n&&n.disableOn&&n.disableOn.referrer){let e=n.disableOn.referrer.values.map(t=>{if(t==="")return t;let r=t;t.startsWith("https://")||t.startsWith("http://")||(r=`http://${t}`);try{r=new URL(r)}catch{r=!1}return r&&r.hostname.split(".").slice(-2).join(".")});e.includes("")&&(e=[...e,new URL(document.location).hostname.split(".").slice(-2).join(".")]);let i=n.disableOn.referrer.invert||!1,s="";try{s=new URL(document.referrer).hostname.split(".").slice(-2).join(".")}catch{s=""}if(e.includes(s)&&!i||!e.includes(s)&&i)return}let M=window.gamursInfScroll,N=n&&(V=n.categories)!=null?V:"",k=n&&(Y=n.tags)!=null?Y:"",R=!(n&&n.useCategories===!1),j=!(n&&n.useTags===!1),H=!!(n&&n.sameCategory),q=!!(n&&n.timeDecay),P=n&&(z=n.timeDecayOffset)!=null?z:"",W=n&&(G=n.timeDecayScale)!=null?G:"",F=n&&(K=n.timeDecayDecay)!=null?K:"",x=M&&(Q=M.infScrollURL)!=null?Q:"",L=document.getElementsByClassName("gamurs-inf-scroll-post")[0].attributes["data-categories"].value,D=document.getElementsByClassName("gamurs-inf-scroll-post")[0].attributes["data-tags"].value,p=(X=document.getElementsByClassName("gamurs-inf-scroll-post")[0].attributes["data-experiments"])==null?void 0:X.value,te=window.location.href;window.gamurs_inf_scroll_data=window.gamurs_inf_scroll_data||{};let S=document.getElementsByClassName("gamurs-inf-scroll-post")[0].dataset.id,l=window.location.hostname.split(".")[window.location.hostname.split(".").length-2];l==="lndo"?l=window.location.hostname.split(".")[0]:l==="go-vip"&&(l=window.location.hostname.split(".")[0],l=l.split("-")[0],(l==="www"||l==="cms")&&(l=window.location.hostname.split(".")[0].split("-")[1])),window.gamurs_inf_scroll_data.nextUrl=`${x}/infscroll/${l}/${S}?categories=${L}&tags=${D}&useCategories=${R}&useTags=${j}&forceCategories=${N}&forceTags=${k}&sameCategory=${H}${q?`&timeDecayOffset=${P}&timeDecayScale=${W}&timeDecayDecay=${F}`:""}${p?`&experiments="${p}"`:""}`;let ie={root:document.getElementById("scroll-area"),rootMargin:"0px",threshold:.5},se={rootMargin:"-50% 0% -50% 0%",threshold:0},ne={rootMargin:"-50% 0% -10% 0%",threshold:0},ce={rootMargin:"-75% 0% -25% 0%",threshold:0},le={rootMargin:"-87.5% 0% -12.5% 0%",threshold:0};function J(e,i,s){let t;return s==="middle"?(t=new IntersectionObserver(i,se),t=h(e,t,!1)):s==="middleofmiddle"?(t=new IntersectionObserver(i,ne),t=h(e,t,!0)):s==="middlelower"?(t=new IntersectionObserver(i,le),t=h(e,t,!1)):(t=new IntersectionObserver(i,ie),t=h(e,t,!1)),t}function re(e){if(typeof window.gamursInfScrollOnInfiniteScrollAppend=="function")try{window.gamursInfScrollOnInfiniteScrollAppend(e)}catch(i){console.log(i)}}function oe(e,i){e[0].isIntersecting&&(window.gamurs_inf_scroll_data.finite_article_experience?E||(E=!0,A(!0,_,b,$,!0)):(U(),i.unobserve(e[0].target)))}function h(e,i,s){let t;return s?(e.style.position="relative",t=document.createElement("div"),t.style.position="absolute",t.style.top="50%",t.style.width="100%",t.style.height="50%",t.style.pointerEvents="none",e.appendChild(t)):t=e,i.observe(t),i}let _=[],v=document.getElementsByClassName("gamurs-inf-scroll-post")[0];_[v&&(Z=v.dataset.id)!=null?Z:0]=document.URL;let E=!1;history.scrollRestoration="manual";let I=!0,T="down",B=0;document.addEventListener("scroll",function(){let e=window.pageYOffset||document.documentElement.scrollTop;e>B?T="down":e<B&&(T="up"),B=e<=0?0:e});function ae(e,i){e.forEach(s=>{if(s.isIntersecting&&window.location.href!==s.target.dataset.url){let t=_[s.target.dataset.id];if(T==="down"?document.getElementsByClassName("gamurs-inf-scroll-post")[0].dataset.id!==s.target.dataset.id&&history.pushState(null,"",t):window.location.href!==te&&(I=!1,history.back()),document.title=s.target.dataset.title,typeof window.gamursInfScrollOnUrlChange=="function")try{window.gamursInfScrollOnUrlChange(t)}catch(g){console.log(g)}let r=Array.from(document.getElementsByTagName("link")).filter(g=>{var o;return g.attributes.getNamedItem("rel")!==null&&((o=g.attributes.getNamedItem("rel"))==null?void 0:o.value)==="canonical"})[0];r&&(r.href=t),window.snowplow&&window.snowplow("trackStructEvent",{category:"gamurs-infinite-scroll",action:"impression"})}}),Array.from(document.getElementsByClassName("gamurs-inf-scroll-post")).map(s=>i.observe(s))}addEventListener("popstate",e=>{try{I&&document.querySelector(`[data-url="${e.target.location.href.split("?")[0]}"]`).scrollIntoView()}catch(i){console.log(i)}I=!0});function U(){E?A(!1,_,b,$):(E=!0,A(!0,_,b,$))}async function A(e,i,s,t,r=!1){let g=e?`${x}/campaign/${l}/${S}?categories=${L}&tags=${D}${p?`&experiments="${p}"`:""}`:window.gamurs_inf_scroll_data.nextUrl;await fetch(g).then(o=>{if(o.status!==200)throw e?"No Campaign":`request failed: ${o.text()}`;return r&&(window.gamurs_inf_scroll_data.finite_article_experience=!1,Array.from(document.getElementsByClassName("wp-block-gamurs-ab-testing")).filter(a=>a.dataset.key==="finite-article-experience").forEach(a=>{a.dataset.lock="true",a.classList.add("false"),a.classList.remove("true")})),o.json()}).then(function(a){let c=a;if(c.html!=null){i[c.id]=c.url,e||(window.gamurs_inf_scroll_data.nextUrl=c.nextUrl);let d=document.createElement("div");d.innerHTML=c.html;let w=d.firstElementChild,ee=document.head;ee&&d&&Array.from(d.getElementsByTagName("link")).forEach(O=>{ee.appendChild(O)});let m=document.getElementById("gamurs-inf-scroll-main");if(m&&w)m.appendChild(w);else throw"did not find #gamurs-inf-scroll-main";window.snowplow&&window.snowplow("trackStructEvent",{category:"gamurs-infinite-scroll",action:"append-article",label:c.id}),[d,w].forEach(O=>{Array.from(O.getElementsByTagName("script")).forEach(u=>{try{if(u.src){let f=document.createElement("script");f.src=u.src,f.type=u.type,f.id=u.id,f.async=!0,w&&O===w&&u.parentElement&&u.parentElement.removeChild(u),f.id?document.getElementById(f.id)||m==null||m.appendChild(f):m==null||m.appendChild(f)}else(0,eval)(u.innerText)}catch(f){console.log(f)}})}),re(c.id);let y=document.getElementsByClassName("gamurs-inf-scroll-post");h(y[y.length-1],s,!0),h(y[y.length-1],t,!1),s.unobserve(y[y.length-2].lastChild)}}).catch(o=>{if(e)console.log(o),o!=="did not find #gamurs-inf-scroll-main"&&(r||U());else{let a=window.gamurs_inf_scroll_data.nextUrl.split("?")[1].split("&").filter(d=>d.slice(0,5)==="page="),c=a.length?parseInt(a[0].split("=")[1]):1;if(c<20){if(o.slice(0,15)==="request failed:"){let d=window.gamurs_inf_scroll_data.nextUrl.split("?");window.gamurs_inf_scroll_data.nextUrl=d[0]+"?page="+(c+1).toString()+"&"+d[1].split("&").filter(w=>w.slice(0,5)!=="page=").join("&")}o!=="did not find #gamurs-inf-scroll-main"&&(r||U())}}})}let $,b;function C(){window.growthbook_queue=window.growthbook_queue||[],window.growthbook_queue.push(e=>{let i=()=>{let s=Array.from(document.getElementsByClassName("wp-block-gamurs-ab-testing")).filter(t=>t.dataset.key==="finite-article-experience")[0];s&&s.dataset.lock!=="true"&&(e.isOn("finite-article-experience")?window.gamurs_inf_scroll_data.finite_article_experience=!0:window.gamurs_inf_scroll_data.finite_article_experience=!1)};i(),document.addEventListener("growthbookdata",i)}),$=J(v,ae,"middlelower"),b=J(v,oe,"middleofmiddle")}window.gamurs_inf_scroll_data.beginInfiniteScroll=C,l==="dotesports"?fetch("/wp-json/gamurs/v1/infscroll/multisites").then(e=>e.json()).then(e=>{let i=new URL(window.location.href).pathname.split("/")[1];e.includes(i)&&(l=`${l}|${i}`,window.gamurs_inf_scroll_data.nextUrl=`${x}/infscroll/${l}/${S}?categories=${L}&tags=${D}&useCategories=${R}&useTags=${j}&forceCategories=${N}&forceTags=${k}&sameCategory=${H}${q?`&timeDecayOffset=${P}&timeDecayScale=${W}&timeDecayDecay=${F}`:""}${p?`&experiments="${p}"`:""}`),C()}).catch(e=>{console.log(e),C()}):C()})();
