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
adcefc5b5a
commit
f378811848
7 changed files with 224 additions and 234 deletions
|
@ -1,3 +1,4 @@
|
|||
// WebView
|
||||
(function () {
|
||||
var eventHandlers = {};
|
||||
|
||||
|
@ -8,33 +9,6 @@
|
|||
|
||||
var initParams = urlParseHashParams(locationHash);
|
||||
|
||||
var webAppDataRaw = '', webAppData = {};
|
||||
var themeParams = {}, colorScheme = 'light';
|
||||
|
||||
if (initParams.tgWebAppData && initParams.tgWebAppData.length) {
|
||||
webAppDataRaw = initParams.tgWebAppData;
|
||||
webAppData = urlParseHashParams(webAppDataRaw);
|
||||
delete webAppData._path;
|
||||
for (var key in webAppData) {
|
||||
var val = webAppData[key];
|
||||
try {
|
||||
if (val.substr(0, 1) == '{' && val.substr(-1) == '}' ||
|
||||
val.substr(0, 1) == '[' && val.substr(-1) == ']') {
|
||||
webAppData[key] = JSON.parse(val);
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
if (initParams.tgWebAppThemeParams && initParams.tgWebAppThemeParams.length) {
|
||||
var themeParamsRaw = initParams.tgWebAppThemeParams;
|
||||
try {
|
||||
var theme_params = JSON.parse(themeParamsRaw);
|
||||
setThemeParams(theme_params);
|
||||
} catch (e) {}
|
||||
} else if (webAppData.theme_params) { // legacy
|
||||
setThemeParams(webAppData.theme_params);
|
||||
}
|
||||
|
||||
var isIframe = false;
|
||||
try {
|
||||
isIframe = (window.parent != null && window != window.parent);
|
||||
|
@ -54,32 +28,6 @@
|
|||
}
|
||||
} catch (e) {}
|
||||
|
||||
function onThemeChanged(eventType, eventData) {
|
||||
if (eventData.theme_params) {
|
||||
setThemeParams(eventData.theme_params);
|
||||
window.Telegram.WebApp.MainButton.setParams({
|
||||
force_update: true
|
||||
});
|
||||
receiveWebViewEvent('themeChanged');
|
||||
}
|
||||
}
|
||||
|
||||
var lastWindowHeight = window.innerHeight;
|
||||
function onViewportChanged(eventType, eventData) {
|
||||
if (eventData.height) {
|
||||
window.removeEventListener('resize', onWindowResize);
|
||||
setViewportHeight(eventData);
|
||||
}
|
||||
}
|
||||
function onWindowResize(e) {
|
||||
if (lastWindowHeight != window.innerHeight) {
|
||||
lastWindowHeight = window.innerHeight;
|
||||
receiveWebViewEvent('viewportChanged', {
|
||||
isStateStable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function urlSafeDecode(urlencoded) {
|
||||
try {
|
||||
urlencoded = urlencoded.replace(/\+/g, '%20');
|
||||
|
@ -105,10 +53,22 @@
|
|||
params._path = urlSafeDecode(pathParam);
|
||||
locationHash = locationHash.substr(qIndex + 1);
|
||||
}
|
||||
var locationHashParams = locationHash.split('&');
|
||||
var query_params = urlParseQueryString(locationHash);
|
||||
for (var k in query_params) {
|
||||
params[k] = query_params[k];
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
function urlParseQueryString(queryString) {
|
||||
var params = {};
|
||||
if (!queryString.length) {
|
||||
return params;
|
||||
}
|
||||
var queryStringParams = queryString.split('&');
|
||||
var i, param, paramName, paramValue;
|
||||
for (i = 0; i < locationHashParams.length; i++) {
|
||||
param = locationHashParams[i].split('=');
|
||||
for (i = 0; i < queryStringParams.length; i++) {
|
||||
param = queryStringParams[i].split('=');
|
||||
paramName = urlSafeDecode(param[0]);
|
||||
paramValue = param[1] == null ? null : urlSafeDecode(param[1]);
|
||||
params[paramName] = paramValue;
|
||||
|
@ -218,20 +178,138 @@
|
|||
eventHandlers[eventType].splice(index, 1);
|
||||
};
|
||||
|
||||
function openProtoUrl(url) {
|
||||
if (!url.match(/^(web\+)?tgb?:\/\/./)) {
|
||||
return false;
|
||||
}
|
||||
var useIframe = navigator.userAgent.match(/iOS|iPhone OS|iPhone|iPod|iPad/i) ? true : false;
|
||||
if (useIframe) {
|
||||
var iframeContEl = document.getElementById('tgme_frame_cont') || document.body;
|
||||
var iframeEl = document.createElement('iframe');
|
||||
iframeContEl.appendChild(iframeEl);
|
||||
var pageHidden = false;
|
||||
var enableHidden = function () {
|
||||
pageHidden = true;
|
||||
};
|
||||
window.addEventListener('pagehide', enableHidden, false);
|
||||
window.addEventListener('blur', enableHidden, false);
|
||||
if (iframeEl !== null) {
|
||||
iframeEl.src = url;
|
||||
}
|
||||
setTimeout(function() {
|
||||
if (!pageHidden) {
|
||||
window.location = url;
|
||||
}
|
||||
window.removeEventListener('pagehide', enableHidden, false);
|
||||
window.removeEventListener('blur', enableHidden, false);
|
||||
}, 2000);
|
||||
}
|
||||
else {
|
||||
window.location = url;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!window.Telegram) {
|
||||
window.Telegram = {};
|
||||
}
|
||||
window.Telegram.WebView = {
|
||||
initParams: initParams,
|
||||
onEvent: onEvent,
|
||||
offEvent: offEvent,
|
||||
postEvent: postEvent,
|
||||
receiveEvent: receiveEvent,
|
||||
callEventCallbacks: callEventCallbacks
|
||||
};
|
||||
|
||||
window.Telegram.Utils = {
|
||||
urlSafeDecode: urlSafeDecode,
|
||||
urlParseQueryString: urlParseQueryString,
|
||||
urlParseHashParams: urlParseHashParams,
|
||||
urlAppendHashParams: urlAppendHashParams
|
||||
};
|
||||
|
||||
// For Windows Phone app
|
||||
window.TelegramGameProxy_receiveEvent = receiveEvent;
|
||||
|
||||
// App backward compatibility
|
||||
window.TelegramGameProxy = {
|
||||
receiveEvent: receiveEvent
|
||||
};
|
||||
})();
|
||||
|
||||
// WebApp
|
||||
(function () {
|
||||
var Utils = window.Telegram.Utils;
|
||||
var WebView = window.Telegram.WebView;
|
||||
var initParams = WebView.initParams;
|
||||
|
||||
var WebApp = {};
|
||||
var webAppInitData = '', webAppInitDataUnsafe = {};
|
||||
var themeParams = {}, colorScheme = 'light';
|
||||
|
||||
if (initParams.tgWebAppData && initParams.tgWebAppData.length) {
|
||||
webAppInitData = initParams.tgWebAppData;
|
||||
webAppInitDataUnsafe = Utils.urlParseQueryString(webAppInitData);
|
||||
for (var key in webAppInitDataUnsafe) {
|
||||
var val = webAppInitDataUnsafe[key];
|
||||
try {
|
||||
if (val.substr(0, 1) == '{' && val.substr(-1) == '}' ||
|
||||
val.substr(0, 1) == '[' && val.substr(-1) == ']') {
|
||||
webAppInitDataUnsafe[key] = JSON.parse(val);
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
if (initParams.tgWebAppThemeParams && initParams.tgWebAppThemeParams.length) {
|
||||
var themeParamsRaw = initParams.tgWebAppThemeParams;
|
||||
try {
|
||||
var theme_params = JSON.parse(themeParamsRaw);
|
||||
setThemeParams(theme_params);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function onThemeChanged(eventType, eventData) {
|
||||
if (eventData.theme_params) {
|
||||
setThemeParams(eventData.theme_params);
|
||||
window.Telegram.WebApp.MainButton.setParams({
|
||||
force_update: true
|
||||
});
|
||||
receiveWebViewEvent('themeChanged');
|
||||
}
|
||||
}
|
||||
|
||||
var lastWindowHeight = window.innerHeight;
|
||||
function onViewportChanged(eventType, eventData) {
|
||||
if (eventData.height) {
|
||||
window.removeEventListener('resize', onWindowResize);
|
||||
setViewportHeight(eventData);
|
||||
}
|
||||
}
|
||||
|
||||
function onWindowResize(e) {
|
||||
if (lastWindowHeight != window.innerHeight) {
|
||||
lastWindowHeight = window.innerHeight;
|
||||
receiveWebViewEvent('viewportChanged', {
|
||||
isStateStable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function receiveWebViewEvent(eventType) {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
eventType = args.shift();
|
||||
callEventCallbacks('webview:' + eventType, function(callback) {
|
||||
callback.apply(window.Telegram.WebApp, args);
|
||||
WebView.callEventCallbacks('webview:' + eventType, function(callback) {
|
||||
callback.apply(WebApp, args);
|
||||
});
|
||||
}
|
||||
|
||||
function onWebViewEvent(eventType, callback) {
|
||||
onEvent('webview:' + eventType, callback);
|
||||
WebView.onEvent('webview:' + eventType, callback);
|
||||
};
|
||||
|
||||
function offWebViewEvent(eventType, callback) {
|
||||
offEvent('webview:' + eventType, callback);
|
||||
WebView.offEvent('webview:' + eventType, callback);
|
||||
};
|
||||
|
||||
function setCssProperty(name, value) {
|
||||
|
@ -322,17 +400,6 @@
|
|||
return s;
|
||||
}
|
||||
|
||||
function isParentEl(el, parentEl) {
|
||||
var checkEl = el.parentNode;
|
||||
while (checkEl) {
|
||||
if (checkEl === parentEl) {
|
||||
return true;
|
||||
}
|
||||
checkEl = checkEl.parentNode;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
var mainButtonHeight = 0;
|
||||
var MainButton = (function() {
|
||||
var isVisible = false;
|
||||
|
@ -373,7 +440,7 @@
|
|||
enumerable: true
|
||||
});
|
||||
|
||||
onEvent('main_button_pressed', onMainButtonPressed);
|
||||
WebView.onEvent('main_button_pressed', onMainButtonPressed);
|
||||
|
||||
var debugBtn = null, debugBtnStyle = {};
|
||||
if (initParams.tgWebAppDebug) {
|
||||
|
@ -414,7 +481,7 @@
|
|||
function updateButton() {
|
||||
var color = mainButton.color;
|
||||
var text_color = mainButton.textColor;
|
||||
postEvent('web_app_setup_main_button', false, isVisible ? {
|
||||
WebView.postEvent('web_app_setup_main_button', false, isVisible ? {
|
||||
is_visible: true,
|
||||
is_active: isActive,
|
||||
is_progress_visible: isProgressVisible,
|
||||
|
@ -560,152 +627,77 @@
|
|||
return mainButton;
|
||||
})();
|
||||
|
||||
function openProtoUrl(url) {
|
||||
if (!url.match(/^(web\+)?tgb?:\/\/./)) {
|
||||
return false;
|
||||
}
|
||||
var useIframe = navigator.userAgent.match(/iOS|iPhone OS|iPhone|iPod|iPad/i) ? true : false;
|
||||
if (useIframe) {
|
||||
var iframeContEl = document.getElementById('tgme_frame_cont') || document.body;
|
||||
var iframeEl = document.createElement('iframe');
|
||||
iframeContEl.appendChild(iframeEl);
|
||||
var pageHidden = false;
|
||||
var enableHidden = function () {
|
||||
pageHidden = true;
|
||||
};
|
||||
window.addEventListener('pagehide', enableHidden, false);
|
||||
window.addEventListener('blur', enableHidden, false);
|
||||
if (iframeEl !== null) {
|
||||
iframeEl.src = url;
|
||||
}
|
||||
setTimeout(function() {
|
||||
if (!pageHidden) {
|
||||
window.location = url;
|
||||
}
|
||||
window.removeEventListener('pagehide', enableHidden, false);
|
||||
window.removeEventListener('blur', enableHidden, false);
|
||||
}, 2000);
|
||||
}
|
||||
else {
|
||||
window.location = url;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!window.Telegram) {
|
||||
window.Telegram = {};
|
||||
}
|
||||
window.Telegram.WebView = {
|
||||
initParams: initParams,
|
||||
onEvent: onEvent,
|
||||
offEvent: offEvent,
|
||||
receiveEvent: receiveEvent,
|
||||
};
|
||||
window.Telegram.Games = {
|
||||
shareScore: function() {
|
||||
postEvent('share_score', function (error) {
|
||||
if (error) {
|
||||
var shareScoreUrl = initParams.tgShareScoreUrl;
|
||||
if (shareScoreUrl) {
|
||||
openProtoUrl(shareScoreUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
shareGame: function() {
|
||||
postEvent('share_game');
|
||||
}
|
||||
};
|
||||
window.Telegram.Payments = {
|
||||
submitPaymentForm: function (formData) {
|
||||
if (!formData ||
|
||||
!formData.credentials ||
|
||||
formData.credentials.type !== 'card' ||
|
||||
!formData.credentials.token ||
|
||||
!formData.credentials.token.match(/^[A-Za-z0-9\/=_\-]{4,512}$/) ||
|
||||
!formData.title) {
|
||||
console.error('[Telegram.Payments] Invalid form data submitted', formData);
|
||||
throw Error('PaymentFormDataInvalid');
|
||||
}
|
||||
postEvent('payment_form_submit', false, formData);
|
||||
}
|
||||
};
|
||||
window.Telegram.WebApp = {
|
||||
MainButton: MainButton,
|
||||
onEvent: function(eventType, callback) {
|
||||
onWebViewEvent(eventType, callback);
|
||||
},
|
||||
offEvent: function(eventType, callback) {offWebViewEvent(eventType, callback);
|
||||
},
|
||||
sendData: function (data) {
|
||||
if (!data || !data.length) {
|
||||
console.error('[Telegram.WebApp] Data is required', data);
|
||||
throw Error('WebAppDataInvalid');
|
||||
}
|
||||
if (byteLength(data) > 4096) {
|
||||
console.error('[Telegram.WebApp] Data is too long', data);
|
||||
throw Error('WebAppDataInvalid');
|
||||
}
|
||||
postEvent('web_app_data_send', false, {data: data});
|
||||
},
|
||||
ready: function () {
|
||||
postEvent('web_app_ready');
|
||||
},
|
||||
expand: function () {
|
||||
postEvent('web_app_expand');
|
||||
},
|
||||
close: function () {
|
||||
postEvent('web_app_close');
|
||||
}
|
||||
};
|
||||
Object.defineProperty(window.Telegram.WebApp, 'initData', {
|
||||
get: function(){ return webAppData; },
|
||||
|
||||
Object.defineProperty(WebApp, 'initData', {
|
||||
get: function(){ return webAppInitData; },
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(window.Telegram.WebApp, 'initDataRaw', {
|
||||
get: function(){ return webAppDataRaw; },
|
||||
Object.defineProperty(WebApp, 'initDataUnsafe', {
|
||||
get: function(){ return webAppInitDataUnsafe; },
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(window.Telegram.WebApp, 'colorScheme', {
|
||||
Object.defineProperty(WebApp, 'colorScheme', {
|
||||
get: function(){ return colorScheme; },
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(window.Telegram.WebApp, 'themeParams', {
|
||||
Object.defineProperty(WebApp, 'themeParams', {
|
||||
get: function(){ return themeParams; },
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(window.Telegram.WebApp, 'isExpanded', {
|
||||
Object.defineProperty(WebApp, 'isExpanded', {
|
||||
get: function(){ return isExpanded; },
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(window.Telegram.WebApp, 'viewportHeight', {
|
||||
Object.defineProperty(WebApp, 'viewportHeight', {
|
||||
get: function(){ return (viewportHeight === false ? window.innerHeight : viewportHeight) - mainButtonHeight; },
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(window.Telegram.WebApp, 'viewportStableHeight', {
|
||||
Object.defineProperty(WebApp, 'viewportStableHeight', {
|
||||
get: function(){ return (viewportStableHeight === false ? window.innerHeight : viewportStableHeight) - mainButtonHeight; },
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(WebApp, 'MainButton', {
|
||||
value: MainButton,
|
||||
enumerable: true
|
||||
});
|
||||
WebApp.onEvent = function(eventType, callback) {
|
||||
onWebViewEvent(eventType, callback);
|
||||
};
|
||||
WebApp.offEvent = function(eventType, callback) {offWebViewEvent(eventType, callback);
|
||||
};
|
||||
WebApp.sendData = function (data) {
|
||||
if (!data || !data.length) {
|
||||
console.error('[Telegram.WebApp] Data is required', data);
|
||||
throw Error('WebAppDataInvalid');
|
||||
}
|
||||
if (byteLength(data) > 4096) {
|
||||
console.error('[Telegram.WebApp] Data is too long', data);
|
||||
throw Error('WebAppDataInvalid');
|
||||
}
|
||||
WebView.postEvent('web_app_data_send', false, {data: data});
|
||||
};
|
||||
WebApp.ready = function () {
|
||||
WebView.postEvent('web_app_ready');
|
||||
};
|
||||
WebApp.expand = function () {
|
||||
WebView.postEvent('web_app_expand');
|
||||
};
|
||||
WebApp.close = function () {
|
||||
WebView.postEvent('web_app_close');
|
||||
};
|
||||
|
||||
window.Telegram.WebApp = WebApp;
|
||||
|
||||
setViewportHeight();
|
||||
|
||||
window.addEventListener('resize', onWindowResize);
|
||||
|
||||
onEvent('theme_changed', onThemeChanged);
|
||||
onEvent('viewport_changed', onViewportChanged);
|
||||
postEvent('web_app_request_theme');
|
||||
postEvent('web_app_request_viewport');
|
||||
|
||||
// For Windows Phone app
|
||||
window.TelegramGameProxy_receiveEvent = receiveEvent;
|
||||
|
||||
// Backward compatibility
|
||||
window.TelegramGameProxy = {
|
||||
initParams: initParams,
|
||||
onEvent: onEvent,
|
||||
receiveEvent: receiveEvent,
|
||||
shareScore: window.Telegram.Games.shareScore,
|
||||
paymentFormSubmit: window.Telegram.Payments.submitPaymentForm
|
||||
};
|
||||
WebView.onEvent('theme_changed', onThemeChanged);
|
||||
WebView.onEvent('viewport_changed', onViewportChanged);
|
||||
WebView.postEvent('web_app_request_theme');
|
||||
WebView.postEvent('web_app_request_viewport');
|
||||
|
||||
})();
|
|
@ -198,7 +198,7 @@
|
|||
</div><div class="tr-section-col col-lg-4 col-xs-6">
|
||||
<div class="tr-section-wrap"><a href="/en/android/groups_and_channels/" class="tr-section">
|
||||
<div class="tr-section-cover cover8"></div>
|
||||
<div class="tr-section-caption">Groups And Channels (1045)</div>
|
||||
<div class="tr-section-caption">Groups And Channels (1046)</div>
|
||||
</a></div>
|
||||
</div><div class="tr-section-col col-lg-4 col-xs-6">
|
||||
<div class="tr-section-wrap"><a href="/en/android/profile/" class="tr-section">
|
||||
|
@ -233,7 +233,7 @@
|
|||
</div><div class="tr-section-col col-lg-4 col-xs-6">
|
||||
<div class="tr-section-wrap"><a href="/en/android/unsorted/" class="tr-section">
|
||||
<div class="tr-section-cover cover0"></div>
|
||||
<div class="tr-section-caption">Unsorted (632)</div>
|
||||
<div class="tr-section-caption">Unsorted (631)</div>
|
||||
</a></div>
|
||||
</div>
|
||||
</section></section>
|
||||
|
|
|
@ -13507,6 +13507,19 @@
|
|||
<div class="tr-value-suggestions">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="tr-key-row-wrap">
|
||||
<div class="tr-key-row" data-href="/en/android/groups_and_channels/ChannelCantOpenBannedByAdmin" data-langpack="android" data-section="groups_and_channels" data-key="ChannelCantOpenBannedByAdmin">
|
||||
<div class="tr-value-media"><a class="tr-value-photo bg-image key-layer" style="background-image:url('https://telegra.ph/file/p/f13ab9728fd/c634fc5cec3c7eb620da817.jpg?c=38,254,500,500,280,280');" href="/screenshots/10991/phrase/ChannelCantOpenBannedByAdmin" data-layer><div class="screenshot-key" style="padding:78px 12px 41px 8px;"><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/groups_and_channels/ChannelCantOpenBannedByAdmin"><span class="p-value"><span class="value">Sorry, you can't access this chat because you were banned by an admin.</span></span></a></div>
|
||||
<div class="tr-value-key">ChannelCantOpenBannedByAdmin</div>
|
||||
<div class="tr-value-suggestions">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2700,19 +2700,6 @@
|
|||
<div class="tr-value-suggestions">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="tr-key-row-wrap">
|
||||
<div class="tr-key-row" data-href="/en/android/unsorted/ChannelCantOpenBannedByAdmin" data-langpack="android" data-section="unsorted" data-key="ChannelCantOpenBannedByAdmin">
|
||||
<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/android/unsorted/ChannelCantOpenBannedByAdmin"><span class="p-value"><span class="value">Sorry, you can't access this chat because you were banned by an admin.</span></span></a></div>
|
||||
<div class="tr-value-key">ChannelCantOpenBannedByAdmin</div>
|
||||
<div class="tr-value-suggestions">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -5199,8 +5186,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/android/unsorted/FilterRemoveExclusionTitle" data-langpack="android" data-section="unsorted" data-key="FilterRemoveExclusionTitle">
|
||||
<div class="tr-value-media"><div class="tr-value-photo"></div></div>
|
||||
<div class="tr-value-body">
|
||||
|
@ -5213,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/android/unsorted/FilterAvailableTitle" data-langpack="android" data-section="unsorted" data-key="FilterAvailableTitle">
|
||||
<div class="tr-value-media"><div class="tr-value-photo"></div></div>
|
||||
<div class="tr-value-body">
|
||||
|
@ -7800,8 +7787,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/android/unsorted/MasksCount" data-langpack="android" data-section="unsorted" data-key="MasksCount">
|
||||
<div class="tr-value-media"><div class="tr-value-photo"></div></div>
|
||||
<div class="tr-value-body">
|
||||
|
@ -7814,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/android/unsorted/Videos" data-langpack="android" data-section="unsorted" data-key="Videos">
|
||||
<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-webview.js?14"></script>
|
||||
<script src="https://tg.dev/js/telegram-web-app.js?1"></script>
|
||||
<script>
|
||||
function setThemeClass() {
|
||||
document.documentElement.className = Telegram.WebApp.colorScheme;
|
||||
|
@ -441,7 +441,7 @@
|
|||
</div>
|
||||
<script src="https://tg.dev/js/jquery.min.js"></script>
|
||||
<script src="https://tg.dev/js/tgsticker.js?27"></script>
|
||||
<script src="/js/cafe.js?16"></script>
|
||||
<script src="/js/cafe.js?17"></script>
|
||||
<script>Cafe.init({"apiUrl":"\/cafe\/api","userId":0,"userHash":null});</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -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-webview.js?14"></script>
|
||||
<script src="https://telegram.org/js/telegram-web-app.js?1"></script>
|
||||
<script>
|
||||
function setThemeClass() {
|
||||
document.documentElement.className = Telegram.WebApp.colorScheme;
|
||||
|
@ -190,11 +190,11 @@
|
|||
<script>
|
||||
Telegram.WebApp.ready();
|
||||
|
||||
var WebAppData = Telegram.WebApp.initData || {};
|
||||
var WebAppDataRaw = Telegram.WebApp.initDataRaw || '';
|
||||
var initData = Telegram.WebApp.initData || '';
|
||||
var initDataUnsafe = Telegram.WebApp.initDataUnsafe || {};
|
||||
|
||||
function sendMessage(msg_id, with_webview) {
|
||||
if (!WebAppData.query_id) {
|
||||
if (!initDataUnsafe.query_id) {
|
||||
alert('WebViewQueryId not defined');
|
||||
return;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ function sendMessage(msg_id, with_webview) {
|
|||
$('#btn_status').text('Sending...').removeClass('ok err').show();
|
||||
$.ajax('/demo/sendMessage', {
|
||||
type: 'POST',
|
||||
data: {_auth: WebAppDataRaw, query_id: WebAppData.query_id, msg_id: msg_id || '', with_webview: !WebAppData.receiver && with_webview ? 1 : 0},
|
||||
data: {_auth: initData, msg_id: msg_id || '', with_webview: !initDataUnsafe.receiver && with_webview ? 1 : 0},
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
$('button').prop('disabled', false);
|
||||
|
@ -230,7 +230,7 @@ function changeButton() {
|
|||
$('#btn_status').text('Changing button...').removeClass('ok err').show();
|
||||
$.ajax('/demo/changeMenuButton', {
|
||||
type: 'POST',
|
||||
data: {_auth: WebAppDataRaw},
|
||||
data: {_auth: initData},
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
$('button').prop('disabled', false);
|
||||
|
@ -331,18 +331,18 @@ Telegram.WebApp.onEvent('themeChanged', function() {
|
|||
$('#theme_data').html(JSON.stringify(Telegram.WebApp.themeParams, null, 2));
|
||||
});
|
||||
|
||||
$('#main_btn').toggle(!!WebAppData.query_id);
|
||||
$('#with_webview_btn').toggle(!!WebAppData.query_id && !WebAppData.receiver);
|
||||
// $('#data_btn').toggle(!WebAppData.query_id || !WebAppData.receiver);
|
||||
$('#webview_data').html(JSON.stringify(WebAppData, null, 2));
|
||||
$('#main_btn').toggle(!!initDataUnsafe.query_id);
|
||||
$('#with_webview_btn').toggle(!!initDataUnsafe.query_id && !initDataUnsafe.receiver);
|
||||
// $('#data_btn').toggle(!initDataUnsafe.query_id || !initDataUnsafe.receiver);
|
||||
$('#webview_data').html(JSON.stringify(initDataUnsafe, null, 2));
|
||||
$('#theme_data').html(JSON.stringify(Telegram.WebApp.themeParams, null, 2));
|
||||
$('#regular_link').attr('href', $('#regular_link').attr('href') + location.hash);
|
||||
$('#text_field').focus();
|
||||
if (WebAppData.query_id && WebAppDataRaw) {
|
||||
if (initDataUnsafe.query_id && initData) {
|
||||
$('#webview_data_status').show();
|
||||
$.ajax('/demo/checkData', {
|
||||
type: 'POST',
|
||||
data: {_auth: WebAppDataRaw},
|
||||
data: {_auth: initData},
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
if (result.ok) {
|
||||
|
|
|
@ -15,9 +15,9 @@ var Cafe = {
|
|||
Cafe.userId = options.userId;
|
||||
Cafe.userHash = options.userHash;
|
||||
Cafe.initLotties();
|
||||
var userId = Telegram.WebApp.initData && Telegram.WebApp.initData.user && Telegram.WebApp.initData.user.id || Cafe.userId;
|
||||
$('body').show();
|
||||
if (!userId) {
|
||||
if (!Telegram.WebApp.initDataUnsafe ||
|
||||
!Telegram.WebApp.initDataUnsafe.query_id) {
|
||||
Cafe.isClosed = true;
|
||||
$('body').addClass('closed');
|
||||
Cafe.showStatus('Cafe is temporarily closed');
|
||||
|
@ -255,9 +255,7 @@ var Cafe = {
|
|||
order_data: Cafe.getOrderData(),
|
||||
comment: comment
|
||||
};
|
||||
if (!Telegram.WebApp.initData ||
|
||||
!Telegram.WebApp.initData.user ||
|
||||
!Telegram.WebApp.initData.user.id) {
|
||||
if (Cafe.userId && Cafe.userHash) {
|
||||
params.user_id = Cafe.userId;
|
||||
params.user_hash = Cafe.userHash;
|
||||
}
|
||||
|
@ -290,7 +288,7 @@ var Cafe = {
|
|||
$('.js-status').removeClass('shown');
|
||||
},
|
||||
apiRequest: function(method, data, onCallback) {
|
||||
var authData = Telegram.WebApp.initDataRaw || '';
|
||||
var authData = Telegram.WebApp.initData || '';
|
||||
$.ajax(Cafe.apiUrl, {
|
||||
type: 'POST',
|
||||
data: $.extend(data, {_auth: authData, method: method}),
|
||||
|
|
Loading…
Reference in a new issue