Skip to content

Commit

Permalink
Poki?
Browse files Browse the repository at this point in the history
  • Loading branch information
codergautam committed Oct 21, 2024
1 parent f45dc83 commit cf2727f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 8 deletions.
38 changes: 31 additions & 7 deletions components/headContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3340825671684972" crossorigin="anonymous">
const script2 = document.createElement('script');
script2.src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3340825671684972";
script2.async = true;
script2.crossorigin = "anonymous";
document.body.appendChild(script2);

return () => {
document.body.removeChild(script);
document.body.removeChild(script2);
};
} else {
} else if(window.location.search.includes("crazygames")) {
console.log("CrazyGames detected");
//<script src="https://sdk.crazygames.com/crazygames-sdk-v3.js"></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);
}

}
}, []);

Expand Down Expand Up @@ -44,11 +72,7 @@ export default function HeadContent({text}) {
src="https://maps.googleapis.com/maps/api/js?v=weekly"
defer
></script>
<script src="https://sdk.crazygames.com/crazygames-sdk-v3.js"></script>
{/* <script src="https://greggman.github.io/webgl-helpers/webgl-force-preservedrawingbuffer.js"></script> */}
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3340825671684972"
crossorigin="anonymous">
</script>

{/* data-adbreak-test="on" */}
{/* */}

Expand Down
22 changes: 21 additions & 1 deletion components/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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 || [];
Expand Down

0 comments on commit cf2727f

Please sign in to comment.