You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tobspr_shapez.io/artwork/gamedistribution/iframe/index.html

86 lines
2.8 KiB

<!DOCTYPE html>
<html>
<head>
<title>shapez.io</title>
<script type="text/javascript">
function postToGameFrame(msg) {
var handle = document.getElementById("gameframe");
if (handle) {
handle.contentWindow.postMessage(msg, "*");
}
}
window.addEventListener("message", function (event) {
if (event.data === "shapezio://gd.game_loaded") {
console.log("Game loaded");
}
if (event.data === "shapezio://gd.show_ad") {
console.log("Got ad message");
gdsdk.showAd();
}
});
window["GD_OPTIONS"] = {
gameId: "ac8e6fc04a6f46f990ac6a317bb4d74e",
onEvent: function (event) {
switch (event.name) {
case "SDK_GAME_START":
console.log("GDSDK: ad finished");
postToGameFrame("shapezio://gd.ad_finished");
setTimeout(function () {
document.getElementById("gameframe").focus();
console.log("(GD-PARENT_FRAME) successfully focused frame");
}, 500);
break;
case "SDK_GAME_PAUSE":
// pause game logic / mute audio
console.log("GDSDK: ad started");
postToGameFrame("shapezio://gd.ad_started");
break;
}
},
};
(function (d, s, id) {
var js,
fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.src = "https://html5.api.gamedistribution.com/main.min.js";
fjs.parentNode.insertBefore(js, fjs);
})(document, "script", "gamedistribution-jssdk");
</script>
<style>
body {
background: #222428;
text-align: center;
font-family: Arial;
color: #eee;
}
#gameframe {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
display: block;
z-index: 1;
}
</style>
</head>
<body style="background: #333;">
<iframe
onclick="this.focus()"
src="https://shapez.io?embed=gamedistribution"
id="gameframe"
allowfullscreen
></iframe>
</body>
</html>