mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-12-28 07:20:31 +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 () {
|
(function () {
|
||||||
var eventHandlers = {};
|
var eventHandlers = {};
|
||||||
|
|
||||||
|
@ -8,33 +9,6 @@
|
||||||
|
|
||||||
var initParams = urlParseHashParams(locationHash);
|
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;
|
var isIframe = false;
|
||||||
try {
|
try {
|
||||||
isIframe = (window.parent != null && window != window.parent);
|
isIframe = (window.parent != null && window != window.parent);
|
||||||
|
@ -54,32 +28,6 @@
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} 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) {
|
function urlSafeDecode(urlencoded) {
|
||||||
try {
|
try {
|
||||||
urlencoded = urlencoded.replace(/\+/g, '%20');
|
urlencoded = urlencoded.replace(/\+/g, '%20');
|
||||||
|
@ -105,10 +53,22 @@
|
||||||
params._path = urlSafeDecode(pathParam);
|
params._path = urlSafeDecode(pathParam);
|
||||||
locationHash = locationHash.substr(qIndex + 1);
|
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;
|
var i, param, paramName, paramValue;
|
||||||
for (i = 0; i < locationHashParams.length; i++) {
|
for (i = 0; i < queryStringParams.length; i++) {
|
||||||
param = locationHashParams[i].split('=');
|
param = queryStringParams[i].split('=');
|
||||||
paramName = urlSafeDecode(param[0]);
|
paramName = urlSafeDecode(param[0]);
|
||||||
paramValue = param[1] == null ? null : urlSafeDecode(param[1]);
|
paramValue = param[1] == null ? null : urlSafeDecode(param[1]);
|
||||||
params[paramName] = paramValue;
|
params[paramName] = paramValue;
|
||||||
|
@ -218,20 +178,138 @@
|
||||||
eventHandlers[eventType].splice(index, 1);
|
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) {
|
function receiveWebViewEvent(eventType) {
|
||||||
var args = Array.prototype.slice.call(arguments);
|
var args = Array.prototype.slice.call(arguments);
|
||||||
eventType = args.shift();
|
eventType = args.shift();
|
||||||
callEventCallbacks('webview:' + eventType, function(callback) {
|
WebView.callEventCallbacks('webview:' + eventType, function(callback) {
|
||||||
callback.apply(window.Telegram.WebApp, args);
|
callback.apply(WebApp, args);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onWebViewEvent(eventType, callback) {
|
function onWebViewEvent(eventType, callback) {
|
||||||
onEvent('webview:' + eventType, callback);
|
WebView.onEvent('webview:' + eventType, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
function offWebViewEvent(eventType, callback) {
|
function offWebViewEvent(eventType, callback) {
|
||||||
offEvent('webview:' + eventType, callback);
|
WebView.offEvent('webview:' + eventType, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
function setCssProperty(name, value) {
|
function setCssProperty(name, value) {
|
||||||
|
@ -322,17 +400,6 @@
|
||||||
return s;
|
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 mainButtonHeight = 0;
|
||||||
var MainButton = (function() {
|
var MainButton = (function() {
|
||||||
var isVisible = false;
|
var isVisible = false;
|
||||||
|
@ -373,7 +440,7 @@
|
||||||
enumerable: true
|
enumerable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
onEvent('main_button_pressed', onMainButtonPressed);
|
WebView.onEvent('main_button_pressed', onMainButtonPressed);
|
||||||
|
|
||||||
var debugBtn = null, debugBtnStyle = {};
|
var debugBtn = null, debugBtnStyle = {};
|
||||||
if (initParams.tgWebAppDebug) {
|
if (initParams.tgWebAppDebug) {
|
||||||
|
@ -414,7 +481,7 @@
|
||||||
function updateButton() {
|
function updateButton() {
|
||||||
var color = mainButton.color;
|
var color = mainButton.color;
|
||||||
var text_color = mainButton.textColor;
|
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_visible: true,
|
||||||
is_active: isActive,
|
is_active: isActive,
|
||||||
is_progress_visible: isProgressVisible,
|
is_progress_visible: isProgressVisible,
|
||||||
|
@ -560,84 +627,48 @@
|
||||||
return mainButton;
|
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) {
|
if (!window.Telegram) {
|
||||||
window.Telegram = {};
|
window.Telegram = {};
|
||||||
}
|
}
|
||||||
window.Telegram.WebView = {
|
|
||||||
initParams: initParams,
|
Object.defineProperty(WebApp, 'initData', {
|
||||||
onEvent: onEvent,
|
get: function(){ return webAppInitData; },
|
||||||
offEvent: offEvent,
|
enumerable: true
|
||||||
receiveEvent: receiveEvent,
|
|
||||||
};
|
|
||||||
window.Telegram.Games = {
|
|
||||||
shareScore: function() {
|
|
||||||
postEvent('share_score', function (error) {
|
|
||||||
if (error) {
|
|
||||||
var shareScoreUrl = initParams.tgShareScoreUrl;
|
|
||||||
if (shareScoreUrl) {
|
|
||||||
openProtoUrl(shareScoreUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
Object.defineProperty(WebApp, 'initDataUnsafe', {
|
||||||
shareGame: function() {
|
get: function(){ return webAppInitDataUnsafe; },
|
||||||
postEvent('share_game');
|
enumerable: true
|
||||||
}
|
});
|
||||||
};
|
Object.defineProperty(WebApp, 'colorScheme', {
|
||||||
window.Telegram.Payments = {
|
get: function(){ return colorScheme; },
|
||||||
submitPaymentForm: function (formData) {
|
enumerable: true
|
||||||
if (!formData ||
|
});
|
||||||
!formData.credentials ||
|
Object.defineProperty(WebApp, 'themeParams', {
|
||||||
formData.credentials.type !== 'card' ||
|
get: function(){ return themeParams; },
|
||||||
!formData.credentials.token ||
|
enumerable: true
|
||||||
!formData.credentials.token.match(/^[A-Za-z0-9\/=_\-]{4,512}$/) ||
|
});
|
||||||
!formData.title) {
|
Object.defineProperty(WebApp, 'isExpanded', {
|
||||||
console.error('[Telegram.Payments] Invalid form data submitted', formData);
|
get: function(){ return isExpanded; },
|
||||||
throw Error('PaymentFormDataInvalid');
|
enumerable: true
|
||||||
}
|
});
|
||||||
postEvent('payment_form_submit', false, formData);
|
Object.defineProperty(WebApp, 'viewportHeight', {
|
||||||
}
|
get: function(){ return (viewportHeight === false ? window.innerHeight : viewportHeight) - mainButtonHeight; },
|
||||||
};
|
enumerable: true
|
||||||
window.Telegram.WebApp = {
|
});
|
||||||
MainButton: MainButton,
|
Object.defineProperty(WebApp, 'viewportStableHeight', {
|
||||||
onEvent: function(eventType, callback) {
|
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);
|
onWebViewEvent(eventType, callback);
|
||||||
},
|
};
|
||||||
offEvent: function(eventType, callback) {offWebViewEvent(eventType, callback);
|
WebApp.offEvent = function(eventType, callback) {offWebViewEvent(eventType, callback);
|
||||||
},
|
};
|
||||||
sendData: function (data) {
|
WebApp.sendData = function (data) {
|
||||||
if (!data || !data.length) {
|
if (!data || !data.length) {
|
||||||
console.error('[Telegram.WebApp] Data is required', data);
|
console.error('[Telegram.WebApp] Data is required', data);
|
||||||
throw Error('WebAppDataInvalid');
|
throw Error('WebAppDataInvalid');
|
||||||
|
@ -646,66 +677,27 @@
|
||||||
console.error('[Telegram.WebApp] Data is too long', data);
|
console.error('[Telegram.WebApp] Data is too long', data);
|
||||||
throw Error('WebAppDataInvalid');
|
throw Error('WebAppDataInvalid');
|
||||||
}
|
}
|
||||||
postEvent('web_app_data_send', false, {data: data});
|
WebView.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', {
|
WebApp.ready = function () {
|
||||||
get: function(){ return webAppData; },
|
WebView.postEvent('web_app_ready');
|
||||||
enumerable: true
|
};
|
||||||
});
|
WebApp.expand = function () {
|
||||||
Object.defineProperty(window.Telegram.WebApp, 'initDataRaw', {
|
WebView.postEvent('web_app_expand');
|
||||||
get: function(){ return webAppDataRaw; },
|
};
|
||||||
enumerable: true
|
WebApp.close = function () {
|
||||||
});
|
WebView.postEvent('web_app_close');
|
||||||
Object.defineProperty(window.Telegram.WebApp, 'colorScheme', {
|
};
|
||||||
get: function(){ return colorScheme; },
|
|
||||||
enumerable: true
|
window.Telegram.WebApp = WebApp;
|
||||||
});
|
|
||||||
Object.defineProperty(window.Telegram.WebApp, 'themeParams', {
|
|
||||||
get: function(){ return themeParams; },
|
|
||||||
enumerable: true
|
|
||||||
});
|
|
||||||
Object.defineProperty(window.Telegram.WebApp, 'isExpanded', {
|
|
||||||
get: function(){ return isExpanded; },
|
|
||||||
enumerable: true
|
|
||||||
});
|
|
||||||
Object.defineProperty(window.Telegram.WebApp, 'viewportHeight', {
|
|
||||||
get: function(){ return (viewportHeight === false ? window.innerHeight : viewportHeight) - mainButtonHeight; },
|
|
||||||
enumerable: true
|
|
||||||
});
|
|
||||||
Object.defineProperty(window.Telegram.WebApp, 'viewportStableHeight', {
|
|
||||||
get: function(){ return (viewportStableHeight === false ? window.innerHeight : viewportStableHeight) - mainButtonHeight; },
|
|
||||||
enumerable: true
|
|
||||||
});
|
|
||||||
|
|
||||||
setViewportHeight();
|
setViewportHeight();
|
||||||
|
|
||||||
window.addEventListener('resize', onWindowResize);
|
window.addEventListener('resize', onWindowResize);
|
||||||
|
|
||||||
onEvent('theme_changed', onThemeChanged);
|
WebView.onEvent('theme_changed', onThemeChanged);
|
||||||
onEvent('viewport_changed', onViewportChanged);
|
WebView.onEvent('viewport_changed', onViewportChanged);
|
||||||
postEvent('web_app_request_theme');
|
WebView.postEvent('web_app_request_theme');
|
||||||
postEvent('web_app_request_viewport');
|
WebView.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
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
})();
|
|
@ -198,7 +198,7 @@
|
||||||
</div><div class="tr-section-col col-lg-4 col-xs-6">
|
</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-wrap"><a href="/en/android/groups_and_channels/" class="tr-section">
|
||||||
<div class="tr-section-cover cover8"></div>
|
<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>
|
</a></div>
|
||||||
</div><div class="tr-section-col col-lg-4 col-xs-6">
|
</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">
|
<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><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-wrap"><a href="/en/android/unsorted/" class="tr-section">
|
||||||
<div class="tr-section-cover cover0"></div>
|
<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>
|
</a></div>
|
||||||
</div>
|
</div>
|
||||||
</section></section>
|
</section></section>
|
||||||
|
|
|
@ -13507,6 +13507,19 @@
|
||||||
<div class="tr-value-suggestions">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2700,19 +2700,6 @@
|
||||||
<div class="tr-value-suggestions">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5199,8 +5186,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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><div class="tr-key-row-wrap">
|
||||||
<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-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-media"><div class="tr-value-photo"></div></div>
|
||||||
<div class="tr-value-body">
|
<div class="tr-value-body">
|
||||||
|
@ -5213,7 +5199,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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-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-media"><div class="tr-value-photo"></div></div>
|
||||||
<div class="tr-value-body">
|
<div class="tr-value-body">
|
||||||
|
@ -7800,8 +7787,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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><div class="tr-key-row-wrap">
|
||||||
<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-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-media"><div class="tr-value-photo"></div></div>
|
||||||
<div class="tr-value-body">
|
<div class="tr-value-body">
|
||||||
|
@ -7814,7 +7800,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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-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-media"><div class="tr-value-photo"></div></div>
|
||||||
<div class="tr-value-body">
|
<div class="tr-value-body">
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<meta name="MobileOptimized" content="176" />
|
<meta name="MobileOptimized" content="176" />
|
||||||
<meta name="HandheldFriendly" content="True" />
|
<meta name="HandheldFriendly" content="True" />
|
||||||
<meta name="robots" content="noindex, nofollow" />
|
<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>
|
<script>
|
||||||
function setThemeClass() {
|
function setThemeClass() {
|
||||||
document.documentElement.className = Telegram.WebApp.colorScheme;
|
document.documentElement.className = Telegram.WebApp.colorScheme;
|
||||||
|
@ -441,7 +441,7 @@
|
||||||
</div>
|
</div>
|
||||||
<script src="https://tg.dev/js/jquery.min.js"></script>
|
<script src="https://tg.dev/js/jquery.min.js"></script>
|
||||||
<script src="https://tg.dev/js/tgsticker.js?27"></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>
|
<script>Cafe.init({"apiUrl":"\/cafe\/api","userId":0,"userHash":null});</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<meta name="MobileOptimized" content="176" />
|
<meta name="MobileOptimized" content="176" />
|
||||||
<meta name="HandheldFriendly" content="True" />
|
<meta name="HandheldFriendly" content="True" />
|
||||||
<meta name="robots" content="noindex,nofollow" />
|
<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>
|
<script>
|
||||||
function setThemeClass() {
|
function setThemeClass() {
|
||||||
document.documentElement.className = Telegram.WebApp.colorScheme;
|
document.documentElement.className = Telegram.WebApp.colorScheme;
|
||||||
|
@ -190,11 +190,11 @@
|
||||||
<script>
|
<script>
|
||||||
Telegram.WebApp.ready();
|
Telegram.WebApp.ready();
|
||||||
|
|
||||||
var WebAppData = Telegram.WebApp.initData || {};
|
var initData = Telegram.WebApp.initData || '';
|
||||||
var WebAppDataRaw = Telegram.WebApp.initDataRaw || '';
|
var initDataUnsafe = Telegram.WebApp.initDataUnsafe || {};
|
||||||
|
|
||||||
function sendMessage(msg_id, with_webview) {
|
function sendMessage(msg_id, with_webview) {
|
||||||
if (!WebAppData.query_id) {
|
if (!initDataUnsafe.query_id) {
|
||||||
alert('WebViewQueryId not defined');
|
alert('WebViewQueryId not defined');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ function sendMessage(msg_id, with_webview) {
|
||||||
$('#btn_status').text('Sending...').removeClass('ok err').show();
|
$('#btn_status').text('Sending...').removeClass('ok err').show();
|
||||||
$.ajax('/demo/sendMessage', {
|
$.ajax('/demo/sendMessage', {
|
||||||
type: 'POST',
|
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',
|
dataType: 'json',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
$('button').prop('disabled', false);
|
$('button').prop('disabled', false);
|
||||||
|
@ -230,7 +230,7 @@ function changeButton() {
|
||||||
$('#btn_status').text('Changing button...').removeClass('ok err').show();
|
$('#btn_status').text('Changing button...').removeClass('ok err').show();
|
||||||
$.ajax('/demo/changeMenuButton', {
|
$.ajax('/demo/changeMenuButton', {
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: {_auth: WebAppDataRaw},
|
data: {_auth: initData},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
$('button').prop('disabled', false);
|
$('button').prop('disabled', false);
|
||||||
|
@ -331,18 +331,18 @@ Telegram.WebApp.onEvent('themeChanged', function() {
|
||||||
$('#theme_data').html(JSON.stringify(Telegram.WebApp.themeParams, null, 2));
|
$('#theme_data').html(JSON.stringify(Telegram.WebApp.themeParams, null, 2));
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#main_btn').toggle(!!WebAppData.query_id);
|
$('#main_btn').toggle(!!initDataUnsafe.query_id);
|
||||||
$('#with_webview_btn').toggle(!!WebAppData.query_id && !WebAppData.receiver);
|
$('#with_webview_btn').toggle(!!initDataUnsafe.query_id && !initDataUnsafe.receiver);
|
||||||
// $('#data_btn').toggle(!WebAppData.query_id || !WebAppData.receiver);
|
// $('#data_btn').toggle(!initDataUnsafe.query_id || !initDataUnsafe.receiver);
|
||||||
$('#webview_data').html(JSON.stringify(WebAppData, null, 2));
|
$('#webview_data').html(JSON.stringify(initDataUnsafe, null, 2));
|
||||||
$('#theme_data').html(JSON.stringify(Telegram.WebApp.themeParams, null, 2));
|
$('#theme_data').html(JSON.stringify(Telegram.WebApp.themeParams, null, 2));
|
||||||
$('#regular_link').attr('href', $('#regular_link').attr('href') + location.hash);
|
$('#regular_link').attr('href', $('#regular_link').attr('href') + location.hash);
|
||||||
$('#text_field').focus();
|
$('#text_field').focus();
|
||||||
if (WebAppData.query_id && WebAppDataRaw) {
|
if (initDataUnsafe.query_id && initData) {
|
||||||
$('#webview_data_status').show();
|
$('#webview_data_status').show();
|
||||||
$.ajax('/demo/checkData', {
|
$.ajax('/demo/checkData', {
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: {_auth: WebAppDataRaw},
|
data: {_auth: initData},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.ok) {
|
if (result.ok) {
|
||||||
|
|
|
@ -15,9 +15,9 @@ var Cafe = {
|
||||||
Cafe.userId = options.userId;
|
Cafe.userId = options.userId;
|
||||||
Cafe.userHash = options.userHash;
|
Cafe.userHash = options.userHash;
|
||||||
Cafe.initLotties();
|
Cafe.initLotties();
|
||||||
var userId = Telegram.WebApp.initData && Telegram.WebApp.initData.user && Telegram.WebApp.initData.user.id || Cafe.userId;
|
|
||||||
$('body').show();
|
$('body').show();
|
||||||
if (!userId) {
|
if (!Telegram.WebApp.initDataUnsafe ||
|
||||||
|
!Telegram.WebApp.initDataUnsafe.query_id) {
|
||||||
Cafe.isClosed = true;
|
Cafe.isClosed = true;
|
||||||
$('body').addClass('closed');
|
$('body').addClass('closed');
|
||||||
Cafe.showStatus('Cafe is temporarily closed');
|
Cafe.showStatus('Cafe is temporarily closed');
|
||||||
|
@ -255,9 +255,7 @@ var Cafe = {
|
||||||
order_data: Cafe.getOrderData(),
|
order_data: Cafe.getOrderData(),
|
||||||
comment: comment
|
comment: comment
|
||||||
};
|
};
|
||||||
if (!Telegram.WebApp.initData ||
|
if (Cafe.userId && Cafe.userHash) {
|
||||||
!Telegram.WebApp.initData.user ||
|
|
||||||
!Telegram.WebApp.initData.user.id) {
|
|
||||||
params.user_id = Cafe.userId;
|
params.user_id = Cafe.userId;
|
||||||
params.user_hash = Cafe.userHash;
|
params.user_hash = Cafe.userHash;
|
||||||
}
|
}
|
||||||
|
@ -290,7 +288,7 @@ var Cafe = {
|
||||||
$('.js-status').removeClass('shown');
|
$('.js-status').removeClass('shown');
|
||||||
},
|
},
|
||||||
apiRequest: function(method, data, onCallback) {
|
apiRequest: function(method, data, onCallback) {
|
||||||
var authData = Telegram.WebApp.initDataRaw || '';
|
var authData = Telegram.WebApp.initData || '';
|
||||||
$.ajax(Cafe.apiUrl, {
|
$.ajax(Cafe.apiUrl, {
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: $.extend(data, {_auth: authData, method: method}),
|
data: $.extend(data, {_auth: authData, method: method}),
|
||||||
|
|
Loading…
Reference in a new issue