mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-11-23 15:58:27 +01:00
Update content of files
This commit is contained in:
parent
b7014183f0
commit
60769e73f5
2 changed files with 33 additions and 2 deletions
|
@ -450,9 +450,11 @@
|
|||
mainButton.setParams = setParams;
|
||||
mainButton.setText = function(text) {
|
||||
mainButton.text = text;
|
||||
return mainButton;
|
||||
};
|
||||
mainButton.onClick = function(callback) {
|
||||
onClickCallback = callback;
|
||||
return mainButton;
|
||||
};
|
||||
mainButton.show = function() {
|
||||
return mainButton.setParams({is_visible: true});
|
||||
|
|
|
@ -150,7 +150,7 @@ function sendMessage(msg_id, with_webview) {
|
|||
$('#btn_status').text('Sending...').removeClass('ok err').show();
|
||||
$.ajax('/demo/sendMessage', {
|
||||
type: 'POST',
|
||||
data: {query_id: WebAppData.query_id, msg_id: msg_id || '', with_webview: !WebAppData.receiver && with_webview ? 1 : 0},
|
||||
data: {_auth: WebAppDataRaw, query_id: WebAppData.query_id, msg_id: msg_id || '', with_webview: !WebAppData.receiver && with_webview ? 1 : 0},
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
$('button').prop('disabled', false);
|
||||
|
@ -173,6 +173,35 @@ function sendMessage(msg_id, with_webview) {
|
|||
}
|
||||
});
|
||||
}
|
||||
function changeButton() {
|
||||
$('button').prop('disabled', true);
|
||||
$('#btn_status').text('Changing button...').removeClass('ok err').show();
|
||||
$.ajax('/demo/changeMenuButton', {
|
||||
type: 'POST',
|
||||
data: {_auth: WebAppDataRaw},
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
$('button').prop('disabled', false);
|
||||
if (result.response) {
|
||||
if (result.response.ok) {
|
||||
$('#btn_status').html('Button changed!').addClass('ok').show();
|
||||
Telegram.WebApp.close();
|
||||
} else {
|
||||
$('#btn_status').text(result.response.description).addClass('err').show();
|
||||
alert(result.response.description);
|
||||
}
|
||||
} else {
|
||||
$('#btn_status').text('Unknown error').addClass('err').show();
|
||||
alert('Unknown error');
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
$('button').prop('disabled', false);
|
||||
$('#btn_status').text('Server error').addClass('err').show();
|
||||
alert('Server error');
|
||||
}
|
||||
});
|
||||
}
|
||||
function byteLength(str) {
|
||||
if (window.Blob) {
|
||||
try { return new Blob([str]).size; } catch (e) {}
|
||||
|
@ -254,7 +283,7 @@ if (WebAppData.query_id && WebAppDataRaw) {
|
|||
$('#webview_data_status').show();
|
||||
$.ajax('/demo/checkData', {
|
||||
type: 'POST',
|
||||
data: {data: WebAppDataRaw},
|
||||
data: {_auth: WebAppDataRaw},
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
if (result.ok) {
|
||||
|
|
Loading…
Reference in a new issue