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