diff --git a/components/headContent.js b/components/headContent.js index 9929739b..894f1373 100644 --- a/components/headContent.js +++ b/components/headContent.js @@ -4,17 +4,45 @@ import { useEffect } from "react"; export default function HeadContent({text}) { useEffect(() => { - if (!window.location.search.includes("crazygames")) { + if (!window.location.search.includes("crazygames") && !process.env.NEXT_PUBLIC_POKI) { const script = document.createElement('script'); script.src = "https://api.adinplay.com/libs/aiptag/pub/SWT/worldguessr.com/tag.min.js"; script.async = true; document.body.appendChild(script); + // + const script = document.createElement('script'); + script.src = "https://sdk.crazygames.com/crazygames-sdk-v3.js"; + script.async = true; + document.body.appendChild(script); + return () => { + document.body.removeChild(script); + } + } else if(process.env.NEXT_PUBLIC_POKI === "true") { + // + const script = document.createElement('script'); + script.src = "https://game-cdn.poki.com/scripts/v2/poki-sdk.js"; + script.async = true; + document.body.appendChild(script); + + + + return () => { + document.body.removeChild(script); + } + } }, []); @@ -44,11 +72,7 @@ export default function HeadContent({text}) { src="https://maps.googleapis.com/maps/api/js?v=weekly" defer > - -{/* */} - + {/* data-adbreak-test="on" */} {/* */} diff --git a/components/home.js b/components/home.js index 9c5f19f3..01318c11 100644 --- a/components/home.js +++ b/components/home.js @@ -854,10 +854,16 @@ setShowCountryButtons(false) try { window.CrazyGames.SDK.game.gameplayStop(); } catch(e) {} + try { + if(window.poki) window.PokiSDK.gameplayStop(); + } catch(e) {} } else { try { window.CrazyGames.SDK.game.gameplayStart(); } catch(e) {} + try { + if(window.poki) window.PokiSDK.gameplayStart(); + } catch(e) {} } } }, [screen, inCrazyGames]) @@ -1956,13 +1962,27 @@ setShowCountryButtons(false) // } catch(e) {} window.adInterval = 1800000; + + setTimeout(() => { + if(window.PokiSDK) { + console.log("Poki SDK found initialized") + window.PokiSDK.init().then(() => { + console.log("Poki SDK successfully initialized"); + window.poki = true; + // fire your function to continue to game +}).catch(() => { + console.log("Initialized, something went wrong, load you game anyway"); + // fire your function to continue to game +}); + } +}, 1000); + (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); })(window, document, "clarity", "script", "ndud94nvsg"); - console.log("Ads by adinplay!") window.aiptag = window.aiptag || {cmd: []}; aiptag.cmd.display = aiptag.cmd.display || []; aiptag.cmd.player = aiptag.cmd.player || [];