Update content of files

This commit is contained in:
GitHub Action 2022-10-09 01:45:33 +00:00
parent d3da452177
commit b11135e1fc
13 changed files with 34 additions and 29 deletions

View file

@ -220,7 +220,7 @@
<script src="/js/bootstrap.min.js?1"></script>
<script src="/js/core-widgets.js?1"></script>
<script>DiscussionWidget.init({"default_link":"https:\/\/t.me\/contest\/198","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?20"});
<script>DiscussionWidget.init({"default_link":"https:\/\/t.me\/contest\/198","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?21"});
backToTopInit("Go up");
removePreloadInit();
</script>

View file

@ -320,7 +320,7 @@ function updateWidget(widget_update, init) {
attrs += ' data-radius="' + escapeHTML(radius_value) + '"';
}
if (widget_update) {
var code = '<script async src="https://telegram.org/js/telegram-widget.js?20" data-telegram-login="samplebot" data-size="' + escapeHTML(size) + '"' + (!userpic ? ' data-userpic="false"' : '') + ' data-onauth="onTelegramAuth(user)"' + attrs + (form.request_write.checked ? ' data-request-access="write"' : '') + '><\/script>';
var code = '<script async src="https://telegram.org/js/telegram-widget.js?21" data-telegram-login="samplebot" data-size="' + escapeHTML(size) + '"' + (!userpic ? ' data-userpic="false"' : '') + ' data-onauth="onTelegramAuth(user)"' + attrs + (form.request_write.checked ? ' data-request-access="write"' : '') + '><\/script>';
$('#widget_container').html(code);
}
var post_link = $('#post_link').val() || 'https://t.me/telegram/83',
@ -333,7 +333,7 @@ function updateWidget(widget_update, init) {
attrs += ' data-onauth="onTelegramAuth(user)"';
html += "\n<script type=\"text/javascript\">\n function onTelegramAuth(user) {\n alert('Logged in as ' + user.first_name + ' ' + user.last_name + ' (' + user.id + (user.username ? ', @' + user.username : '') + ')');\n }\n<\/script>";
}
var code = '<script async src="https://telegram.org/js/telegram-widget.js?20" data-telegram-login="' + escapeHTML(bot_username || 'samplebot') + '" data-size="' + escapeHTML(size) + '"' + (!userpic ? ' data-userpic="false"' : '') + attrs + (form.request_write.checked ? ' data-request-access="write"' : '') + '><\/script>' + html;
var code = '<script async src="https://telegram.org/js/telegram-widget.js?21" data-telegram-login="' + escapeHTML(bot_username || 'samplebot') + '" data-size="' + escapeHTML(size) + '"' + (!userpic ? ' data-userpic="false"' : '') + attrs + (form.request_write.checked ? ' data-request-access="write"' : '') + '><\/script>' + html;
$('#embed_code').val(code);
$('#embed_code').height(0);
$('#embed_code').height($('#embed_code').get(0).scrollHeight);

View file

@ -234,7 +234,7 @@
<script src="/js/bootstrap.min.js?1"></script>
<script src="/js/core-widgets.js?1"></script>
<script>PostWidget.init({"default_link":"https:\/\/t.me\/telegram\/83","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?20"});
<script>PostWidget.init({"default_link":"https:\/\/t.me\/telegram\/83","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?21"});
backToTopInit("Go up");
removePreloadInit();
</script>

View file

