This commit is contained in:
Valeria Fadeeva 2023-12-15 22:48:05 +05:00
parent eebfbd0f3b
commit ff7fbddff3
1 changed files with 12 additions and 7 deletions

View File

@ -1,4 +1,4 @@
async function fetchData() {
async function fetchData(log) {
var log = document.getElementById('log');
var server_address = `techhub.social`;
@ -72,12 +72,17 @@ async function fetchData() {
async function openInNewTab(url) {
window.open(url, '_blank').focus();
}
async function getLog() {
let log = document.getElementById('log');
if(log == null) {
setTimeout(getLog, 1000);
} else {
getMastodonPage();
}
}
async function getMastodonPage() {
let log = document.getElementById('log');
if (log == null) {
setTimeout(getMastodonPage, 1000);
return;
}
let tplUrl = 'json/mastodon-tpl.html';
let response = await fetch(tplUrl);
@ -105,11 +110,11 @@ async function getMastodonPage() {
log.innerHTML = "<p>2) Ой всё сломалось :(</p>";
}
fetchData();
fetchData(log);
}
let query = window.location.pathname;
if (query == "/news" || query == "/mastodon") {
getMastodonPage();
getLog();
}