This commit is contained in:
wukko 2023-05-17 02:31:22 +06:00
parent d85205649e
commit 61357c76f2
2 changed files with 12 additions and 13 deletions

View file

@ -414,25 +414,24 @@ async function loadCelebrationsEmoji() {
}
}
async function loadOnDemand(elementId, blockId) {
let j = {};
store.historyButton = eid(elementId).innerHTML;
let j = {}
eid(elementId).innerHTML = "..."
eid(elementId).innerHTML = "...";
try {
if (store.historyContent) {
j = store.historyContent;
} else {
j = await fetch(`${apiURL}/api/onDemand?blockId=${blockId}`).then((r) => { if (r.status === 200) { return r.json() } else { return false } }).catch(() => { return false });
if (j && j.status === "success") {
store.historyContent = j;
} else {
throw new Error();
}
await fetch(`${apiURL}/api/onDemand?blockId=${blockId}`).then(async(r) => {
j = await r.json();
if (j && j.status === "success") {
store.historyContent = j;
} else throw new Error();
}).catch(() => { throw new Error() });
}
if (j.text) {
eid(elementId).innerHTML = `<button class="switch bottom-margin" onclick="restoreUpdateHistory()">${loc.collapseHistory}</button>${j.text}`;
} else {
throw new Error()
}
} else throw new Error()
} catch (e) {
eid(elementId).innerHTML = store.historyButton;
internetError()

View file

@ -131,8 +131,8 @@ export function popupWithBottomButtons(obj) {
export function backdropLink(link, text) {
return `<a class="text-backdrop italic" href="${link}" target="_blank">${text}</a>`
}
export function socialLink(emoji, name, handle, url) {
return `<div class="cobalt-support-link">${emoji} ${name}: <a class="text-backdrop italic" href="${url}" target="_blank">${handle}</a></div>`
export function socialLink(emji, name, handle, url) {
return `<div class="cobalt-support-link">${emji} ${name}: <a class="text-backdrop italic" href="${url}" target="_blank">${handle}</a></div>`
}
export function settingsCategory(obj) {
return `<div id="settings-${obj.name}" class="settings-category">