@awayfl/poki-player
Version:
AVM Player for poki games
133 lines (110 loc) • 2.62 kB
HTML
<head>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=UTF8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#382C2A">
<meta name="viewport"
content="height=device-height, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" />
<title>INSERT_TITLE</title>
<script type="text/javascript" src="//game-cdn.poki.com/scripts/v2/poki-sdk.js"></script>
<script type="text/javascript" src="./js/loader.js"></script>
<style>
* {
margin: 0;
padding: 0;
}
canvas {
outline: none
}
html,
body,
#container {
margin: 0;
overflow: hidden;
width: 100%;
height: 100%;
background-color: white;
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#splash {
position: absolute;
visibility: hidden;
z-index: 10;
}
#splash__image {
position: absolute;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-image: url("INSERT_SPLASHSCREEN");
visibility: visible;
z-index: 10;
}
#progress__root {
position: absolute;
}
#progress__line {
width: 0;
height: 100%;
transition: all 0.5s;
}
#loading__image {
position: absolute;
background-size: contain;
background-position: center;
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="splash__image">
<div id="progress__root">
<div id="progress__line"></div>
</div>
<div id="loading__image"></div>
</div>
<script>
window.addEventListener("load", () => {
PokiSDK.init().then(
() => {
// successfully initialized
onPokiInitComplete(false);
}
).catch(
() => {
// successfully initialized but the user has adblock
onPokiInitComplete(true);
}
);
let config;
INSERT_CODE
PokiSDK.setDebug(config.debugPoki);
Loader.init(config);
let onPokiInitComplete = (adBlocked) => {
PokiSDK.adBlocked = adBlocked;
PokiSDK.gameLoadingStart();
Loader.runGame((fill) => {
PokiSDK.gameLoadingProgress({
percentageDone: fill,
kbLoaded: 0,
kbTotal: 0,
fileNameLoaded: "",
filesLoaded: 0,
filesTotal: 0
});
}, (instance) => {
PokiSDK.gameLoadingFinished();
})
}
})
</script>
</body>
</html>