mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-12-26 22:40:24 +01:00
Update content of files
This commit is contained in:
parent
febf1953f0
commit
b57f01e298
6 changed files with 101 additions and 57 deletions
|
@ -449,6 +449,8 @@
|
|||
enumerable: true
|
||||
});
|
||||
|
||||
var curButtonState = null;
|
||||
|
||||
WebView.onEvent('main_button_pressed', onMainButtonPressed);
|
||||
|
||||
var debugBtn = null, debugBtnStyle = {};
|
||||
|
@ -487,38 +489,63 @@
|
|||
}
|
||||
}
|
||||
|
||||
function updateButton() {
|
||||
function buttonParams() {
|
||||
var color = mainButton.color;
|
||||
var text_color = mainButton.textColor;
|
||||
WebView.postEvent('web_app_setup_main_button', false, isVisible ? {
|
||||
return isVisible ? {
|
||||
is_visible: true,
|
||||
is_active: isActive,
|
||||
is_progress_visible: isProgressVisible,
|
||||
text: buttonText,
|
||||
color: color,
|
||||
text_color: text_color
|
||||
} : {is_visible: false});
|
||||
if (initParams.tgWebAppDebug) {
|
||||
debugBtn.style.display = isVisible ? 'block' : 'none';
|
||||
debugBtn.style.opacity = isActive ? '1' : '0.8';
|
||||
debugBtn.style.cursor = isActive ? 'pointer' : 'auto';
|
||||
debugBtn.disabled = !isActive;
|
||||
debugBtn.innerText = buttonText;
|
||||
debugBtn.style.backgroundImage = isProgressVisible ? "url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20viewport%3D%220%200%2048%2048%22%20width%3D%2248px%22%20height%3D%2248px%22%3E%3Ccircle%20cx%3D%2250%25%22%20cy%3D%2250%25%22%20stroke%3D%22%23fff%22%20stroke-width%3D%222.25%22%20stroke-linecap%3D%22round%22%20fill%3D%22none%22%20stroke-dashoffset%3D%22106%22%20r%3D%229%22%20stroke-dasharray%3D%2256.52%22%20rotate%3D%22-90%22%3E%3Canimate%20attributeName%3D%22stroke-dashoffset%22%20attributeType%3D%22XML%22%20dur%3D%22360s%22%20from%3D%220%22%20to%3D%2212500%22%20repeatCount%3D%22indefinite%22%3E%3C%2Fanimate%3E%3CanimateTransform%20attributeName%3D%22transform%22%20attributeType%3D%22XML%22%20type%3D%22rotate%22%20dur%3D%221s%22%20from%3D%22-90%2024%2024%22%20to%3D%22630%2024%2024%22%20repeatCount%3D%22indefinite%22%3E%3C%2FanimateTransform%3E%3C%2Fcircle%3E%3C%2Fsvg%3E')" : 'none';
|
||||
debugBtn.style.backgroundColor = color;
|
||||
debugBtn.style.color = text_color;
|
||||
} : {is_visible: false};
|
||||
}
|
||||
|
||||
mainButtonHeight = (isVisible ? 48 : 0);
|
||||
if (document.documentElement) {
|
||||
document.documentElement.style.boxSizing = 'border-box';
|
||||
document.documentElement.style.paddingBottom = mainButtonHeight + 'px';
|
||||
}
|
||||
setViewportHeight();
|
||||
function buttonState(btn_params) {
|
||||
if (typeof btn_params === 'undefined') {
|
||||
btn_params = buttonParams();
|
||||
}
|
||||
return JSON.stringify(btn_params);
|
||||
}
|
||||
|
||||
function updateButton() {
|
||||
var btn_params = buttonParams();
|
||||
var btn_state = buttonState(btn_params);
|
||||
if (curButtonState === btn_state) {
|
||||
return;
|
||||
}
|
||||
curButtonState = btn_state;
|
||||
WebView.postEvent('web_app_setup_main_button', false, btn_params);
|
||||
if (initParams.tgWebAppDebug) {
|
||||
updateDebugButton(btn_params);
|
||||
}
|
||||
}
|
||||
|
||||
function updateDebugButton(btn_params) {
|
||||
if (btn_params.is_visible) {
|
||||
debugBtn.style.display = 'block';
|
||||
mainButtonHeight = 48;
|
||||
|
||||
debugBtn.style.opacity = btn_params.is_active ? '1' : '0.8';
|
||||
debugBtn.style.cursor = btn_params.is_active ? 'pointer' : 'auto';
|
||||
debugBtn.disabled = !btn_params.is_active;
|
||||
debugBtn.innerText = btn_params.text;
|
||||
debugBtn.style.backgroundImage = btn_params.is_progress_visible ? "url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20viewport%3D%220%200%2048%2048%22%20width%3D%2248px%22%20height%3D%2248px%22%3E%3Ccircle%20cx%3D%2250%25%22%20cy%3D%2250%25%22%20stroke%3D%22%23fff%22%20stroke-width%3D%222.25%22%20stroke-linecap%3D%22round%22%20fill%3D%22none%22%20stroke-dashoffset%3D%22106%22%20r%3D%229%22%20stroke-dasharray%3D%2256.52%22%20rotate%3D%22-90%22%3E%3Canimate%20attributeName%3D%22stroke-dashoffset%22%20attributeType%3D%22XML%22%20dur%3D%22360s%22%20from%3D%220%22%20to%3D%2212500%22%20repeatCount%3D%22indefinite%22%3E%3C%2Fanimate%3E%3CanimateTransform%20attributeName%3D%22transform%22%20attributeType%3D%22XML%22%20type%3D%22rotate%22%20dur%3D%221s%22%20from%3D%22-90%2024%2024%22%20to%3D%22630%2024%2024%22%20repeatCount%3D%22indefinite%22%3E%3C%2FanimateTransform%3E%3C%2Fcircle%3E%3C%2Fsvg%3E')" : 'none';
|
||||
debugBtn.style.backgroundColor = btn_params.color;
|
||||
debugBtn.style.color = btn_params.text_color;
|
||||
} else {
|
||||
debugBtn.style.display = 'none';
|
||||
mainButtonHeight = 0;
|
||||
}
|
||||
if (document.documentElement) {
|
||||
document.documentElement.style.boxSizing = 'border-box';
|
||||
document.documentElement.style.paddingBottom = mainButtonHeight + 'px';
|
||||
}
|
||||
setViewportHeight();
|
||||
}
|
||||
|
||||
function setParams(params) {
|
||||
var changed = false;
|
||||
if (typeof params.text !== 'undefined') {
|
||||
var text = params.text.toString().replace(/^\s+|\s+$/g, '');
|
||||
if (!text.length) {
|
||||
|
@ -529,17 +556,11 @@
|
|||
console.error('[Telegram.WebApp] Main button text is too long', text);
|
||||
throw Error('WebAppMainButtonParamInvalid');
|
||||
}
|
||||
if (buttonText !== text) {
|
||||
changed = true;
|
||||
}
|
||||
buttonText = text;
|
||||
}
|
||||
if (typeof params.color !== 'undefined') {
|
||||
if (params.color === false ||
|
||||
params.color === null) {
|
||||
if (buttonColor !== false) {
|
||||
changed = true;
|
||||
}
|
||||
buttonColor = false;
|
||||
} else {
|
||||
var color = parseColorToHex(params.color);
|
||||
|
@ -547,18 +568,12 @@
|
|||
console.error('[Telegram.WebApp] Main button color format is invalid', color);
|
||||
throw Error('WebAppMainButtonParamInvalid');
|
||||
}
|
||||
if (buttonColor !== color) {
|
||||
changed = true;
|
||||
}
|
||||
buttonColor = color;
|
||||
}
|
||||
}
|
||||
if (typeof params.text_color !== 'undefined') {
|
||||
if (params.text_color === false ||
|
||||
params.text_color === null) {
|
||||
if (buttonTextColor !== false) {
|
||||
changed = true;
|
||||
}
|
||||
buttonTextColor = false;
|
||||
} else {
|
||||
var text_color = parseColorToHex(params.text_color);
|
||||
|
@ -566,9 +581,6 @@
|
|||
console.error('[Telegram.WebApp] Main button text color format is invalid', text_color);
|
||||
throw Error('WebAppMainButtonParamInvalid');
|
||||
}
|
||||
if (buttonTextColor !== text_color) {
|
||||
changed = true;
|
||||
}
|
||||
buttonTextColor = text_color;
|
||||
}
|
||||
}
|
||||
|
@ -578,20 +590,12 @@
|
|||
console.error('[Telegram.WebApp] Main button text is required');
|
||||
throw Error('WebAppMainButtonParamInvalid');
|
||||
}
|
||||
if (isVisible !== !!params.is_visible) {
|
||||
changed = true;
|
||||
}
|
||||
isVisible = !!params.is_visible;
|
||||
}
|
||||
if (typeof params.is_active !== 'undefined') {
|
||||
if (isActive !== !!params.is_active) {
|
||||
changed = true;
|
||||
}
|
||||
isActive = !!params.is_active;
|
||||
}
|
||||
if (changed || params.force_update) {
|
||||
updateButton();
|
||||
}
|
||||
updateButton();
|
||||
return mainButton;
|
||||
}
|
||||
|
||||
|
|
|
@ -1666,7 +1666,7 @@
|
|||
<div class="tr-key-row" data-href="/en/android/bots_and_payments/BotRemoveFromMenu" data-langpack="android" data-section="bots_and_payments" data-key="BotRemoveFromMenu">
|
||||
<div class="tr-value-media"><a class="tr-value-photo bg-image key-layer" style="background-image:url('https://telegra.ph/file/p/e620f295565/7c6890e7bf09399a172a517.jpg?c=53,369,421,421,280,280');" href="/screenshots/11026/phrase/BotRemoveFromMenu" data-layer><div class="screenshot-key" style="padding:57px 13px 59px 7px;"><div class="key-box"></div></div></a></div>
|
||||
<div class="tr-value-body">
|
||||
|
||||
<span class="has-binding binding"></span>
|
||||
<div class="tr-value-default"><a class="tr-value-link" href="/en/android/bots_and_payments/BotRemoveFromMenu"><span class="p-value"><span class="value">Remove **<mark class="token">%1$s</mark>** from the attachment menu?</span></span></a></div>
|
||||
<div class="tr-value-key">BotRemoveFromMenu</div>
|
||||
<div class="tr-value-suggestions">
|
||||
|
|
|
@ -179,7 +179,7 @@
|
|||
</div></nav>
|
||||
<section class="content clearfix">
|
||||
<section class="tr-content"><h3 class="tr-header">
|
||||
<a href="/en/" class="tr-back"></a>iOS<span class="tr-header-counter">5287</span>
|
||||
<a href="/en/" class="tr-back"></a>iOS<span class="tr-header-counter">5290</span>
|
||||
<div class="tr-header-tabs"><span class="tr-header-tab"><a href="/en/ios/recent/translations">Translations</a></span><span class="tr-header-tab"><a href="/en/ios/recent/suggestions">Suggestions</a></span><span class="tr-header-tab"><a href="/en/ios/recent/comments">Comments</a></span></div>
|
||||
</h3>
|
||||
<section class="tr-sections clearfix">
|
||||
|
@ -236,7 +236,7 @@
|
|||
</div><div class="tr-section-col col-lg-4 col-xs-6">
|
||||
<div class="tr-section-wrap"><a href="/en/ios/unsorted/" class="tr-section">
|
||||
<div class="tr-section-cover cover0"></div>
|
||||
<div class="tr-section-caption">Unsorted (636)</div>
|
||||
<div class="tr-section-caption">Unsorted (639)</div>
|
||||
</a></div>
|
||||
</div>
|
||||
</section></section>
|
||||
|
|
|
@ -47,6 +47,45 @@
|
|||
<div class="tr-value-suggestions">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="tr-key-row-wrap">
|
||||
<div class="tr-key-row" data-href="/en/ios/unsorted/Gallery.GifSaved" data-langpack="ios" data-section="unsorted" data-key="Gallery.GifSaved">
|
||||
<div class="tr-value-media"><div class="tr-value-photo"></div></div>
|
||||
<div class="tr-value-body">
|
||||
|
||||
<div class="tr-value-default"><a class="tr-value-link" href="/en/ios/unsorted/Gallery.GifSaved"><span class="p-value"><span class="value">GIF Saved</span></span></a></div>
|
||||
<div class="tr-value-key">Gallery.GifSaved</div>
|
||||
<div class="tr-value-suggestions">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="tr-key-row-wrap">
|
||||
<div class="tr-key-row" data-href="/en/ios/unsorted/WebApp.RemoveConfirmationText" data-langpack="ios" data-section="unsorted" data-key="WebApp.RemoveConfirmationText">
|
||||
<div class="tr-value-media"><div class="tr-value-photo"></div></div>
|
||||
<div class="tr-value-body">
|
||||
<span class="has-binding binding"></span>
|
||||
<div class="tr-value-default"><a class="tr-value-link" href="/en/ios/unsorted/WebApp.RemoveConfirmationText"><span class="p-value"><span class="value">Remove **<mark class="token">%@</mark>** from the attachment menu?</span></span></a></div>
|
||||
<div class="tr-value-key">WebApp.RemoveConfirmationText</div>
|
||||
<div class="tr-value-suggestions">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="tr-key-row-wrap">
|
||||
<div class="tr-key-row" data-href="/en/ios/unsorted/WebApp.RemoveConfirmationTitle" data-langpack="ios" data-section="unsorted" data-key="WebApp.RemoveConfirmationTitle">
|
||||
<div class="tr-value-media"><div class="tr-value-photo"></div></div>
|
||||
<div class="tr-value-body">
|
||||
|
||||
<div class="tr-value-default"><a class="tr-value-link" href="/en/ios/unsorted/WebApp.RemoveConfirmationTitle"><span class="p-value"><span class="value">Remove Bot</span></span></a></div>
|
||||
<div class="tr-value-key">WebApp.RemoveConfirmationTitle</div>
|
||||
<div class="tr-value-suggestions">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2559,7 +2598,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="tr-key-row-wrap">
|
||||
</div><div class="tr-load-more load-more" data-offset="200"><a class="btn btn-default load-more-btn">Load More</a></div>
|
||||
<div class="tr-key-row-wrap">
|
||||
<div class="tr-key-row" data-href="/en/ios/unsorted/VoiceChat.UnpinVideo" data-langpack="ios" data-section="unsorted" data-key="VoiceChat.UnpinVideo">
|
||||
<div class="tr-value-media"><div class="tr-value-photo"></div></div>
|
||||
<div class="tr-value-body">
|
||||
|
@ -2598,8 +2638,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="tr-load-more load-more" data-offset="200"><a class="btn btn-default load-more-btn">Load More</a></div>
|
||||
<div class="tr-key-row-wrap">
|
||||
</div><div class="tr-key-row-wrap">
|
||||
<div class="tr-key-row" data-href="/en/ios/unsorted/VoiceChat.TapToViewCameraVideo" data-langpack="ios" data-section="unsorted" data-key="VoiceChat.TapToViewCameraVideo">
|
||||
<div class="tr-value-media"><div class="tr-value-photo"></div></div>
|
||||
<div class="tr-value-body">
|
||||
|
@ -5160,7 +5199,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="tr-key-row-wrap">
|
||||
</div><div class="tr-load-more load-more" data-offset="400"><a class="btn btn-default load-more-btn">Load More</a></div>
|
||||
<div class="tr-key-row-wrap">
|
||||
<div class="tr-key-row" data-href="/en/ios/unsorted/Message.ForwardedPsa.covid" data-langpack="ios" data-section="unsorted" data-key="Message.ForwardedPsa.covid">
|
||||
<div class="tr-value-media"><div class="tr-value-photo"></div></div>
|
||||
<div class="tr-value-body">
|
||||
|
@ -5199,8 +5239,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="tr-load-more load-more" data-offset="400"><a class="btn btn-default load-more-btn">Load More</a></div>
|
||||
<div class="tr-key-row-wrap">
|
||||
</div><div class="tr-key-row-wrap">
|
||||
<div class="tr-key-row" data-href="/en/ios/unsorted/ChatList.GenericPsaLabel" data-langpack="ios" data-section="unsorted" data-key="ChatList.GenericPsaLabel">
|
||||
<div class="tr-value-media"><div class="tr-value-photo"></div></div>
|
||||
<div class="tr-value-body">
|
||||
|
@ -7761,7 +7800,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="tr-key-row-wrap">
|
||||
</div><div class="tr-load-more load-more" data-offset="600"><a class="btn btn-default load-more-btn">Load More</a></div>
|
||||
<div class="tr-key-row-wrap">
|
||||
<div class="tr-key-row" data-href="/en/ios/unsorted/Chat.DeleteMessagesConfirmation" data-langpack="ios" data-section="unsorted" data-key="Chat.DeleteMessagesConfirmation">
|
||||
<div class="tr-value-media"><div class="tr-value-photo"></div></div>
|
||||
<div class="tr-value-body">
|
||||
|
@ -7800,8 +7840,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="tr-load-more load-more" data-offset="600"><a class="btn btn-default load-more-btn">Load More</a></div>
|
||||
<div class="tr-key-row-wrap">
|
||||
</div><div class="tr-key-row-wrap">
|
||||
<div class="tr-key-row" data-href="/en/ios/unsorted/Watch.Message.Unsupported" data-langpack="ios" data-section="unsorted" data-key="Watch.Message.Unsupported">
|
||||
<div class="tr-value-media"><div class="tr-value-photo"></div></div>
|
||||
<div class="tr-value-body">
|
||||
|
|
|
@ -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?3"></script>
|
||||
<script src="https://tg.dev/js/telegram-web-app.js?4"></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://telegram.org/js/telegram-web-app.js?3"></script>
|
||||
<script src="https://telegram.org/js/telegram-web-app.js?4"></script>
|
||||
<script>
|
||||
function setThemeClass() {
|
||||
document.documentElement.className = Telegram.WebApp.colorScheme;
|
||||
|
@ -158,6 +158,7 @@
|
|||
<button id="data_btn" onclick="sendTime(true);">Send current time to bot (x10)</button>
|
||||
<button onclick="webviewExpand();">Expand Webview</button>
|
||||
<button onclick="toggleMainButton(this);">Hide Main Button</button>
|
||||
<input type="text" />
|
||||
<div id="btn_status" class="hint" style="display: none;">
|
||||
</div>
|
||||
<p>Test links:</p>
|
||||
|
|
Loading…
Reference in a new issue