plugin-backend #1
@ -79,7 +79,6 @@ async function initialize_elements() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Initialize global state
|
||||
current_checks = checks.collected + checks.found;
|
||||
current_entrances = entrances.found;
|
||||
@ -136,9 +135,9 @@ async function refresh_elements() {
|
||||
}
|
||||
is_timeout = false;
|
||||
await update_if_changes(response.data);
|
||||
setTimeout(refresh_elements, 500)
|
||||
setTimeout(refresh_elements, 500);
|
||||
} else if (response.error) {
|
||||
setTimeout(refresh_elements, 1100)
|
||||
setTimeout(refresh_elements, 1100);
|
||||
if (response.error.error) {
|
||||
if (!is_timeout) {
|
||||
is_timeout = true;
|
||||
@ -162,14 +161,11 @@ async function refresh_elements() {
|
||||
document.getElementById("status-block").classList.remove("hidden");
|
||||
}
|
||||
can_access_api_server = false;
|
||||
setTimeout(refresh_elements, 1100)
|
||||
setTimeout(refresh_elements, 1100);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
setTimeout(refresh_elements, 1100)
|
||||
setTimeout(refresh_elements, 1100);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async function update_if_changes(overview) {
|
||||
@ -574,7 +570,9 @@ async function initialize_checks_list(checks_list, checks) {
|
||||
// Update the check totals
|
||||
checks_list.querySelector(
|
||||
".breakdown-block-checks-title"
|
||||
).textContent = `Checks: ${checks.collected + checks.found}/${checks.total} (${checks.remaining} left)`;
|
||||
).textContent = `Checks: ${checks.collected + checks.found}/${
|
||||
checks.total
|
||||
} (${checks.remaining} left)`;
|
||||
checks_list.querySelector(
|
||||
".breakdown-block-checks-title"
|
||||
).dataset.checksCollected = checks.collected + checks.found;
|
||||
@ -725,7 +723,9 @@ async function initialize_summary(summary_element, scene, checks, entrances) {
|
||||
summary_checks.dataset.checksCollected = checks.collected + checks.found;
|
||||
summary_checks.dataset.checksRemaining = checks.remaining;
|
||||
summary_checks.dataset.checksTotal = checks.total;
|
||||
summary_checks.textContent = `Checks: ${checks.collected + checks.found}/${checks.total} (${checks.remaining})`;
|
||||
summary_checks.textContent = `Checks: ${checks.collected + checks.found}/${
|
||||
checks.total
|
||||
} (${checks.remaining})`;
|
||||
|
||||
const summary_entrances = summary_element.querySelector(".summary-entrances");
|
||||
summary_entrances.dataset.entrancesFound = entrances.found;
|
||||
@ -787,7 +787,9 @@ async function update_summary(scene, checks, entrances) {
|
||||
summary_checks.dataset.checksCollected = checks.collected + checks.found;
|
||||
summary_checks.dataset.checksRemaining = checks.remaining;
|
||||
summary_checks.dataset.checksTotal = checks.total;
|
||||
summary_checks.textContent = `Checks: ${checks.collected + checks.found}/${checks.total} (${checks.remaining})`;
|
||||
summary_checks.textContent = `Checks: ${checks.collected + checks.found}/${
|
||||
checks.total
|
||||
} (${checks.remaining})`;
|
||||
}
|
||||
if (entrances_changed) {
|
||||
summary_entrances.dataset.entrancesFound = entrances.found;
|
||||
@ -856,7 +858,9 @@ async function update_breakdown_checks(scene, checks) {
|
||||
// Update the check totals
|
||||
document.querySelector(
|
||||
`.breakdown[data-scene="${scene}"] .breakdown-block-checks-title`
|
||||
).textContent = `Checks: ${checks.collected + checks.found}/${checks.total} (${checks.remaining} left)`;
|
||||
).textContent = `Checks: ${checks.collected + checks.found}/${
|
||||
checks.total
|
||||
} (${checks.remaining} left)`;
|
||||
document.querySelector(
|
||||
`.breakdown[data-scene="${scene}"] .breakdown-block-checks-title`
|
||||
).dataset.checksCollected = checks.collected + checks.found;
|
||||
@ -925,7 +929,10 @@ async function update_breakdown(scene, checks, entrances) {
|
||||
);
|
||||
|
||||
// Check for changes, and if so, update
|
||||
if (breakdown_checks.dataset.checksCollected != checks.collected + checks.found) {
|
||||
if (
|
||||
breakdown_checks.dataset.checksCollected !=
|
||||
checks.collected + checks.found
|
||||
) {
|
||||
update_breakdown_checks(scene, checks);
|
||||
}
|
||||
if (breakdown_entrances.dataset.entrancesFound != entrances.found) {
|
||||
@ -948,9 +955,12 @@ async function update_breakdown_list(data, changed) {
|
||||
update_breakdown(
|
||||
scene,
|
||||
{
|
||||
collected: document.querySelector(
|
||||
collected: parseInt(
|
||||
document.querySelector(
|
||||
`.breakdown[data-scene="${scene}"] .breakdown-block-checks-title`
|
||||
).dataset.checksCollected,
|
||||
).dataset.checksCollected
|
||||
),
|
||||
found: 0,
|
||||
},
|
||||
data.scenes[scene]
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user