update
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m14s

This commit is contained in:
Smile Rex
2026-01-13 20:43:28 +03:00
parent 8b1b27f4d5
commit 7b09ecbf5b

View File

@@ -94,22 +94,58 @@ body {
<link rel="apple-touch-icon" href="D.apple-touch-icon.png"/>
<script src="https://telegram.org/js/telegram-web-app.js?59"></script>
<script>
const tg = window.Telegram.WebApp;
tg.expand();
function isTelegram() {
return typeof window.Telegram !== "undefined"
&& window.Telegram.WebApp;
}
function resizeCanvas() {
const canvas = document.getElementById("canvas");
const w = window.innerWidth;
const h = tg.viewportStableHeight;
canvas.style.width = w + "px";
canvas.style.height = h + "px";
let width;
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);
resizeCanvas();
</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>
<body>
<canvas id="canvas">