Skip to content

Commit ce87aeb

Browse files
author
Dexter
committed
fix: mobile overlays — !important on meta rows, cache-bust v2, simplified toggle JS (CSS-driven visibility)
1 parent ee07c2f commit ce87aeb

3 files changed

Lines changed: 11 additions & 35 deletions

File tree

fandom.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<meta name="twitter:description" content="Every Moment is real. Every collector is real. Every connection is on-chain." />
1616
<meta name="twitter:image" content="https://fandom-v3.vercel.app/og-default.png" />
1717
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='6' fill='%23ff2d4e'/%3E%3Ctext x='16' y='22' font-family='Arial Black' font-size='18' font-weight='900' text-anchor='middle' fill='white'%3ETS%3C/text%3E%3C/svg%3E" />
18-
<link rel="stylesheet" href="styles.css?v=20260627m" />
18+
<link rel="stylesheet" href="styles.css?v=20260627m2" />
1919
<style>
2020
body { overflow-x: hidden; }
2121

fandom.js

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3500,53 +3500,29 @@
35003500
// else: no auto-route. Picker is visible, graph-area hidden by CSS until first click.
35013501

35023502
// ===== Mobile overlay toggles =====
3503-
// On mobile, overlays are collapsed by CSS. These JS hooks add toggle buttons.
3504-
function isMobile() { return window.matchMedia('(max-width: 768px)').matches; }
3503+
// On mobile, overlays are collapsed by CSS (@media max-width:768px).
3504+
// These JS hooks add interactive toggles for the user to expand them.
35053505

3506-
// Legend toggle button (top-left on mobile)
3506+
// Legend toggle button (top-left on mobile, shown/hidden by CSS media query)
35073507
const legendToggle = document.createElement('button');
35083508
legendToggle.className = 'mobile-toggle-btn';
35093509
legendToggle.textContent = '☰';
35103510
legendToggle.title = 'Toggle legend';
3511-
legendToggle.style.display = 'none';
35123511
legendToggle.addEventListener('click', () => {
35133512
const legend = document.getElementById('graph-legend');
35143513
if (legend) legend.classList.toggle('mobile-visible');
35153514
});
3516-
document.querySelector('.graph-area').appendChild(legendToggle);
3515+
const graphAreaEl = document.querySelector('.graph-area');
3516+
if (graphAreaEl) graphAreaEl.appendChild(legendToggle);
35173517

35183518
// Meta panel: tap to expand stats on mobile
35193519
const meta = document.getElementById('graph-meta');
35203520
if (meta) {
35213521
meta.addEventListener('click', () => {
3522-
if (isMobile()) meta.classList.toggle('mobile-expanded');
3523-
});
3524-
}
3525-
3526-
// Show/hide the toggle button when graph becomes visible
3527-
const showMobileControls = () => {
3528-
if (isMobile()) {
3529-
legendToggle.style.display = 'flex';
3530-
} else {
3531-
legendToggle.style.display = 'none';
3532-
// Reset desktop state
3533-
const legend = document.getElementById('graph-legend');
3534-
if (legend) legend.classList.remove('mobile-visible');
3535-
if (meta) meta.classList.remove('mobile-expanded');
3536-
}
3537-
};
3538-
3539-
// Watch for graph visibility changes
3540-
const graphArea = document.querySelector('.graph-area');
3541-
if (graphArea) {
3542-
const observer = new MutationObserver(() => {
3543-
const legend = document.getElementById('graph-legend');
3544-
if (legend && legend.style.display !== 'none') showMobileControls();
3522+
if (window.matchMedia('(max-width: 768px)').matches) {
3523+
meta.classList.toggle('mobile-expanded');
3524+
}
35453525
});
3546-
observer.observe(graphArea, { attributes: true, subtree: true, attributeFilter: ['style'] });
35473526
}
3548-
3549-
// Also respond to viewport changes (orientation, resize)
3550-
window.addEventListener('resize', showMobileControls);
35513527
})();
35523528

styles.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3755,8 +3755,8 @@ footer .footer-inner code { font-family: var(--mono); color: var(--fg-muted); }
37553755
right: 14px;
37563756
}
37573757
.graph-meta .player-name { font-size: 16px; }
3758-
.graph-meta .row { display: none; }
3759-
.graph-meta.mobile-expanded .row { display: flex; }
3758+
.graph-meta .row { display: none !important; }
3759+
.graph-meta.mobile-expanded .row { display: flex !important; }
37603760
.graph-meta.mobile-expanded { max-width: 260px; }
37613761

37623762
/* Controls: compact, bottom-left, smaller buttons */

0 commit comments

Comments
 (0)