Template:Blockadblock: Difference between revisions

Template page
No edit summary
No edit summary
 
(28 intermediate revisions by the same user not shown)
Line 1: Line 1:
<div id="mw-mywiki-blockads"></div>
{{#tag:html|
<script type="text/javascript">
(function(){let a={bgColor:"#fff",fgColor:"#1b1b1b",linkBgColor:"#0069c0",linkFgColor:"#fff",logo:"",dismissable:!0,interval:3600,delay:0,sponsorUrl:"",sponsorButton:"Purchase a Subscription",callout:"Please disable your browser's ad-blocker",appeal:`Without advertising, this website wouldn't exist.`};a={logo:"https://www.gamebrew.org/images/2/2b/B1.png",bgColor:"#fff",fgColor:"#1b1b1b",linkBgColor:"#0069c0",linkFgColor:"#fff",dismissable:!1,delay:5,interval:0,sponsorUrl:"",sponsorButton:"",callout:"Please disable your browser's ad-blocker.",appeal:"It looks like you're using an ad-blocker! If you enjoy our content, please support our site by disabling your adblocker."};var b=new function(){function a(){if(window.nitroAds&&!0===window.nitroAds.abp)return void d();var e=new Image;e.onerror=()=>{if(c++,3>c)setTimeout(a,250);else{b.blocking=!0;try{localStorage.setItem("np.lastBlocked",new Date().getTime())}catch(a){}document.dispatchEvent&&window.CustomEvent&&document.dispatchEvent(new CustomEvent("np.detect",{detail:{blocking:b.blocking}}))}},e.onload=()=>d(),e.src="https://ad-delivery.net/px.gif?ch=1&"+Math.random()+"&adslot="}this.blocking=!1;var c=0,d=function(){try{var a=localStorage.getItem("np.lastBlocked");a&&(localStorage.removeItem("np.lastBlocked"),localStorage.setItem("np.unblocked",new Date().getTime()-+a))}catch(a){}};setTimeout(a(),250)};let c=null;const d=()=>{const b=`; ${document.cookie}`,d=b.split(`; npabp=`);if(2===d.length&&a.dismissable)return;let e="";if(a.interval){const b=new Date;b.setTime(b.getTime()+1e3*a.interval),e=`expires=${b.toGMTString()};`}document.cookie=`npabp=1; ${e} path=/;`;const f=window.matchMedia("(max-width: 768px)").matches;c=document.createElement("div"),c.style.background="rgba(78, 78, 78, 0.6)",c.style.position="fixed",c.style.display="flex",c.style.alignItems="center",c.style.justifyContent="center",c.style.top=0,c.style.left=0,c.style.right=0,c.style.bottom=0,c.style.zIndex=2147483647,a.dismissable&&c.addEventListener("click",a=>{c&&a.target==c&&c.parentNode&&c.parentNode.removeChild(c)});const g=document.createElement("div");g.style.width=f?"300px":"720px",g.style.boxShadow="0px 0px 8px 0px rgba(52, 52, 52, 0.6)",g.style.borderRadius="2px",g.style.overflow="hidden",g.style.fontSize="0",g.style.display="flex",c.appendChild(g);const h=document.createElement("div");if(h.style.background=a.bgColor,h.style.width=f?"300px":"720px",h.style.flex=f?"0 0 300px":"0 0 720px",h.style.display="inline-block",h.style.textAlign="center",h.style.padding=f?"15px":"30px 0",h.style.boxSizing="border-box",h.style.position="relative",g.appendChild(h),a.dismissable){const b=document.createElement("div");b.innerHTML=`<svg style="fill:${a.linkBgColor};" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>`,b.style.position="absolute",b.style.width="24px",b.style.height="24px",b.style.top="10px",b.style.right="10px",b.style.cursor="pointer",h.appendChild(b),b.addEventListener("click",()=>{c&&c.parentNode&&c.parentNode.removeChild(c)})}if(a.logo){const b=document.createElement("img");b.style.maxHeight="50px",b.style.maxWidth="600px",b.style.marginBottom=f?"6px":"15px",b.src=a.logo,h.appendChild(b)}const i=document.createElement("span");i.style.display="block",i.style.fontSize=f?"16px":"20px",i.style.fontWeight="bold",i.style.fontFamily="\"Roboto\", Helvetica, sans-serif",i.style.marginBottom=f?"6px":"15px",i.style.color=a.fgColor,i.innerText=a.callout,h.appendChild(i);const j=document.createElement("span");j.style.display="block",j.style.fontSize=f?"14px":"16px",j.style.fontWeight="400",j.style.fontFamily="\"Roboto\", Helvetica, sans-serif",j.style.marginBottom=f?"15px":"30px",j.style.color=a.fgColor,j.innerText=a.appeal,h.appendChild(j);const k=document.createElement("div");if(k.style.display="flex",k.style.justifyContent="center",k.style.alignItems="center",h.appendChild(k),a.sponsorUrl){const b=document.createElement("span");b.style.display="inline-block",b.style.cursor="pointer",b.style.borderRadius="2px",b.style.fontSize=f?"14px":"16px",b.style.fontWeight="500",b.style.fontFamily="\"Roboto\", Helvetica, sans-serif",b.style.padding=f?"5px 10px":"10px 18px",b.style.marginRight=f?"5px":"20px",b.style.backgroundColor=a.linkBgColor,b.style.color=a.linkFgColor,b.innerText=a.sponsorButton,b.addEventListener("click",b=>{b.preventDefault(),window.location=a.sponsorUrl}),k.appendChild(b)}const l=document.createElement("span");l.style.display="inline-block",l.style.cursor="pointer",l.style.borderRadius="2px",l.style.fontSize=f?"14px":"16px",l.style.fontWeight="500",l.style.fontFamily="\"Roboto\", Helvetica, sans-serif",l.style.padding=f?"5px 10px":"10px 18px",a.sponsorUrl&&(l.style.marginLeft=f?"5px":"20px"),l.style.backgroundColor=a.linkBgColor,l.style.color=a.linkFgColor,l.innerText="Need Help?",k.appendChild(l);const m=b=>{if(p.innerHTML="",b.gif){const a=document.createElement("img");a.src=`https://storage.googleapis.com/np-assets/${b.id}.gif`,a.style.width=f?"100px":"200px",a.style.float="right",a.style.border="1px solid rgba(134, 134, 134, 0.31)",a.style.borderRadius="4px",a.style.margin="0 0 10px 15px",p.appendChild(a)}const c=document.createElement("span");c.style.display="block",c.style.fontSize="16px",c.style.fontWeight="bold",c.style.fontFamily="\"Roboto\", Helvetica, sans-serif",c.style.marginBottom="15px",c.style.color=a.fgColor,c.innerText=b.name,p.appendChild(c),b.steps.forEach(b=>{const c=document.createElement("span");c.style.display="block",c.style.fontSize="14px",c.style.fontWeight="regular",c.style.fontFamily="\"Roboto\", Helvetica, sans-serif",c.style.marginBottom="3px",c.style.color=a.fgColor,c.innerText=`- ${b}`,p.appendChild(c)});const d=document.createElement("span");d.style.display="inline-block",d.style.cursor="pointer",d.style.borderRadius="2px",d.style.fontSize="14px",d.style.fontWeight="500",d.style.fontFamily="\"Roboto\", Helvetica, sans-serif",d.style.padding="6px 10px",d.style.marginTop="30px",d.style.marginRight="5px",d.style.backgroundColor=a.linkBgColor,d.style.color=a.linkFgColor,d.innerText="Refresh Page",d.addEventListener("click",a=>{a.preventDefault(),window.location.reload()}),p.appendChild(d);const e=document.createElement("span");e.style.display="inline-block",e.style.cursor="pointer",e.style.borderRadius="2px",e.style.fontSize="14px",e.style.fontWeight="500",e.style.fontFamily="\"Roboto\", Helvetica, sans-serif",e.style.padding="6px 10px",e.style.marginTop="6px",e.style.backgroundColor=a.linkBgColor,e.style.color=a.linkFgColor,e.innerText="Back to Main",e.addEventListener("click",a=>{a.preventDefault(),h.style.marginLeft="0",g.style.height="auto",n.style.height="0"}),p.appendChild(e)};l.addEventListener("click",b=>{b.preventDefault(),h.style.marginLeft=f?"-300px":"-720px",g.style.height=f?"80vh":"420px",n.style.height=f?"80vh":"420px",fetch(`https://storage.googleapis.com/np-assets/manifest.json?v=b2`).then(a=>a.json()).then(c=>{o.innerHTML="";const d=document.createElement("span");if(d.style.display="block",d.style.fontSize="15px",d.style.fontWeight="bold",d.style.fontFamily="\"Roboto\", Helvetica, sans-serif",d.style.marginBottom=f?"6px":"15px",d.style.color=a.linkFgColor,d.innerText="Which ad blocker do you use?",o.appendChild(d),f){const a=document.createElement("select");a.style.fontSize="14px",a.addEventListener("change",a=>{const d=a.target.options[a.target.selectedIndex].value,e=c.find(a=>a.id==d);m(e)}),o.appendChild(a),c.forEach(b=>{const c=document.createElement("option");c.value=b.id,c.textContent=b.name,a.appendChild(c)})}else c.forEach(b=>{const c=document.createElement("span");c.style.display="block",c.style.cursor="pointer",c.style.fontSize="14px",c.style.fontWeight="regular",c.style.fontFamily="\"Roboto\", Helvetica, sans-serif",c.style.padding="4px 0px",c.style.backgroundColor=a.linkBgColor,c.style.color=a.linkFgColor,c.style.opacity="0.8",c.style.borderBottom="1px solid rgba(218, 218, 218, 0.14)",c.innerText=b.name,o.appendChild(c),c.addEventListener("click",a=>{a.preventDefault(),m(b)})});0<c.length&&m(c[0])})});const n=document.createElement("div");n.style.background=a.bgColor,n.style.display="flex",n.style.width=f?"300px":"720px",n.style.height="50px",n.style.flex=f?"300px":"0 0 720px",n.style.textAlign="left",n.style.padding="0",n.style.whiteSpace="normal",f&&(n.style.flexDirection="column"),g.appendChild(n);const o=document.createElement("div");o.style.background=a.linkBgColor,o.style.flex=f?"0 0 110px":"0 0 200px",o.style.textAlign="left",o.style.padding=f?"15px":"30px",o.style.overflow="auto",n.appendChild(o);const p=document.createElement("div");p.style.background=a.bgColor,p.style.flex="1",p.style.textAlign="left",p.style.padding=f?"15px":"30px",p.style.overflow="auto",n.appendChild(p),null!==document.body&&document.body.appendChild(c)};document.addEventListener("np.detect",b=>{b.detail.blocking?setTimeout(d,a.delay):c&&c.parentNode&&c.parentNode.removeChild(c)})})();
</script>
}}

Latest revision as of 15:53, 20 November 2022

Advertising: