|
4 | 4 | <meta charset="UTF-8"> |
5 | 5 | <title>Mercwar Void Star</title> |
6 | 6 |
|
7 | | -<script> |
8 | | - // Generates "YYYY-MM-DD" |
9 | | - const d = new Date(); |
10 | | - const v = d.toISOString().split('T')[0]; |
11 | | - |
12 | | - document.write(`<link rel="stylesheet" href="index.css?v=${v}">`); |
13 | | - document.write(`<link rel="stylesheet" href="ui.css?v=${v}">`); |
14 | | - document.write(`<link rel="stylesheet" href="fire-gem-orb.css?v=${v}">`); |
15 | | -</script> |
| 7 | +<link rel="stylesheet" href="index.css?v=124"> |
| 8 | +<link rel="stylesheet" href="ui.css?v=123"> |
| 9 | +<link rel="stylesheet" href="fire-gem-orb.css?123"> |
16 | 10 |
|
17 | 11 | <!-- ===== AVIS / CONSTELLATION META CORE ===== --> |
18 | 12 | <meta name="meta" content="AVIS-CONSTELLATION"> |
@@ -135,40 +129,43 @@ <h1>Void Star</h1> |
135 | 129 | <script src="index.js?v=10"></script> |
136 | 130 |
|
137 | 131 | <script> |
138 | | -(function () { |
139 | | - const OFFSET = 170; |
140 | | - const TARGET_ID = "topDivider"; |
141 | | - |
142 | | - window.addEventListener("load", () => { |
143 | | - |
144 | | - // Don't auto-scroll inside an iframe. |
145 | | - if (window.self !== window.top) { |
146 | | - return; |
147 | | - } |
148 | | - |
149 | | - // Wait until layout settles. |
150 | | - requestAnimationFrame(() => { |
151 | | - requestAnimationFrame(() => { |
152 | | - |
153 | | - const target = document.getElementById(TARGET_ID); |
154 | | - if (!target) return; |
155 | | - |
156 | | - const y = target.getBoundingClientRect().top + |
157 | | - window.pageYOffset + |
158 | | - OFFSET; |
159 | | - |
160 | | - window.scrollTo({ |
161 | | - top: y, |
| 132 | +window.addEventListener("load", () => { |
| 133 | + const anchor = document.getElementById("jump_scroll"); |
| 134 | + if (!anchor) return; |
| 135 | + |
| 136 | + // First scroll into view |
| 137 | + anchor.scrollIntoView({ |
| 138 | + behavior: "smooth", |
| 139 | + block: "start" |
| 140 | + }); |
| 141 | + |
| 142 | + let lastPos = -1; |
| 143 | + let stableCount = 0; |
| 144 | + |
| 145 | + function validateScroll() { |
| 146 | + const currentPos = window.scrollY; |
| 147 | + |
| 148 | + if (currentPos === lastPos) { |
| 149 | + stableCount++; |
| 150 | + // Require stability for ~20 frames (~300ms at 60fps) |
| 151 | + if (stableCount >= 20) { |
| 152 | + // Apply final offset once validated |
| 153 | + window.scrollBy({ |
| 154 | + top: 136, |
162 | 155 | behavior: "smooth" |
163 | 156 | }); |
| 157 | + return; // stop loop after final scroll |
| 158 | + } |
| 159 | + } else { |
| 160 | + stableCount = 0; // reset if movement detected |
| 161 | + } |
164 | 162 |
|
165 | | - }); |
166 | | - }); |
| 163 | + lastPos = currentPos; |
| 164 | + requestAnimationFrame(validateScroll); |
| 165 | + } |
167 | 166 |
|
168 | | - }, { once: true }); |
169 | | -})(); |
| 167 | + requestAnimationFrame(validateScroll); |
| 168 | +}); |
170 | 169 | </script> |
171 | | - |
172 | | - |
173 | 170 | </body> |
174 | 171 | </html> |
0 commit comments