Update content of files

This commit is contained in:
GitHub Action 2022-08-24 14:31:30 +00:00
parent 7531073410
commit b8b34b3205
3 changed files with 13 additions and 3 deletions

View file

@ -284,6 +284,7 @@
var webAppInitData = '', webAppInitDataUnsafe = {};
var themeParams = {}, colorScheme = 'light';
var webAppVersion = '6.0';
var webAppPlatform = 'unknown';
if (initParams.tgWebAppData && initParams.tgWebAppData.length) {
webAppInitData = initParams.tgWebAppData;
@ -314,6 +315,9 @@
if (initParams.tgWebAppVersion) {
webAppVersion = initParams.tgWebAppVersion;
}
if (initParams.tgWebAppPlatform) {
webAppPlatform = initParams.tgWebAppPlatform;
}
function onThemeChanged(eventType, eventData) {
if (eventData.theme_params) {
@ -986,6 +990,10 @@
get: function(){ return webAppVersion; },
enumerable: true
});
Object.defineProperty(WebApp, 'platform', {
get: function(){ return webAppPlatform; },
enumerable: true
});
Object.defineProperty(WebApp, 'colorScheme', {
get: function(){ return colorScheme; },
enumerable: true

View file

@ -9,7 +9,7 @@
<meta name="MobileOptimized" content="176" />
<meta name="HandheldFriendly" content="True" />
<meta name="robots" content="noindex, nofollow" />
<script src="https://tg.dev/js/telegram-web-app.js?24"></script>
<script src="https://tg.dev/js/telegram-web-app.js?25"></script>
<script>
function setThemeClass() {
document.documentElement.className = Telegram.WebApp.colorScheme;

View file

@ -8,7 +8,7 @@
<meta name="MobileOptimized" content="176" />
<meta name="HandheldFriendly" content="True" />
<meta name="robots" content="noindex,nofollow" />
<script src="https://tg.dev/js/telegram-web-app.js?24"></script>
<script src="https://tg.dev/js/telegram-web-app.js?25"></script>
<script>
function setThemeClass() {
document.documentElement.className = Telegram.WebApp.colorScheme;
@ -92,7 +92,8 @@
Theme params
</div>
<div class="hint">
Version: <span id="ver"></span>
Version: <span id="ver"></span>,
platform: <span id="platform"></span>
</div>
</section>
<div class="viewport-border"></div>
@ -114,6 +115,7 @@ $('#regular_link').attr('href', $('#regular_link').attr('href') + location.hash)
$('#text_field').focus();
$('#ver').text(Telegram.WebApp.version);
$('#platform').text(Telegram.WebApp.platform);
if (DemoApp.initDataUnsafe.receiver) {
$('#peer_wrap').show();