Update
This commit is contained in:
parent
eebfbd0f3b
commit
ff7fbddff3
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue