/** * GoingsOn - Viewport / UI Mode Module * * Single source of truth for which UI mode the app is rendering. * Mode is set ONCE at boot by the inline detection script in index.html; * never changes at runtime. Code that wants to make layout decisions * (which DOM to render, which behavior path to take) should consult this * module instead of measuring window.innerWidth or sniffing user agents. * * Input-capability decisions (hover suppression, drag vs long-press) are * SEPARATE and live in GoingsOn.touch — do not collapse them into here. * * Dev override: set ?ui=mobile or ?ui=desktop in the URL, or run * localStorage.setItem('goingson.uiMode', 'mobile') * and reload. Production builds will eventually ignore these (phase 5). */ (function () { 'use strict'; var mode = window.__GO_UI_MODE__ === 'mobile' ? 'mobile' : 'desktop'; GoingsOn.viewport = { mode: mode, isMobile: function () { return mode === 'mobile'; }, isDesktop: function () { return mode === 'desktop'; }, /** * Dev helper — set the UI mode override and reload. Available from * the JS console for testing. * @param {'mobile'|'desktop'|null} m - null clears the override */ setOverride: function (m) { if (m === null) { localStorage.removeItem('goingson.uiMode'); } else if (m === 'mobile' || m === 'desktop') { localStorage.setItem('goingson.uiMode', m); } else { return; } location.reload(); }, }; })();