-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
94 lines (85 loc) · 2.83 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Поющие лошади</title>
<style>
body {
--bg-color: var(--tg-theme-bg-color);
font: 12px/18px "Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica,
Verdana, sans-serif;
background-color: var(--bg-color);
color: var(--tg-theme-text-color);
margin: 0;
padding: 0;
color-scheme: var(--tg-color-scheme);
}
a {
color: var(--tg-theme-link-color);
}
#container {
height: 100vh;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
background-image: url("./assets/bg.jpg");
}
</style>
</head>
<body>
<main>
<div id="container"></div>
</main>
<script src="https://telegram.org/js/telegram-web-app.js"></script>
<script>
// Init TWA
Telegram.WebApp.ready();
// Event occurs whenever theme settings are changed in the user's Telegram app (including switching to night mode).
Telegram.WebApp.onEvent("themeChanged", function () {
document.documentElement.className = Telegram.WebApp.colorScheme;
});
function setViewportData() {
var sizeEl = document.getElementById("viewport-params-size");
sizeEl.innerText =
"width: " +
window.innerWidth +
" x " +
"height: " +
Telegram.WebApp.viewportStableHeight;
var expandEl = document.querySelector("#viewport-params-expand");
expandEl.innerText =
"Is Expanded: " + (Telegram.WebApp.isExpanded ? "true" : "false");
}
Telegram.WebApp.setHeaderColor("secondary_bg_color");
setViewportData();
Telegram.WebApp.onEvent("viewportChanged", setViewportData);
Telegram.WebApp.onEvent("themeChanged", function () {
document.body.setAttribute(
"style",
"--bg-color:" + Telegram.WebApp.backgroundColor
);
});
</script>
<script src="https://unpkg.com/@ruffle-rs/ruffle"></script>
<script>
window.RufflePlayer = window.RufflePlayer || {};
window.addEventListener("load", (event) => {
const ruffle = window.RufflePlayer.newest();
const player = ruffle.createPlayer();
player.style.width = "95%";
player.style.height = `${Math.round(
document.body.clientWidth * 0.95 * 0.55
)}px`;
const container = document.getElementById("container");
container.appendChild(player);
player.load("./assets/singing_horses.swf");
});
</script>
</body>
</html>