Fix Two Rivers production age gate
All checks were successful
Build Org Website / build (push) Successful in 44s

This commit is contained in:
gitea-actions
2026-07-31 14:15:42 +01:00
parent 4659edc658
commit 262d943443
4 changed files with 42 additions and 3 deletions

View File

@@ -0,0 +1,35 @@
(function () {
"use strict";
var root = document.querySelector("[data-two-rivers]");
if (!root) return;
var button = root.querySelector("[data-tr-age-confirm]");
var ageScreen = root.querySelector("[data-tr-age]");
var loading = root.querySelector("[data-tr-loading]");
var loadingCopy = root.querySelector("[data-tr-loading-copy]");
var AGE_KEY = "zxh_two_rivers_age_gate_v1";
if (!button || !ageScreen || !loading) return;
button.addEventListener("click", function () {
root.dataset.ageConfirmed = "true";
try {
localStorage.setItem(AGE_KEY, "true");
} catch (_error) {
// The module bootstrap can still use the in-page marker when storage is unavailable.
}
ageScreen.hidden = true;
loading.hidden = false;
if (loadingCopy) loadingCopy.textContent = "Opening the festival…";
window.setTimeout(function () {
if (!loading.hidden && !root.querySelector("[data-tr-menu]:not([hidden])")) {
loading.innerHTML = "<div><strong>The festival files did not finish loading.</strong><p>Refresh once to fetch the latest game files. If the problem continues, the deployment is incomplete.</p><button type=\"button\" data-tr-gate-retry>Refresh</button><a href=\"/play/play.html\">Return to the playroom</a></div>";
var retry = loading.querySelector("[data-tr-gate-retry]");
if (retry) retry.addEventListener("click", function () { location.reload(); });
}
}, 12000);
}, {once: true});
}());

View File

@@ -168,7 +168,7 @@ async function start() {
function showGateOrMenu() {
const age = root.querySelector("[data-tr-age]");
if (saves.ageConfirmed()) {
if (saves.ageConfirmed() || root.dataset.ageConfirmed === "true") {
age.hidden = true;
showMenu();
} else {
@@ -225,6 +225,7 @@ async function start() {
root.querySelector("[data-tr-age-confirm]").addEventListener("click", () => {
saves.confirmAge();
root.querySelector("[data-tr-age]").hidden = true;
loadingEl.hidden = true;
audio.unlock();
showMenu();
});