Update content of files

This commit is contained in:
GitHub Action 2024-11-05 00:32:09 +00:00
parent 26e6a23d1a
commit dc7898949b
14 changed files with 229 additions and 25 deletions

View file

@ -23,7 +23,7 @@
<link href="//telegram.org/css/bootstrap.min.css?3" rel="stylesheet">
<link href="//telegram.org/css/bootstrap-extra.css?2" rel="stylesheet">
<link href="//telegram.org/css/telegram.css?241" rel="stylesheet">
<link href="//telegram.org/css/widget-frame.css?67" rel="stylesheet">
<link href="//telegram.org/css/widget-frame.css?68" rel="stylesheet">
<link href="//telegram.org/css/promote.css?99" rel="stylesheet">
<link href="//telegram.org/css/jquery-ui.min.css?1" rel="stylesheet">
<link href="//telegram.org/css/tchart.min.css?10" rel="stylesheet">
@ -129,14 +129,14 @@
<script src="//telegram.org/js/main-aj.js?70"></script>
<script src="//telegram.org/js/main.js?47"></script>
<script src="//telegram.org/js/widget-frame.js?62"></script>
<script src="//telegram.org/js/promote.js?98"></script>
<script src="//telegram.org/js/promote.js?99"></script>
<script src="//telegram.org/js/jquery-ui.min.js?1"></script>
<script src="//telegram.org/js/jquery-ex.js?20"></script>
<script src="//telegram.org/js/tchart.min.js?18"></script>
<script src="//telegram.org/js/health.js?21"></script>
<script src="//telegram.org/js/tgsticker.js?31"></script>
<script>ajInit({"version":1033,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":1035,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <b>ads.telegram.org<\/b> as an exception to manage your promoted messages."});
Ads.init();
Aj.onLoad(function(state) {

View file

@ -23,7 +23,7 @@
<link href="//telegram.org/css/bootstrap.min.css?3" rel="stylesheet">
<link href="//telegram.org/css/bootstrap-extra.css?2" rel="stylesheet">
<link href="//telegram.org/css/telegram.css?241" rel="stylesheet">
<link href="//telegram.org/css/widget-frame.css?67" rel="stylesheet">
<link href="//telegram.org/css/widget-frame.css?68" rel="stylesheet">
<link href="//telegram.org/css/promote.css?99" rel="stylesheet">
<link href="//telegram.org/css/jquery-ui.min.css?1" rel="stylesheet">
<link href="//telegram.org/css/tchart.min.css?10" rel="stylesheet">
@ -129,14 +129,14 @@
<script src="//telegram.org/js/main-aj.js?70"></script>
<script src="//telegram.org/js/main.js?47"></script>
<script src="//telegram.org/js/widget-frame.js?62"></script>
<script src="//telegram.org/js/promote.js?98"></script>
<script src="//telegram.org/js/promote.js?99"></script>
<script src="//telegram.org/js/jquery-ui.min.js?1"></script>
<script src="//telegram.org/js/jquery-ex.js?20"></script>
<script src="//telegram.org/js/tchart.min.js?18"></script>
<script src="//telegram.org/js/health.js?21"></script>
<script src="//telegram.org/js/tgsticker.js?31"></script>
<script>ajInit({"version":1033,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":1035,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <b>ads.telegram.org<\/b> as an exception to manage your promoted messages."});
openPopup('#login-popup-container');
Ads.init();

View file

@ -22,7 +22,7 @@
<link href="//telegram.org/css/bootstrap.min.css?3" rel="stylesheet">
<link href="//telegram.org/css/bootstrap-extra.css?2" rel="stylesheet">
<link href="//telegram.org/css/telegram.css?241" rel="stylesheet">
<link href="//telegram.org/css/widget-frame.css?67" rel="stylesheet">
<link href="//telegram.org/css/widget-frame.css?68" rel="stylesheet">
<link href="//telegram.org/css/promote.css?99" rel="stylesheet">
<link href="//telegram.org/css/jquery-ui.min.css?1" rel="stylesheet">
<link href="//telegram.org/css/tchart.min.css?10" rel="stylesheet">
@ -255,14 +255,14 @@
<script src="//telegram.org/js/main-aj.js?70"></script>
<script src="//telegram.org/js/main.js?47"></script>
<script src="//telegram.org/js/widget-frame.js?62"></script>
<script src="//telegram.org/js/promote.js?98"></script>
<script src="//telegram.org/js/promote.js?99"></script>
<script src="//telegram.org/js/jquery-ui.min.js?1"></script>
<script src="//telegram.org/js/jquery-ex.js?20"></script>
<script src="//telegram.org/js/tchart.min.js?18"></script>
<script src="//telegram.org/js/health.js?21"></script>
<script src="//telegram.org/js/tgsticker.js?31"></script>
<script>ajInit({"version":1033,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":1035,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <b>ads.telegram.org<\/b> as an exception to manage your promoted messages."});
window.initDevPageNav&&initDevPageNav();
window.enableInlineVideo&&$('video').each(function(){enableInlineVideo(this)});

View file

@ -23,7 +23,7 @@
<link href="//telegram.org/css/bootstrap.min.css?3" rel="stylesheet">
<link href="//telegram.org/css/bootstrap-extra.css?2" rel="stylesheet">
<link href="//telegram.org/css/telegram.css?241" rel="stylesheet">
<link href="//telegram.org/css/widget-frame.css?67" rel="stylesheet">
<link href="//telegram.org/css/widget-frame.css?68" rel="stylesheet">
<link href="//telegram.org/css/promote.css?99" rel="stylesheet">
<link href="//telegram.org/css/jquery-ui.min.css?1" rel="stylesheet">
<link href="//telegram.org/css/tchart.min.css?10" rel="stylesheet">
@ -174,14 +174,14 @@
<script src="//telegram.org/js/main-aj.js?70"></script>
<script src="//telegram.org/js/main.js?47"></script>
<script src="//telegram.org/js/widget-frame.js?62"></script>
<script src="//telegram.org/js/promote.js?98"></script>
<script src="//telegram.org/js/promote.js?99"></script>
<script src="//telegram.org/js/jquery-ui.min.js?1"></script>
<script src="//telegram.org/js/jquery-ex.js?20"></script>
<script src="//telegram.org/js/tchart.min.js?18"></script>
<script src="//telegram.org/js/health.js?21"></script>
<script src="//telegram.org/js/tgsticker.js?31"></script>
<script>ajInit({"version":1033,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":1035,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <b>ads.telegram.org<\/b> as an exception to manage your promoted messages."});
window.enableInlineVideo&&$('video').each(function(){enableInlineVideo(this)});
Ads.init();

View file

@ -42,7 +42,7 @@
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Telegram APIs</h1>
<div id="dev_page_content"><p>We offer three kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib--build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <a href="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<div id="dev_page_content"><p>We offer three kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib-build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <a href="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<p>You can also add <a href="/widgets"><strong>Telegram Widgets</strong></a> to your website.</p>
<p>Designers are welcome to create <a href="/animated_stickers"><strong>Animated Stickers</strong></a> or <a href="/themes"><strong>Custom Themes</strong></a> for Telegram.</p>
<hr>

View file

@ -42,7 +42,7 @@
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Telegram APIs</h1>
<div id="dev_page_content"><p>We offer three kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib--build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <a href="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<div id="dev_page_content"><p>We offer three kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib-build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <a href="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<p>You can also add <a href="/widgets"><strong>Telegram Widgets</strong></a> to your website.</p>
<p>Designers are welcome to create <a href="/animated_stickers"><strong>Animated Stickers</strong></a> or <a href="/themes"><strong>Custom Themes</strong></a> for Telegram.</p>
<hr>

View file

@ -42,7 +42,7 @@
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Telegram APIs</h1>
<div id="dev_page_content"><p>We offer three kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib--build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <a href="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<div id="dev_page_content"><p>We offer three kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib-build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <a href="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<p>You can also add <a href="/widgets"><strong>Telegram Widgets</strong></a> to your website.</p>
<p>Designers are welcome to create <a href="/animated_stickers"><strong>Animated Stickers</strong></a> or <a href="/themes"><strong>Custom Themes</strong></a> for Telegram.</p>
<hr>

View file

@ -42,7 +42,7 @@
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Telegram APIs</h1>
<div id="dev_page_content"><p>We offer three kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib--build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <a href="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<div id="dev_page_content"><p>We offer three kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib-build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <a href="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<p>You can also add <a href="/widgets"><strong>Telegram Widgets</strong></a> to your website.</p>
<p>Designers are welcome to create <a href="/animated_stickers"><strong>Animated Stickers</strong></a> or <a href="/themes"><strong>Custom Themes</strong></a> for Telegram.</p>
<hr>

View file

@ -42,7 +42,7 @@
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Telegram APIs</h1>
<div id="dev_page_content"><p>We offer three kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib--build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <a href="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<div id="dev_page_content"><p>We offer three kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib-build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <a href="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<p>You can also add <a href="/widgets"><strong>Telegram Widgets</strong></a> to your website.</p>
<p>Designers are welcome to create <a href="/animated_stickers"><strong>Animated Stickers</strong></a> or <a href="/themes"><strong>Custom Themes</strong></a> for Telegram.</p>
<hr>

View file

@ -42,7 +42,7 @@
<div class="dev_page_bread_crumbs"></div>
<h1 id="dev_page_title">Telegram APIs</h1>
<div id="dev_page_content"><p>We offer three kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib--build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <a href="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<div id="dev_page_content"><p>We offer three kinds of APIs for developers. The <a href="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <a href="#tdlib-build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <a href="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<p>You can also add <a href="/widgets"><strong>Telegram Widgets</strong></a> to your website.</p>
<p>Designers are welcome to create <a href="/animated_stickers"><strong>Animated Stickers</strong></a> or <a href="/themes"><strong>Custom Themes</strong></a> for Telegram.</p>
<hr>

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-beta.js?56"></script>
<script src="https://tg.dev/js/telegram-web-app-beta.js?59"></script>
<script>
function setThemeClass() {
document.documentElement.className = Telegram.WebApp.colorScheme;

View file

@ -254,8 +254,17 @@ pre {
.viewport-stable_border {
height: var(--tg-viewport-stable-height, 100vh);
}
.safe-area_border {
position: fixed;
left: env(safe-area-inset-left);
right: env(safe-area-inset-right);
top: env(safe-area-inset-top);
bottom: env(safe-area-inset-bottom);
pointer-events: none;
}
.viewport-border:before,
.viewport-stable_border:before {
.viewport-stable_border:before,
.safe-area_border:before {
content: attr(text);
display: inline-block;
position: absolute;
@ -271,8 +280,14 @@ pre {
left: 0;
right: auto;
}
.safe-area_border:before {
content: 'safe-area';
background: orange;
right: 50px;
}
.viewport-border:after,
.viewport-stable_border:after {
.viewport-stable_border:after,
.safe-area_border:after {
content: '';
display: block;
position: absolute;
@ -284,4 +299,7 @@ pre {
}
.viewport-stable_border:after {
border-color: green;
}
.safe-area_border:after {
border-color: orange;
}

View file

@ -2,13 +2,13 @@
<html>
<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 name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
<meta name="format-detection" content="telephone=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<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-beta.js?56"></script>
<script src="https://tg.dev/js/telegram-web-app-beta.js?59"></script>
<script>
function setThemeClass() {
document.documentElement.className = Telegram.WebApp.colorScheme;
@ -19,7 +19,7 @@
</script>
<link href="https://tg.dev/css/bootstrap.min.css?3" rel="stylesheet">
<link href="https://tg.dev/css/bootstrap-extra.css?2" rel="stylesheet">
<link href="/css/webappdemo.css?11" rel="stylesheet">
<link href="/css/webappdemo.css?12" rel="stylesheet">
</head>
<body class="" style="visibility: hidden;">
<section id="top_sect" class="second">
@ -33,6 +33,7 @@
<button onclick="DemoApp.toggleSecondaryButton(this);">Hide Secondary Button</button>
<button onclick="DemoApp.toggleButtonsProgress(this);">Show Progress</button>
<button onclick="DemoApp.toggleSwipeBehavior(this);">Disable Vertical Swypes</button>
<button id="fullscreen_btn" onclick="DemoApp.toggleFullscreen(this);">Request Fullscreen</button>
<input type="text" placeholder="Input text in regular input..." />
<div class="input" contenteditable="true" data-placeholder="Input text in contenteditable field..."></div>
<div id="peer_wrap" style="display:none">
@ -88,6 +89,15 @@
<li><a href="javascript:Telegram.WebApp.openTelegramLink('https://t.me/addstickers/fltmp');">Stickerpack</a></li>
<li><a href="javascript:Telegram.WebApp.openTelegramLink('https://t.me/addstickers/fltmp', {force_request:true});">Stickerpack</a> (nocache)</li>
</ul>
<ul>
<li><a href="javascript:;" onclick="return DemoApp.checkHomeScreenStatus(this);">Check Home Screen Status</a> <span></span></li>
<li><a href="javascript:;" onclick="return DemoApp.addToHomeScreen(this);">Add to Home Screen</a></li>
</ul>
<ul>
<li><a href="javascript:DemoApp.setEmojiStatus(this, '5213305508034783384');">Set emoji status</a> <span></span></li>
<li><a href="javascript:DemoApp.setEmojiStatus(this, '5213305508034783384', 1730766967);">Set emoji status</a> for 5 min <span></span></li>
<li><a href="javascript:DemoApp.setEmojiStatus(this, '123');">Set emoji status</a> (invalid id) <span></span></li>
</ul>
<p>Test permissions:</p>
<div class="columns">
<ul>
@ -103,6 +113,14 @@
<li><a href="javascript:;" onclick="return DemoApp.requestServerTime(this);">Request server time</a> (invokes custom method) <span></span></li>
</ul>
</div>
<p>Sensors:</p>
<div class="columns">
<ul>
<li><a id="accelerometer_btn" href="javascript:;" onclick="return DemoApp.toggleAccelerometer(this);">Start Accelerometer</a> <span></span></li>
<li><a id="device_orientation_btn" href="javascript:;" onclick="return DemoApp.toggleDeviceOrientation(this);">Start DeviceOrientation</a> <span></span></li>
<li><a id="gyroscope_btn" href="javascript:;" onclick="return DemoApp.toggleGyroscope(this);">Start Gyroscope</a> <span></span></li>
</ul>
</div>
<p>Test alerts:</p>
<div class="columns">
<ul>
@ -174,11 +192,12 @@
platform: <span id="platform"></span>
</div>
</section>
<div class="safe-area_border"></div>
<div class="viewport-border"></div>
<div class="viewport-stable_border"></div>
<script src="/js/jquery.min.js"></script>
<script src="https://tg.dev/js/bootstrap.min.js"></script>
<script src="/js/webappdemo.js?31"></script>
<script src="/js/webappdemo.js?32"></script>
<script>DemoApp.apiUrl = "/demo/api";
Telegram.WebApp.onEvent('themeChanged', function() {
@ -324,6 +343,24 @@ try {
try {
DemoApp.biometricInit();
} catch(e) {}
try {
DemoApp.fullscreenInit();
} catch(e) {}
try {
DemoApp.accelerometerInit();
} catch(e) {}
try {
DemoApp.deviceOrientationInit();
} catch(e) {}
try {
DemoApp.gyroscopeInit();
} catch(e) {}
try {
DemoApp.homeScreenInit();
} catch(e) {}
try {
DemoApp.emojiStatusInit();
} catch(e) {}
</script>
</body>

View file

@ -447,6 +447,155 @@ var DemoApp = {
el.innerHTML = 'Disable Vertical Swypes';
}
},
fullscreenInit: function() {
Telegram.WebApp.onEvent('fullscreenChanged', function() {
DemoApp.updateFullscreenButton();
});
Telegram.WebApp.onEvent('fullscreenFailed', function(params) {
DemoApp.showAlert('fullscreenFailed: ' + params.error);
});
DemoApp.updateFullscreenButton();
},
toggleFullscreen: function(el) {
if (Telegram.WebApp.isFullscreen) {
Telegram.WebApp.exitFullscreen();
} else {
Telegram.WebApp.requestFullscreen();
}
},
updateFullscreenButton: function() {
if (Telegram.WebApp.isFullscreen) {
$('#fullscreen_btn').html('Exit Fullscreen');
} else {
$('#fullscreen_btn').html('Request Fullscreen');
}
},
accelerometerInit: function() {
Telegram.WebApp.onEvent('accelerometerStarted', function() {
$('#accelerometer_btn').next('span').text('').attr('class', '');
DemoApp.updateAccelerometerLink();
});
Telegram.WebApp.onEvent('accelerometerStopped', function() {
$('#accelerometer_btn').next('span').text('').attr('class', '');
DemoApp.updateAccelerometerLink();
});
Telegram.WebApp.onEvent('accelerometerChanged', function(params) {
$('#accelerometer_btn').next('span').text('(x: ' + params.x + '; y: ' + params.y + '; z: ' + params.z + ')').attr('class', 'ok');
});
Telegram.WebApp.onEvent('accelerometerFailed', function(params) {
$('#accelerometer_btn').next('span').text('(ERR: ' + params.error + ')').attr('class', 'err');
});
DemoApp.updateAccelerometerLink();
},
toggleAccelerometer: function(el) {
if (Telegram.WebApp.Accelerometer.isStarted) {
Telegram.WebApp.Accelerometer.stop();
} else {
Telegram.WebApp.Accelerometer.start(100);
}
},
updateAccelerometerLink: function() {
if (Telegram.WebApp.Accelerometer.isStarted) {
$('#accelerometer_btn').html('Stop Accelerometer');
} else {
$('#accelerometer_btn').html('Start Accelerometer');
}
},
deviceOrientationInit: function() {
Telegram.WebApp.onEvent('deviceOrientationStarted', function() {
$('#device_orientation_btn').next('span').text('').attr('class', '');
DemoApp.updateDeviceOrientationLink();
});
Telegram.WebApp.onEvent('deviceOrientationStopped', function() {
$('#device_orientation_btn').next('span').text('').attr('class', '');
DemoApp.updateDeviceOrientationLink();
});
Telegram.WebApp.onEvent('deviceOrientationChanged', function() {
$('#device_orientation_btn').next('span').text('(alpha: ' + params.alpha + '; beta: ' + params.beta + '; gamma: ' + params.gamma + ')').attr('class', 'ok');
});
Telegram.WebApp.onEvent('deviceOrientationFailed', function(params) {
$('#device_orientation_btn').next('span').text('(ERR: ' + params.error + ')').attr('class', 'err');
});
DemoApp.updateDeviceOrientationLink();
},
toggleDeviceOrientation: function(el) {
if (Telegram.WebApp.DeviceOrientation.isStarted) {
Telegram.WebApp.DeviceOrientation.stop();
} else {
Telegram.WebApp.DeviceOrientation.start(100);
}
},
updateDeviceOrientationLink: function() {
if (Telegram.WebApp.DeviceOrientation.isStarted) {
$('#device_orientation_btn').html('Stop DeviceOrientation');
} else {
$('#device_orientation_btn').html('Start DeviceOrientation');
}
},
gyroscopeInit: function() {
Telegram.WebApp.onEvent('gyroscopeStarted', function() {
$('#gyroscope_btn').next('span').text('').attr('class', '');
DemoApp.updateGyroscopeLink();
});
Telegram.WebApp.onEvent('gyroscopeStopped', function() {
$('#gyroscope_btn').next('span').text('').attr('class', '');
DemoApp.updateGyroscopeLink();
});
Telegram.WebApp.onEvent('gyroscopeChanged', function(params) {
$('#gyroscope_btn').next('span').text('(x: ' + params.x + '; y: ' + params.y + '; z: ' + params.z + ')').attr('class', 'ok');
});
Telegram.WebApp.onEvent('gyroscopeFailed', function(params) {
$('#gyroscope_btn').next('span').text('(ERR: ' + params.error + ')').attr('class', 'err');
});
DemoApp.updateGyroscopeLink();
},
toggleGyroscope: function(el) {
if (Telegram.WebApp.Gyroscope.isStarted) {
Telegram.WebApp.Gyroscope.stop();
} else {
Telegram.WebApp.Gyroscope.start(100);
}
},
updateGyroscopeLink: function() {
if (Telegram.WebApp.Gyroscope.isStarted) {
$('#gyroscope_btn').html('Stop Gyroscope');
} else {
$('#gyroscope_btn').html('Start Gyroscope');
}
},
homeScreenInit: function() {
Telegram.WebApp.onEvent('homeScreenFailed', function(params) {
DemoApp.showAlert('userEmojiStatusFailed: ' + params.error);
});
},
addToHomeScreen: function(el) {
Telegram.WebApp.addToHomeScreen(function(result) {
if (result) {
$(el).next('span').text('(added!)').attr('class', 'ok');
} else {
$(el).next('span').text('(NOT added)').attr('class', 'err');
}
});
},
checkHomeScreenStatus: function(el) {
Telegram.WebApp.checkHomeScreenStatus(function(is_added, is_supported) {
$(el).next('span').text('(is_added: ' + (is_added ? 'true' : 'false') + '; is_supported: ' + (is_supported ? 'true' : 'false') + ')').attr('class', 'ok');
});
},
emojiStatusInit: function() {
Telegram.WebApp.onEvent('userEmojiStatusFailed', function(params) {
DemoApp.showAlert('userEmojiStatusFailed: ' + params.error);
});
},
setEmojiStatus: function(el, custom_emoji_id, expiration_date) {
Telegram.WebApp.setUserEmojiStatus(custom_emoji_id, expiration_date ? {expiration_date: expiration_date} : {}, function(result) {
if (result) {
$(el).next('span').text('(status set!)').attr('class', 'ok');
} else {
$(el).next('span').text('(status NOT set)').attr('class', 'err');
}
});
},
showAlert: function(message) {
Telegram.WebApp.showAlert(message);
},