/* ── GET THE APP ─────────────────────────────────────────────────────────────
* Taufik, 19 Oct 2026: "is there a way to have a button to guide to download
* install the apk? maybe here?" — the footer, beside the social marks.
*
* There is no APK to download: the site installs itself (manifest.webmanifest,
* _app.ejs) and the installed copy opens full screen, like RoadPlus on Dr KC's
* tablet. What this button does depends on what the browser allows:
* · Chrome / Edge / Samsung on Android, Chrome / Edge on a laptop — the
* browser's own "Install NEUON AI?" box, one tap;
* · iPhone / iPad — Apple lets no website install itself, so a short guide:
* Share, then Add to Home Screen;
* · anything else — the same guide for that browser's menu.
* Already running as the installed app: no button at all.
*/
(function () {
var btn = document.querySelector('[data-getapp]');
if (!btn) return;
var mm = function (q) { return window.matchMedia && matchMedia(q).matches; };
if (mm('(display-mode: fullscreen)') || mm('(display-mode: standalone)') || navigator.standalone) return;
btn.hidden = false;
var ua = navigator.userAgent;
var ios = /iPad|iPhone|iPod/.test(ua) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
var android = /Android/.test(ua);
function guide() {
var old = document.querySelector('.getapp-sheet'); if (old) old.remove();
var steps = ios
? ['Tap the Share button ⎋ in Safari’s bar.', 'Choose Add to Home Screen.', 'Tap Add. NEUON AI is now an app on your home screen and opens full screen.']
: android
? ['Tap the ⋮ menu at the top right of Chrome.', 'Choose Install app (or Add to Home screen).', 'Tap Install. Open NEUON AI from its icon and it fills the screen.']
: ['In Chrome or Edge, click the install icon at the right of the address bar (or the ⋮ menu → Install NEUON AI).', 'Click Install. NEUON AI opens in its own window, like an app.'];
var d = document.createElement('div');
d.className = 'getapp-sheet';
d.setAttribute('role', 'dialog'); d.setAttribute('aria-label', 'Install the NEUON AI app');
d.innerHTML = '
' +
'
Get the NEUON AI app
The same website, full screen — no download, always up to date.
' +
'' + steps.map(function (s) { return '
' + s + '
'; }).join('') + '' +
'
';
d.addEventListener('click', function (e) { if (e.target === d || e.target.closest('.getapp-close')) d.remove(); });
document.body.appendChild(d);
}
btn.addEventListener('click', function () {
var p = window.__neuInstall;
if (p) {
/* the browser's own box; if it refuses, the written steps instead */
var r0; try { r0 = p.prompt(); } catch (e) { r0 = Promise.reject(e); }
Promise.resolve(r0).catch(guide);
(p.userChoice || Promise.resolve({})).then(function (r) {
if (r && r.outcome === 'accepted') btn.hidden = true;
});
window.__neuInstall = null;
return;
}
guide();
});
window.addEventListener('appinstalled', function () { btn.hidden = true; });
if (!document.getElementById('getappCss')) {
var st = document.createElement('style'); st.id = 'getappCss';
st.textContent =
'.getapp{border:1.5px solid rgba(255,255,255,.75);background:transparent;color:#fff;border-radius:999px;padding:.4rem .95rem;font:700 .82rem Inter,sans-serif;cursor:pointer;min-height:40px;margin-right:.4rem;transition:background .2s,color .2s}' +
'.getapp:hover{background:#fff;color:#0078FF}.getapp[hidden]{display:none}' +
'.getapp-sheet{position:fixed;inset:0;z-index:400;display:grid;place-items:center;padding:16px;background:rgba(6,12,22,.55)}' +
'.getapp-box{background:#fff;color:#16202e;border-radius:22px;max-width:26rem;width:100%;padding:1.3rem 1.4rem 1.1rem;text-align:center;box-shadow:0 40px 90px -30px rgba(0,0,0,.6)}' +
'.getapp-box img{border-radius:16px;display:block;margin:0 auto .5rem}' +
'.getapp-box h3{font:800 1.15rem Inter,sans-serif;margin:0}.getapp-sub{font:500 .88rem Inter,sans-serif;color:#4a5668;margin:.25rem 0 .8rem}' +
'.getapp-box ol{text-align:left;margin:0 0 1rem 1.2rem;padding:0;font:500 .92rem/1.5 Inter,sans-serif;color:#2a3546}.getapp-box li{margin:.35rem 0}' +
'.getapp-close{border:0;border-radius:999px;background:#0078FF;color:#fff;font:700 .9rem Inter,sans-serif;padding:.6rem 1.6rem;cursor:pointer;min-height:40px}' +
'.getapp-ic{display:inline-block;transform:rotate(-90deg)}';
document.head.appendChild(st);
}
})();