mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2025-03-08 10:24:43 +01:00
Update content of files
This commit is contained in:
parent
be7f4ad9db
commit
ccb6e9691f
4 changed files with 36 additions and 3 deletions
|
@ -464,6 +464,16 @@
|
|||
WebView.postEvent('web_app_setup_closing_behavior', false, {need_confirmation: isClosingConfirmationEnabled});
|
||||
}
|
||||
|
||||
var isVerticalSwipesEnabled = true;
|
||||
function toggleVerticalSwipes(enable_swipes) {
|
||||
if (!versionAtLeast('7.6')) {
|
||||
console.warn('[Telegram.WebApp] Changing swipes behavior is not supported in version ' + webAppVersion);
|
||||
return;
|
||||
}
|
||||
isVerticalSwipesEnabled = !!enable_swipes;
|
||||
WebView.postEvent('web_app_setup_swipe_behavior', false, {allow_vertical_swipe: isVerticalSwipesEnabled});
|
||||
}
|
||||
|
||||
var headerColorKey = 'bg_color', headerColor = null;
|
||||
function getHeaderColor() {
|
||||
if (headerColorKey == 'secondary_bg_color') {
|
||||
|
@ -1422,6 +1432,7 @@
|
|||
}
|
||||
function onScanQrPopupClosed(eventType, eventData) {
|
||||
webAppScanQrPopupOpened = false;
|
||||
receiveWebViewEvent('scanQrPopupClosed');
|
||||
}
|
||||
|
||||
function onClipboardTextReceived(eventType, eventData) {
|
||||
|
@ -1589,6 +1600,11 @@
|
|||
get: function(){ return isClosingConfirmationEnabled; },
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(WebApp, 'isVerticalSwipesEnabled', {
|
||||
set: function(val){ toggleVerticalSwipes(val); },
|
||||
get: function(){ return isVerticalSwipesEnabled; },
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(WebApp, 'headerColor', {
|
||||
set: function(val){ setHeaderColor(val); },
|
||||
get: function(){ return getHeaderColor(); },
|
||||
|
@ -1635,6 +1651,12 @@
|
|||
WebApp.disableClosingConfirmation = function() {
|
||||
WebApp.isClosingConfirmationEnabled = false;
|
||||
};
|
||||
WebApp.enableVerticalSwipes = function() {
|
||||
WebApp.isVerticalSwipesEnabled = true;
|
||||
};
|
||||
WebApp.disableVerticalSwipes = function() {
|
||||
WebApp.isVerticalSwipesEnabled = false;
|
||||
};
|
||||
WebApp.isVersionAtLeast = function(ver) {
|
||||
return versionAtLeast(ver);
|
||||
};
|
||||
|
|
|
@ -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?47"></script>
|
||||
<script src="https://tg.dev/js/telegram-web-app.js?48"></script>
|
||||
<script>
|
||||
function setThemeClass() {
|
||||
document.documentElement.className = Telegram.WebApp.colorScheme;
|
||||
|
|
|
@ -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?47"></script>
|
||||
<script src="https://tg.dev/js/telegram-web-app.js?48"></script>
|
||||
<script>
|
||||
function setThemeClass() {
|
||||
document.documentElement.className = Telegram.WebApp.colorScheme;
|
||||
|
@ -30,6 +30,7 @@
|
|||
<button onclick="DemoApp.toggleBackButton(this);">Show Back Button</button>
|
||||
<button onclick="DemoApp.toggleSettingsButton(this);">Show Settings Button</button>
|
||||
<button onclick="DemoApp.toggleMainButton(this);">Hide Main Button</button>
|
||||
<button onclick="DemoApp.toggleSwipeBehavior(this);">Disable Vertical Swypes</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">
|
||||
|
@ -67,6 +68,7 @@
|
|||
<li><a href="javascript:Telegram.WebApp.openLink('https://telegram.org',{try_browser:'firefox'});">telegram.org</a> (opens in Firefox)</li>
|
||||
<li><a href="javascript:Telegram.WebApp.openLink('https://telegram.org',{try_browser:'safari'});">telegram.org</a> (opens in Safari)</li>
|
||||
<li><a href="javascript:Telegram.WebApp.openLink('https://telegram.org',{try_browser:'opera'});">telegram.org</a> (opens in Opera)</li>
|
||||
<li><a href="javascript:Telegram.WebApp.close({return_back:true});">Return back</a> (Android only)</li>
|
||||
</ul>
|
||||
<p>Test permissions:</p>
|
||||
<div class="columns">
|
||||
|
@ -158,7 +160,7 @@
|
|||
<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?28"></script>
|
||||
<script src="/js/webappdemo.js?29"></script>
|
||||
<script>DemoApp.apiUrl = "/demo/api";
|
||||
|
||||
Telegram.WebApp.onEvent('themeChanged', function() {
|
||||
|
|
|
@ -400,6 +400,15 @@ var DemoApp = {
|
|||
el.innerHTML = 'Hide Settings Button';
|
||||
}
|
||||
},
|
||||
toggleSwipeBehavior: function(el) {
|
||||
if (Telegram.WebApp.isVerticalSwipesEnabled) {
|
||||
Telegram.WebApp.disableVerticalSwipes();
|
||||
el.innerHTML = 'Enable Vertical Swypes';
|
||||
} else {
|
||||
Telegram.WebApp.enableVerticalSwipes();
|
||||
el.innerHTML = 'Disable Vertical Swypes';
|
||||
}
|
||||
},
|
||||
showAlert: function(message) {
|
||||
Telegram.WebApp.showAlert(message);
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue