Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
84 lines (73 loc) · 2.95 KB
/
Copy pathscript.js
File metadata and controls
84 lines (73 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
const menuButton = document.querySelector(".menu-toggle");
const primaryNav = document.querySelector("#primary-nav");
if (menuButton && primaryNav) {
menuButton.addEventListener("click", () => {
const isOpen = menuButton.getAttribute("aria-expanded") === "true";
menuButton.setAttribute("aria-expanded", String(!isOpen));
primaryNav.classList.toggle("is-open", !isOpen);
});
primaryNav.addEventListener("click", (event) => {
if (event.target instanceof HTMLAnchorElement) {
menuButton.setAttribute("aria-expanded", "false");
primaryNav.classList.remove("is-open");
}
});
}
const prefersReducedMotion = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
const canReveal = !prefersReducedMotion && "IntersectionObserver" in window;
if (canReveal) {
const revealTargets = document.querySelectorAll([
".hero-copy",
".hero-art",
".hero-ruler",
".section-heading",
".slot-card",
".decision-note",
".feature-pair > *",
".awake-layout > *",
".boundary-intro",
".boundary-artwork > *",
".group-layout > *",
".construction-section > *",
".hosting-layout > *",
".closing-heading",
".postcard-strip .promo-figure",
".footer-inner > *",
].join(","));
const revealObserver = new IntersectionObserver((entries, observer) => {
for (const entry of entries) {
if (entry.isIntersecting) {
entry.target.classList.add("is-visible");
observer.unobserve(entry.target);
}
}
}, { threshold: 0.12, rootMargin: "0px 0px -32px 0px" });
revealTargets.forEach((element, index) => {
element.classList.add("reveal");
element.style.setProperty("--reveal-delay", `${(index % 5) * 75}ms`);
revealObserver.observe(element);
});
document.documentElement.classList.add("motion-ready");
}
const communityGate = document.querySelector("#community-gate");
const countrySelect = document.querySelector("#eligible-country");
const ageConfirm = document.querySelector("#age-confirm");
const gateStatus = document.querySelector("#gate-status");
const matrixResult = document.querySelector("#matrix-result");
const matrixLink = document.querySelector("#matrix-link");
if (communityGate && countrySelect && ageConfirm && gateStatus && matrixResult && matrixLink) {
const eligibleCountries = new Set(["Canada", "Switzerland", "Russia", "Iran", "Somalia", "Turkmenistan"]);
communityGate.addEventListener("submit", (event) => {
event.preventDefault();
const country = countrySelect.value;
if (!eligibleCountries.has(country) || !ageConfirm.checked) {
gateStatus.textContent = "Select an eligible country and confirm that you are 18 or older.";
matrixResult.hidden = true;
matrixLink.removeAttribute("href");
return;
}
gateStatus.textContent = "Thanks. This is self-attestation only and is not independently verified.";
matrixLink.href = "https://matrix.to/#/#fed-os:matrix.org";
matrixResult.hidden = false;
});
}