/* ── WHICH SCREENS GET THE QUIET VERSION ────────────────────────────────── * * Taufik, 31 August 2026: "for neuonbox [potrait] make it like mobile * version. our neuonbox version unable to display so much animation. old and * cannot be update." * * The NEUONBOX is the standing panel in the office — 1080x1920, portrait, and * running hardware that cannot be replaced. Everything built to spare a * phone's battery in August was gated on `(max-width: 820px)`, and the * NEUONBOX is 1080 wide, so it was getting the FULL version: the pinned * three-stage teach section cross-fading on every scroll frame, a megabyte of * film being seeked, and nine orbit rings asking for animation frames. The * weakest screen in the building was being given the heaviest page. * * ── ONE QUERY, NAMED ONCE ──────────────────────────────────────────────── * * Four files used to carry the string '(max-width: 820px)' separately. A * fifth screen is exactly the kind of change that gets made in three of them. * So the rule lives here, and hero.js, orbit.js, scrollfilm.js and the * stylesheet all answer to it. * * The second half of the query is the NEUONBOX's own, copied from the * standing-screen block in site.css so the two cannot drift: portrait, wider * than a phone, and tall enough that no phone on sale reaches it. * * ── WHAT THIS IS NOT ───────────────────────────────────────────────────── * * It is not "mobile layout on the NEUONBOX". That panel has its own carefully * sized shape — 22vw film cards read from two metres away, two bands at the * foot — and none of that changes. This only turns off the MOVING parts. The * words, the pictures and the layout stay exactly as they were. */ (function () { 'use strict'; var PHONE = '(max-width: 820px)'; var NEUONBOX = '(orientation: portrait) and (min-width: 821px) and (min-height: 1000px)'; /* ── AND ANY DEVICE THAT CANNOT KEEP UP (Taufik, 17 Oct 2026) ── "detect the user device to know if the device can handle all the animation and graphic, if it cannot, pause/remove". Screen size alone missed old laptops and cheap tablets. So, before anything draws: · what the device says about itself — two cores or fewer, 2 GB or less, Data Saver on, a 2G connection; · or what it SHOWED last time: a measured frame rate under 30 a second, twice, on an earlier visit, remembered for a week (see probe() below). A visitor can always turn the effects back on; that is remembered too. */ function store(k, v) { try { if (v === undefined) return localStorage.getItem(k); localStorage.setItem(k, v); } catch (e) { return null; } } function weakDevice() { var forced = store('neu-fx'); if (forced === 'on') return false; if (forced === 'off') return true; var n = navigator, c = n.connection || {}; if (n.hardwareConcurrency && n.hardwareConcurrency <= 2) return true; if (n.deviceMemory && n.deviceMemory <= 2) return true; if (c.saveData || /(^|-)2g$/.test(c.effectiveType || '')) return true; var seen = Number(store('neu-weak-at') || 0); return seen > 0 && Date.now() - seen < 7 * 864e5; } var WEAK = weakDevice(); /* a weak device answers "yes" to the quiet question everywhere: 'all' is a media query that always matches, so hero.js, orbit.js and scrollfilm.js need no change of their own */ /* …but NOT on a laptop-sized screen any more (Taufik, 17 Oct 2026: "why simple version like this?"). The scripts then built the PHONE versions of the hero and We Teach while the style sheet, which goes by width, still laid out the desktop ones: three stages piled on each other, cards scattered. The layout follows the screen; Simple keeps its other savings (no shine, no helpers, loops once, no frosted glass). */ var QUERY = PHONE + ', ' + NEUONBOX; function asks() { if (WEAK) { return true; } if (!window.matchMedia) { return false; } return window.matchMedia(QUERY).matches; } window.NEULowFi = { query: QUERY, phone: PHONE, neuonbox: NEUONBOX, /* live, because a browser window can be resized across the line and the orbit rings watch this to decide whether to start spinning again */ /* the LAYOUT question: a phone-sized screen or the panel. Simple on a laptop is not a phone layout — ask quiet() for "hold still" */ matches: function () { return !!window.matchMedia && window.matchMedia(QUERY).matches; }, quiet: asks, isBox: function () { return !!window.matchMedia && window.matchMedia(NEUONBOX).matches; }, }; /* a hook for anything that wants to say so in CSS without repeating the query — the stylesheet mostly uses the media query directly, because a rule that needs JS to have run is a rule that flickers on a slow screen */ window.NEULowFi.weak = function () { return WEAK; }; /* what "quiet" means beyond the three scripts: endless CSS loops stop, glass blur goes (the costliest thing a cheap GPU is asked to paint), and the walking helpers stay home */ function quieten(live) { var h = document.documentElement; h.classList.add('is-lowfi', 'is-weak'); if (!document.getElementById('neuWeakCss')) { var st = document.createElement('style'); st.id = 'neuWeakCss'; /* Every loop plays ONCE, at its own speed. It used to be cut to .01s as well, which made every animation a jump and the shine a flicker across the cards (Taufik, 17 Oct 2026: the shining is bugging, moving too fast) — so the shine itself is simply switched off in Simple. */ st.textContent = 'html.is-weak *,html.is-weak *::before,html.is-weak *::after{animation-iteration-count:1!important;' + 'backdrop-filter:none!important;-webkit-backdrop-filter:none!important}' + 'html.is-weak .shine::after,html.is-weak .tshine,html.is-weak .tshine::after,html.is-weak .tshine::before{animation:none!important}' + '.neufx{position:fixed;left:12px;bottom:12px;z-index:200;background:rgba(22,32,46,.92);color:#fff;border-radius:12px;' + 'padding:.55rem .8rem;font:600 .78rem Inter,sans-serif;display:flex;gap:.6rem;align-items:center;max-width:calc(100vw - 24px)}' + '.neufx button{border:0;border-radius:999px;padding:.3rem .7rem;font:700 .74rem Inter,sans-serif;cursor:pointer;background:#0b63ff;color:#fff}' + '.neufx button+button{background:transparent;color:#cdd6e3}' + '.neuask{position:fixed;inset:0;z-index:300;display:grid;place-items:center;padding:16px;background:rgba(6,12,22,.55)}' + '.neuask__box{background:#fff;color:#16202e;border-radius:22px;max-width:30rem;width:100%;padding:1.2rem 1.3rem 1.1rem;text-align:center;box-shadow:0 40px 90px -30px rgba(0,0,0,.6)}' + '.neuask__neu{width:96px;height:96px;object-fit:contain;margin:-3.4rem auto .2rem;display:block}' + '.neuask__hi{font:800 1.15rem Inter,sans-serif;margin:0}.neuask__q{font:500 .95rem Inter,sans-serif;color:#4a5668;margin:.25rem 0 .9rem}' + '.neuask__opts{display:grid;grid-template-columns:1fr 1fr;gap:.6rem}' + '.neuask__opts button{position:relative;border:2px solid #dde3ec;background:#f7f9fc;border-radius:16px;padding:.8rem .7rem;cursor:pointer;text-align:left;font:500 .8rem/1.35 Inter,sans-serif;color:#4a5668}' + '.neuask__opts button:hover,.neuask__opts button:focus-visible{border-color:#0b63ff;background:#eef4ff;outline:none}' + '.neuask__opts b{display:block;font:800 1rem Inter,sans-serif;color:#16202e;margin-bottom:.2rem}' + '.neuask__opts i{position:absolute;top:-.6rem;right:.5rem;font:800 .62rem Inter,sans-serif;font-style:normal;background:#0b63ff;color:#fff;border-radius:999px;padding:.12rem .45rem}' + '.neuask__note{font:500 .72rem Inter,sans-serif;color:#8b97a8;margin:.7rem 0 0}' + '@media (max-width:420px){.neuask__opts{grid-template-columns:1fr}}' + '.neufxbtn{border:1.5px solid #dde3ec;background:#fff;color:#16202e;border-radius:999px;padding:.32rem .7rem;margin-right:.45rem;min-height:40px;min-width:64px;' + 'font:700 .78rem Inter,sans-serif;cursor:pointer;vertical-align:middle;white-space:nowrap}' + '.neufxbtn{position:relative}.neufxtip{position:absolute;top:calc(100% + 10px);right:-40px;width:270px;display:none;flex-direction:column;gap:.45rem;' + 'background:#fff;color:#16202e;border:1px solid #e6eaf0;border-radius:14px;padding:.7rem .8rem;text-align:left;white-space:normal;' + 'box-shadow:0 20px 40px -16px rgba(6,12,22,.4);font:500 .76rem/1.4 Inter,sans-serif;z-index:20;pointer-events:none}' + '.neufxbtn:hover .neufxtip,.neufxbtn:focus-visible .neufxtip{display:flex}' + '.neufxtip__row{display:flex;flex-direction:column;gap:.1rem;padding:.35rem .45rem;border-radius:9px;color:#4a5668}' + '.neufxtip__row.is-on{background:#eef4ff}.neufxtip__row b{font:800 .8rem Inter,sans-serif;color:#16202e}' + '.neufxtip i{font:700 .7rem Inter,sans-serif;font-style:normal;color:#0b63ff;padding:0 .45rem}' + '@media (hover:none){.neufxtip{display:none!important}}' + '.neufxbtn:hover{border-color:#0b63ff;color:#0b63ff}.neufxbtn{z-index:5}' + '@media (max-width:640px){.neufxbtn{padding:.28rem .55rem;font-size:.74rem;min-height:40px}}'; (document.head || h).appendChild(st); } if (live) { /* found out after the page started: stop what is already moving */ document.querySelectorAll('video[autoplay]').forEach(function (v) { try { v.pause(); } catch (e) {} }); document.querySelectorAll('*').forEach(function (el) { if (el._orbit) el._orbit.spin = 0; }); } } /* ── NEU ASKS, ON THE FIRST VISIT (Taufik, 17 Oct 2026) ── "if enter 1st time, NEU pop-up asking to click 2 choice. [simple] or [full] version." The device check above decides which one is marked "best for this device"; the visitor decides. Asked once, remembered. In Simple, a small pill bottom-left lets them switch back any time. */ function choose(full) { store('neu-fx', full ? 'on' : 'off'); if (full) { store('neu-weak-at', '0'); if (WEAK) { location.reload(); return; } } else if (!WEAK) { WEAK = true; quieten(true); } var c = document.querySelector('.neuask'); if (c) c.remove(); pill(); } /* the switch lives beside NEU's button in the top bar ("create a button beside NEU to add [simple/full]"), on every page that has one; the corner pill is only for a page without that button */ function pill() { if (!document.body) return; var neu = document.getElementById('navNeu'); var old = document.querySelector('.neufxbtn, .neufx'); if (old) old.remove(); var b = document.createElement('button'); b.type = 'button'; b.className = neu ? 'neufxbtn' : 'neufx'; b.setAttribute('aria-label', WEAK ? 'Simple view — press for Full' : 'Full view — press for Simple'); b.textContent = WEAK ? '🍃 Simple' : '✨ Full'; /* WHAT THE DIFFERENCE IS, on mouse-over (Taufik, 17 Oct 2026) — the two choices side by side, the one in use marked, and what pressing does */ var tip = document.createElement('span'); tip.className = 'neufxtip'; tip.setAttribute('aria-hidden', 'true'); [['🍃 Simple', 'Lighter and faster. Same words and pictures — no films, spinning rings, glows or walking helpers.', WEAK], ['✨ Full', 'Everything: films, the spinning constellation, glows and the walking NEU helpers.', !WEAK]].forEach(function (o) { var row = document.createElement('span'); row.className = 'neufxtip__row' + (o[2] ? ' is-on' : ''); var h = document.createElement('b'); h.textContent = o[0] + (o[2] ? ' · now' : ''); var p = document.createElement('span'); p.textContent = o[1]; row.appendChild(h); row.appendChild(p); tip.appendChild(row); }); var hint = document.createElement('i'); hint.textContent = 'Press to switch to ' + (WEAK ? 'Full' : 'Simple'); tip.appendChild(hint); b.appendChild(tip); b.onclick = function () { choose(WEAK); }; if (!neu) { document.body.appendChild(b); return; } /* OUT OF THE BAR'S LAYOUT: placed inside the bar the button pushed the centred menu so the logo covered Trust. It is pinned just left of NEU instead, and re-pinned whenever the window changes size. */ neu.parentNode.insertBefore(b, neu); b.style.position = 'absolute'; b.style.margin = '0'; var place = function () { var host = b.offsetParent || document.body; var hr = host.getBoundingClientRect(), nr = neu.getBoundingClientRect(); b.style.right = Math.round(hr.right - nr.left + 8) + 'px'; b.style.top = Math.round(nr.top - hr.top + (nr.height - b.offsetHeight) / 2) + 'px'; }; place(); addEventListener('resize', place); } /* ── FULL SCREEN BY ITSELF (Dr KC, 19 Oct 2026, through Taufik: "dont want full screen button. i want automatic full screen", like RoadPlus on his tablet) ── No page may go full screen before the visitor touches it; every browser refuses. So, two ways, neither a button: · INSTALLED (the manifest, _app.ejs) it opens full screen from the home-screen icon, exactly like RoadPlus; · in the BROWSER on a tablet or touch screen, the first touch anywhere on the page takes it full screen. Leaving with the system back / Esc is respected: it is not re-entered until the next page. Not on a phone (a full-screen phone page hides the way back), not with a mouse (a laptop visitor did not ask), not for the NEUONBOX kiosk. */ function autoFullscreen() { var d = document, el = d.documentElement; var can = d.fullscreenEnabled || d.webkitFullscreenEnabled; var app = window.matchMedia && matchMedia('(display-mode: fullscreen)').matches; /* INSTALLED BUT IN A WINDOW: a laptop never opens an installed app full screen, whatever the manifest asks — it gets a window with a title bar (Taufik, 19 Oct 2026: "this top no need"). Somebody who installed the app wants it full screen, so there the first click does it, mouse or not, any size. */ var installed = window.matchMedia && matchMedia('(display-mode: standalone), (display-mode: window-controls-overlay)').matches; var touch = window.matchMedia && matchMedia('(pointer: coarse)').matches; if (!can || app || window.NEULowFi.isBox()) return; if (!installed && (!touch || Math.min(screen.width, screen.height) < 600)) return; var go = function (e) { d.removeEventListener('pointerup', go, true); if (d.fullscreenElement || d.webkitFullscreenElement) return; try { var p = (el.requestFullscreen || el.webkitRequestFullscreen).call(el, { navigationUI: 'hide' }); if (p && p.catch) p.catch(function () {}); } catch (er) {} }; d.addEventListener('pointerup', go, true); } function offer() { if (!document.body) return; pill(); if (store('neu-fx') || (window.NEULowFi.isBox && window.NEULowFi.isBox()) || /bot|crawl|spider|lighthouse/i.test(navigator.userAgent)) return; var weak = WEAK; var d = document.createElement('div'); d.className = 'neuask'; d.setAttribute('role', 'dialog'); d.setAttribute('aria-modal', 'true'); d.setAttribute('aria-label', 'Choose Simple or Full version'); d.innerHTML = '
' + '

Hi, I’m NEU! 👋

How would you like to explore NEUON AI?

' + '
' + '' + '' + '

You can switch any time.

'; d.querySelectorAll('[data-fx]').forEach(function (b) { b.onclick = function () { choose(b.getAttribute('data-fx') === 'full'); }; }); document.body.appendChild(d); var first = d.querySelector(weak ? '[data-fx=simple]' : '[data-fx=full]'); if (first) first.focus(); } /* ── THE MEASUREMENT ── Three seconds of frames once the page has settled, only when the tab is in front (a hidden tab is throttled and would look slow), and not on a screen already quiet. Twice under 30 frames a second: quieten now, and remember for a week. */ function probe() { if (WEAK || asks() || document.hidden || !window.requestAnimationFrame) return; var n = 0, t0 = 0; function tick(t) { if (!t0) t0 = t; n++; if (t - t0 < 3000) { requestAnimationFrame(tick); return; } if (document.hidden) return; var fps = n * 1000 / (t - t0); /* TWO slow readings, seconds apart, both under 30: one busy moment while pictures decode must not put a good laptop in the slow lane for a week */ if (fps >= 30) return; if (!probe.once) { probe.once = true; setTimeout(probe, 4000); return; } if (store('neu-fx') !== 'on') { WEAK = true; store('neu-weak-at', String(Date.now())); quieten(true); offer(); } } requestAnimationFrame(tick); } /* ?diag — what this screen says about itself, on the screen (Taufik, 19 Oct 2026: the office TV showed the site zoomed out to a third and no emulator could reproduce it). Read it off a photo of the device. */ if (/[?&]diag\b/.test(location.search)) { window.addEventListener('load', function () { setTimeout(function () { var W = innerWidth, wide = []; [].forEach.call(document.querySelectorAll('body *'), function (e) { var r = e.getBoundingClientRect(); if (r.width && r.right > W + 4 && wide.length < 6) wide.push((e.id ? '#' + e.id : '') + '.' + String(e.className).split(' ')[0] + ' →' + Math.round(r.right)); }); var d = document.createElement('pre'); d.style.cssText = 'position:fixed;left:8px;top:8px;z-index:99999;background:#000;color:#0f0;font:16px/1.4 monospace;padding:10px;white-space:pre-wrap;max-width:90vw'; d.textContent = 'screen ' + screen.width + 'x' + screen.height + ' dpr ' + devicePixelRatio + '\nwindow ' + innerWidth + 'x' + innerHeight + ' outer ' + outerWidth + 'x' + outerHeight + '\npage width ' + document.documentElement.scrollWidth + ' zoom ' + (window.visualViewport ? visualViewport.scale.toFixed(2) : '?') + '\nclip ok ' + (window.CSS && CSS.supports('overflow-x', 'clip')) + ' touch ' + navigator.maxTouchPoints + '\n' + navigator.userAgent + '\nwider than window: ' + (wide.join(', ') || 'none'); document.body.appendChild(d); }, 3000); }); } try { autoFullscreen(); } catch (e) {} try { if (WEAK) quieten(false); /* the style sheet the chooser needs is written by quieten(); make sure it exists in Full too, without quietening anything */ else if (!document.getElementById('neuWeakCss')) { quieten(false); document.documentElement.classList.remove('is-lowfi', 'is-weak'); } if (document.readyState !== 'loading') offer(); else document.addEventListener('DOMContentLoaded', offer); if (!WEAK && store('neu-fx')) { window.addEventListener('load', function () { setTimeout(probe, 1500); }); } if (asks()) { document.documentElement.classList.add('is-lowfi'); } if (window.NEULowFi.isBox()) { document.documentElement.classList.add('is-neuonbox'); } } catch (e) {} })();