Update content of files

This commit is contained in:
GitHub Action 2022-04-09 21:57:53 +00:00
parent 8ae0692fa3
commit 00dcae7ef4
2 changed files with 16 additions and 7 deletions

View file

@ -211,16 +211,15 @@
}
}
var themeParams = {};
var themeParams = {}, colorScheme = 'light';
function setThemeParams(theme_params) {
var color;
for (var key in theme_params) {
if (color = parseColorToHex(theme_params[key])) {
themeParams[key] = color;
if (key == 'bg_color') {
var color_scheme = isColorDark(color) ? 'dark' : 'light'
themeParams.color_scheme = color_scheme;
setCssProperty('theme-color-scheme', color_scheme);
colorScheme = isColorDark(color) ? 'dark' : 'light'
setCssProperty('color-scheme', colorScheme);
}
key = 'theme-' + key.split('_').join('-');
setCssProperty(key, color);
@ -589,8 +588,6 @@
}
};
window.Telegram.WebApp = {
initData: webAppData,
initDataRaw: webAppDataRaw,
onEvent: onEvent,
offEvent: offEvent,
MainButton: MainButton,
@ -615,6 +612,18 @@
postEvent('web_app_close');
}
};
Object.defineProperty(window.Telegram.WebApp, 'initData', {
get: function(){ return webAppData; },
enumerable: true
});
Object.defineProperty(window.Telegram.WebApp, 'initDataRaw', {
get: function(){ return webAppDataRaw; },
enumerable: true
});
Object.defineProperty(window.Telegram.WebApp, 'colorScheme', {
get: function(){ return colorScheme; },
enumerable: true
});
Object.defineProperty(window.Telegram.WebApp, 'viewportHeight', {
get: function(){ return (viewportHeight === false ? window.innerHeight : viewportHeight) - mainButtonHeight; },
enumerable: true

View file

@ -5,7 +5,7 @@ body {
font-weight: 500;
background-color: var(--block-bg-color);
color: var(--text-color);
color-scheme: var(--tg-theme-color-scheme);
color-scheme: var(--tg-color-scheme);
margin: 0;
padding: 0;
width: 1px;