update
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m14s
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m14s
This commit is contained in:
@@ -94,22 +94,58 @@ body {
|
|||||||
<link rel="apple-touch-icon" href="D.apple-touch-icon.png"/>
|
<link rel="apple-touch-icon" href="D.apple-touch-icon.png"/>
|
||||||
<script src="https://telegram.org/js/telegram-web-app.js?59"></script>
|
<script src="https://telegram.org/js/telegram-web-app.js?59"></script>
|
||||||
<script>
|
<script>
|
||||||
const tg = window.Telegram.WebApp;
|
function isTelegram() {
|
||||||
tg.expand();
|
return typeof window.Telegram !== "undefined"
|
||||||
|
&& window.Telegram.WebApp;
|
||||||
|
}
|
||||||
|
|
||||||
function resizeCanvas() {
|
function resizeCanvas() {
|
||||||
const canvas = document.getElementById("canvas");
|
const canvas = document.getElementById("canvas");
|
||||||
const w = window.innerWidth;
|
|
||||||
const h = tg.viewportStableHeight;
|
|
||||||
|
|
||||||
canvas.style.width = w + "px";
|
let width;
|
||||||
canvas.style.height = h + "px";
|
let height;
|
||||||
|
|
||||||
|
if (isTelegram()) {
|
||||||
|
const tg = window.Telegram.WebApp;
|
||||||
|
tg.expand();
|
||||||
|
|
||||||
|
// ⬅️ КЛЮЧЕВОЕ МЕСТО
|
||||||
|
width = document.documentElement.clientWidth;
|
||||||
|
height = tg.viewportStableHeight;
|
||||||
|
} else {
|
||||||
|
width = document.documentElement.clientWidth;
|
||||||
|
height = document.documentElement.clientHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.style.width = width + "px";
|
||||||
|
canvas.style.height = height + "px";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isTelegram()) {
|
||||||
|
Telegram.WebApp.onEvent("viewportChanged", resizeCanvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
tg.onEvent("viewportChanged", resizeCanvas);
|
|
||||||
window.addEventListener("resize", resizeCanvas);
|
window.addEventListener("resize", resizeCanvas);
|
||||||
resizeCanvas();
|
resizeCanvas();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
html, body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
background: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<canvas id="canvas">
|
<canvas id="canvas">
|
||||||
|
|||||||
Reference in New Issue
Block a user