@ -234,7 +234,7 @@ function telegramForwardButton($url, $text = &#39;&#39;) {
var button_size = form.button_size.value;
var button_text = form.button_text.value;
tfi.removeClass('is-invalid');
var code = '<script async src="https://telegram.org/js/telegram-widget.js?20" data-telegram-share-url="' + escapeHTML(share_url) + '"' + (share_comment ? ' data-comment="' + escapeHTML(share_comment) + '"' : '') + (button_size ? ' data-size="' + escapeHTML(button_size) + '"' : '') + (button_text ? ' data-text="' + escapeHTML(button_text) + '"' : '') + '><\/script>';
var code = '<script async src="https://telegram.org/js/telegram-widget.js?21" data-telegram-share-url="' + escapeHTML(share_url) + '"' + (share_comment ? ' data-comment="' + escapeHTML(share_comment) + '"' : '') + (button_size ? ' data-size="' + escapeHTML(button_size) + '"' : '') + (button_text ? ' data-text="' + escapeHTML(button_text) + '"' : '') + '><\/script>';
$('#embed_code').val(code);
$('#embed_code').height(0);
$('#embed_code').height($('#embed_code').get(0).scrollHeight);

View file

@ -220,7 +220,7 @@
<script src="/js/bootstrap.min.js?1"></script>
<script src="/js/core-widgets.js?1"></script>
<script>DiscussionWidget.init({"default_link":"https:\/\/t.me\/contest\/198","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?20"});
<script>DiscussionWidget.init({"default_link":"https:\/\/t.me\/contest\/198","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?21"});
backToTopInit("Go up");
removePreloadInit();
</script>

View file

@ -320,7 +320,7 @@ function updateWidget(widget_update, init) {
attrs += ' data-radius="' + escapeHTML(radius_value) + '"';
}
if (widget_update) {
var code = '<script async src="https://telegram.org/js/telegram-widget.js?20" data-telegram-login="samplebot" data-size="' + escapeHTML(size) + '"' + (!userpic ? ' data-userpic="false"' : '') + ' data-onauth="onTelegramAuth(user)"' + attrs + (form.request_write.checked ? ' data-request-access="write"' : '') + '><\/script>';
var code = '<script async src="https://telegram.org/js/telegram-widget.js?21" data-telegram-login="samplebot" data-size="' + escapeHTML(size) + '"' + (!userpic ? ' data-userpic="false"' : '') + ' data-onauth="onTelegramAuth(user)"' + attrs + (form.request_write.checked ? ' data-request-access="write"' : '') + '><\/script>';
$('#widget_container').html(code);
}
var post_link = $('#post_link').val() || 'https://t.me/telegram/83',
@ -333,7 +333,7 @@ function updateWidget(widget_update, init) {
attrs += ' data-onauth="onTelegramAuth(user)"';
html += "\n<script type=\"text/javascript\">\n function onTelegramAuth(user) {\n alert('Logged in as ' + user.first_name + ' ' + user.last_name + ' (' + user.id + (user.username ? ', @' + user.username : '') + ')');\n }\n<\/script>";
}
var code = '<script async src="https://telegram.org/js/telegram-widget.js?20" data-telegram-login="' + escapeHTML(bot_username || 'samplebot') + '" data-size="' + escapeHTML(size) + '"' + (!userpic ? ' data-userpic="false"' : '') + attrs + (form.request_write.checked ? ' data-request-access="write"' : '') + '><\/script>' + html;
var code = '<script async src="https://telegram.org/js/telegram-widget.js?21" data-telegram-login="' + escapeHTML(bot_username || 'samplebot') + '" data-size="' + escapeHTML(size) + '"' + (!userpic ? ' data-userpic="false"' : '') + attrs + (form.request_write.checked ? ' data-request-access="write"' : '') + '><\/script>' + html;
$('#embed_code').val(code);
$('#embed_code').height(0);
$('#embed_code').height($('#embed_code').get(0).scrollHeight);

View file

@ -234,7 +234,7 @@
<script src="/js/bootstrap.min.js?1"></script>
<script src="/js/core-widgets.js?1"></script>
<script>PostWidget.init({"default_link":"https:\/\/t.me\/telegram\/83","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?20"});
<script>PostWidget.init({"default_link":"https:\/\/t.me\/telegram\/83","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?21"});
backToTopInit("Go up");
removePreloadInit();
</script>

View file

@ -234,7 +234,7 @@ function telegramForwardButton($url, $text = &#39;&#39;) {
var button_size = form.button_size.value;
var button_text = form.button_text.value;
tfi.removeClass('is-invalid');
var code = '<script async src="https://telegram.org/js/telegram-widget.js?20" data-telegram-share-url="' + escapeHTML(share_url) + '"' + (share_comment ? ' data-comment="' + escapeHTML(share_comment) + '"' : '') + (button_size ? ' data-size="' + escapeHTML(button_size) + '"' : '') + (button_text ? ' data-text="' + escapeHTML(button_text) + '"' : '') + '><\/script>';
var code = '<script async src="https://telegram.org/js/telegram-widget.js?21" data-telegram-share-url="' + escapeHTML(share_url) + '"' + (share_comment ? ' data-comment="' + escapeHTML(share_comment) + '"' : '') + (button_size ? ' data-size="' + escapeHTML(button_size) + '"' : '') + (button_text ? ' data-text="' + escapeHTML(button_text) + '"' : '') + '><\/script>';
$('#embed_code').val(code);
$('#embed_code').height(0);
$('#embed_code').height($('#embed_code').get(0).scrollHeight);

View file

@ -220,7 +220,7 @@
<script src="/js/bootstrap.min.js?1"></script>
<script src="/js/core-widgets.js?1"></script>
<script>DiscussionWidget.init({"default_link":"https:\/\/t.me\/contest\/198","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?20"});
<script>DiscussionWidget.init({"default_link":"https:\/\/t.me\/contest\/198","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?21"});
backToTopInit("Go up");
removePreloadInit();
</script>

View file

@ -320,7 +320,7 @@ function updateWidget(widget_update, init) {
attrs += ' data-radius="' + escapeHTML(radius_value) + '"';
}
if (widget_update) {
var code = '<script async src="https://telegram.org/js/telegram-widget.js?20" data-telegram-login="samplebot" data-size="' + escapeHTML(size) + '"' + (!userpic ? ' data-userpic="false"' : '') + ' data-onauth="onTelegramAuth(user)"' + attrs + (form.request_write.checked ? ' data-request-access="write"' : '') + '><\/script>';
var code = '<script async src="https://telegram.org/js/telegram-widget.js?21" data-telegram-login="samplebot" data-size="' + escapeHTML(size) + '"' + (!userpic ? ' data-userpic="false"' : '') + ' data-onauth="onTelegramAuth(user)"' + attrs + (form.request_write.checked ? ' data-request-access="write"' : '') + '><\/script>';
$('#widget_container').html(code);
}
var post_link = $('#post_link').val() || 'https://t.me/telegram/83',
@ -333,7 +333,7 @@ function updateWidget(widget_update, init) {
attrs += ' data-onauth="onTelegramAuth(user)"';
html += "\n<script type=\"text/javascript\">\n function onTelegramAuth(user) {\n alert('Logged in as ' + user.first_name + ' ' + user.last_name + ' (' + user.id + (user.username ? ', @' + user.username : '') + ')');\n }\n<\/script>";
}
var code = '<script async src="https://telegram.org/js/telegram-widget.js?20" data-telegram-login="' + escapeHTML(bot_username || 'samplebot') + '" data-size="' + escapeHTML(size) + '"' + (!userpic ? ' data-userpic="false"' : '') + attrs + (form.request_write.checked ? ' data-request-access="write"' : '') + '><\/script>' + html;
var code = '<script async src="https://telegram.org/js/telegram-widget.js?21" data-telegram-login="' + escapeHTML(bot_username || 'samplebot') + '" data-size="' + escapeHTML(size) + '"' + (!userpic ? ' data-userpic="false"' : '') + attrs + (form.request_write.checked ? ' data-request-access="write"' : '') + '><\/script>' + html;
$('#embed_code').val(code);
$('#embed_code').height(0);
$('#embed_code').height($('#embed_code').get(0).scrollHeight);

View file

@ -234,7 +234,7 @@
<script src="/js/bootstrap.min.js?1"></script>
<script src="/js/core-widgets.js?1"></script>
<script>PostWidget.init({"default_link":"https:\/\/t.me\/telegram\/83","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?20"});
<script>PostWidget.init({"default_link":"https:\/\/t.me\/telegram\/83","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?21"});
backToTopInit("Go up");
removePreloadInit();
</script>

View file

@ -234,7 +234,7 @@ function telegramForwardButton($url, $text = &#39;&#39;) {
var button_size = form.button_size.value;
var button_text = form.button_text.value;
tfi.removeClass('is-invalid');
var code = '<script async src="https://telegram.org/js/telegram-widget.js?20" data-telegram-share-url="' + escapeHTML(share_url) + '"' + (share_comment ? ' data-comment="' + escapeHTML(share_comment) + '"' : '') + (button_size ? ' data-size="' + escapeHTML(button_size) + '"' : '') + (button_text ? ' data-text="' + escapeHTML(button_text) + '"' : '') + '><\/script>';
var code = '<script async src="https://telegram.org/js/telegram-widget.js?21" data-telegram-share-url="' + escapeHTML(share_url) + '"' + (share_comment ? ' data-comment="' + escapeHTML(share_comment) + '"' : '') + (button_size ? ' data-size="' + escapeHTML(button_size) + '"' : '') + (button_text ? ' data-text="' + escapeHTML(button_text) + '"' : '') + '><\/script>';
$('#embed_code').val(code);
$('#embed_code').height(0);
$('#embed_code').height($('#embed_code').get(0).scrollHeight);

View file

@ -79,15 +79,21 @@
return false;
};
function isTgAuthFinished() {
var locationHash = '', re = /[#\?\&]tgAuthFinished=1$/;
function haveTgAuthResult() {
var locationHash = '', re = /[#\?\&]tgAuthResult=([A-Za-z0-9\-_=]*)$/, match;
try {
locationHash = location.hash.toString();
if (match = locationHash.match(re)) {
location.hash = locationHash.replace(re, '');
var data = match[1] || '';
data = data.replace(/-/g, '+').replace(/_/g, '/');
var pad = data.length % 4;
if (pad > 1) {
data += new Array(5 - pad).join('=');
}
return JSON.parse(window.atob(data));
}
} catch (e) {}
if (re.test(locationHash)) {
location.hash = locationHash.replace(re, '');
return true;
}
return false;
}
@ -176,9 +182,6 @@
widgetsOrigin = getWidgetsOrigin('https://oauth.telegram.org', 'https://oauth.tg.dev');
widgetElId = 'telegram-login-' + widgetId.replace(/[^a-z0-9_]/ig, '-');
src = widgetsOrigin + '/embed/' + widgetId + '?origin=' + encodeURIComponent(location.origin || location.protocol + '//' + location.hostname) + '&return_to=' + encodeURIComponent(location.href);
if (isTgAuthFinished()) {
widgetEl.setAttribute('data-init-auth', '1');
}
allowedAttrs = ['size', 'userpic', 'init_auth', 'request_access', 'radius', 'min_width', 'max_width', 'lang'];
defWidth = 186;
defHeight = 28;
@ -207,6 +210,10 @@
if (widgetEl.hasAttribute('data-onunauth')) {
onUnauth = __parseFunction(widgetEl.getAttribute('data-onunauth'));
}
var auth_result = haveTgAuthResult();
if (auth_result && onAuthUser) {
onAuthUser(auth_result);
}
}
else if (widgetId = widgetEl.getAttribute('data-telegram-share-url')) {
widgetsOrigin = getWidgetsOrigin('https://t.me', 'https://post.tg.dev');
@ -451,11 +458,9 @@
_init: function(options, auth_callback) {
TelegramLogin.options = options;
TelegramLogin.auth_callback = auth_callback;
if (auth_callback &&
isTgAuthFinished()) {
TelegramLogin.getAuthData(options, function(origin, authData) {
auth_callback(authData);
});
var auth_result = haveTgAuthResult();
if (auth_result && auth_callback) {
auth_callback(auth_result);
}
},
_open: function(callback) {