|
1 | 1 | const page = document.body.dataset.page; |
2 | 2 | const navLink = document.querySelector(`[data-nav="${page}"]`); |
3 | | -if (navLink) navLink.classList.add("active"); |
| 3 | +if (navLink) { |
| 4 | + navLink.classList.add("active"); |
| 5 | + navLink.setAttribute("aria-current", "page"); |
| 6 | +} |
4 | 7 |
|
5 | 8 | const prefersReducedMotion = window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches || false; |
6 | 9 | const revealTargets = new Set([...document.querySelectorAll(".reveal")]); |
@@ -63,21 +66,24 @@ const runtimeFlags = { |
63 | 66 | isConstrained: false, |
64 | 67 | isFirefoxLike: false, |
65 | 68 | isVivaldi: false, |
| 69 | + saveData: false, |
66 | 70 | }; |
67 | 71 |
|
68 | 72 | function computeRuntimeFlags() { |
69 | 73 | const ua = navigator.userAgent || ""; |
70 | 74 | const isSmallViewport = window.matchMedia?.("(max-width: 820px)")?.matches || false; |
71 | 75 | const isCoarsePointer = window.matchMedia?.("(pointer: coarse)")?.matches || false; |
72 | | - runtimeFlags.isConstrained = isSmallViewport || isCoarsePointer; |
| 76 | + runtimeFlags.saveData = navigator.connection?.saveData || false; |
| 77 | + runtimeFlags.isConstrained = isSmallViewport || isCoarsePointer || runtimeFlags.saveData || prefersReducedMotion; |
73 | 78 | runtimeFlags.isFirefoxLike = ua.includes("Firefox") || ua.includes("LibreWolf"); |
74 | 79 | runtimeFlags.isVivaldi = /vivaldi/i.test(ua); |
75 | 80 | } |
76 | 81 |
|
77 | 82 | function getStarFieldProfile() { |
78 | 83 | const isLiquidGlass = document.body.dataset.theme === "liquidglass"; |
79 | | - const { isConstrained } = runtimeFlags; |
| 84 | + const { isConstrained, saveData } = runtimeFlags; |
80 | 85 |
|
| 86 | + if (saveData) return { density: 0.22, frameBudget: 90 }; |
81 | 87 | if (isLiquidGlass && isConstrained) return { density: 0.42, frameBudget: 56 }; |
82 | 88 | if (isLiquidGlass) return { density: 0.55, frameBudget: 46 }; |
83 | 89 | if (isConstrained) return { density: 0.72, frameBudget: 28 }; |
@@ -1915,6 +1921,9 @@ function showToast(message) { |
1915 | 1921 | if (!toast) { |
1916 | 1922 | toast = document.createElement("div"); |
1917 | 1923 | toast.className = "easter-toast"; |
| 1924 | + toast.setAttribute("role", "status"); |
| 1925 | + toast.setAttribute("aria-live", "polite"); |
| 1926 | + toast.setAttribute("aria-atomic", "true"); |
1918 | 1927 | document.body.appendChild(toast); |
1919 | 1928 | } |
1920 | 1929 |
|
|
0 commit comments