|
69 | 69 |
|
70 | 70 | /* --- Choice cards, styled as stamped ammo-crate plaques --- */ |
71 | 71 | .cards{display:grid; grid-template-columns:minmax(0,460px); justify-content:center; gap:22px} |
72 | | - /* When the server hosts the game data, a second "Play now" card is revealed → two columns. */ |
73 | | - .cards.two{grid-template-columns:repeat(2,minmax(0,440px))} |
74 | | - @media (max-width:720px){ .cards.two{grid-template-columns:minmax(0,460px)} } |
75 | | - #card-hosted[hidden]{display:none} |
| 72 | + /* Exactly one card shows: hosted "Play now" if the server has the data, else the folder picker. |
| 73 | + .card sets display:flex, which would override the plain [hidden] attribute, so force it here. */ |
| 74 | + .card[hidden]{display:none} |
76 | 75 | .card{ |
77 | 76 | position:relative; padding:32px 30px 28px; |
78 | 77 | background:linear-gradient(160deg,var(--panel-2),var(--panel)); |
|
205 | 204 | <div class="wrap"> |
206 | 205 | <p class="eyebrow reveal d1">Jagged Alliance 2 · in your browser</p> |
207 | 206 | <h1 class="reveal d1">Jagged Alliance <span class="two">2</span></h1> |
208 | | - <p class="deck reveal d2">Assemble your squad and liberate Arulco, running entirely on your |
| 207 | + <p class="deck reveal d2" id="deck">Assemble your squad and liberate Arulco, running entirely on your |
209 | 208 | machine, nothing uploaded. Point the engine at your own copy of the game to play.</p> |
210 | 209 | <div class="rule reveal d2"><span class="diamond"></span></div> |
211 | 210 |
|
@@ -424,20 +423,28 @@ <h4>If something's off</h4> |
424 | 423 | note('Needs a Chromium browser (Chrome/Edge/Brave) on desktop.','muted'); |
425 | 424 | } |
426 | 425 |
|
427 | | - // --- Hosted-data card: reveal only if the operator serves the data package here. |
428 | | - // index.html (no query) already loads ja2-gamedata.js from the server, so "Play now" |
429 | | - // just points there. Absent on the public upload-only deploy → card stays hidden. --- |
| 426 | + // --- Hosted-data card: reveal only if the server actually hosts the game-data COPY. |
| 427 | + // index.html (no query) loads ja2-gamedata.js, which in turn fetches the big |
| 428 | + // ja2-gamedata.data blob — so we probe the .data (the real payload) AND the .js loader. |
| 429 | + // Both must be present or the boot fails. Absent (public upload-only deploy) → stay hidden. --- |
430 | 430 | (async function(){ |
431 | 431 | try { |
432 | | - const r = await fetch('ja2-gamedata.js', { method:'HEAD' }); |
433 | | - if (!r.ok) return; |
| 432 | + const [d, j] = await Promise.all([ |
| 433 | + fetch('ja2-gamedata.data', { method:'HEAD' }), |
| 434 | + fetch('ja2-gamedata.js', { method:'HEAD' }), |
| 435 | + ]); |
| 436 | + if (!d.ok || !j.ok) return; // no hosted data → folder-picker card stays (the default) |
434 | 437 | } catch(e){ return; } |
| 438 | + // Hosted data is present: this is the ONLY route. Show "Play now", hide the folder-picker path. |
435 | 439 | const play = () => { location.href = 'index.html'; }; |
436 | 440 | const card = $('card-hosted'); |
437 | 441 | card.hidden = false; |
438 | | - document.querySelector('.cards').classList.add('two'); |
439 | 442 | card.addEventListener('click', play); |
440 | 443 | card.addEventListener('keydown', (e)=>{ if(e.key==='Enter'||e.key===' '){ e.preventDefault(); play(); } }); |
| 444 | + const local = $('card-local'); if (local) local.hidden = true; |
| 445 | + const cont = $('continue'); if (cont) cont.classList.remove('show'); |
| 446 | + const deck = $('deck'); if (deck) deck.textContent = |
| 447 | + 'Assemble your squad and liberate Arulco, running right here in your browser — no install, no upload.'; |
441 | 448 | })(); |
442 | 449 |
|
443 | 450 | // --- Return-visit fast path --- |
|
0 commit comments