/* The NEUON knowledge graph. * * A core in the middle, eight large nodes — the chapters — wired to it and to * each other, and a small node for every published item hanging off the * chapters it touches. SSCIEX Open Day sits between NEUMotion, NEUStudio and * NEUTalents because it belongs to all three. As Backstage publishes, the * graph grows: no code change needed. * * Two rules keep it readable as it grows: * · the whole cloud is re-centred on its own middle, so it never drifts off * to one side of the frame no matter where the new dots land; * · a dot's size follows how many things it connects to, so the busiest * chapter is visibly the busiest. * * The same graph renders in every section. Only the copy on "We Teach, It * Learn" is interactive — elsewhere it is scenery, so it can't steal clicks * from the cards orbiting it. */ (function () { var host = document.querySelector('[data-netgraph]'); var dataEl = document.getElementById('graphData'); if (!host || !dataEl) return; var DATA; try { DATA = JSON.parse(dataEl.textContent); } catch (e) { return; } if (!DATA || !DATA.pillars) return; var NS = 'http://www.w3.org/2000/svg'; var reduced = matchMedia('(prefers-reduced-motion: reduce)').matches; var stageOpen = false; // while the big one is up, the rest are hidden behind it /* chapter → the colour it owns everywhere on the site */ var HUE = { neumotion:'#2f8fff', neunature:'#3ddc97', neucity:'#ffa53d', neufactory:'#b98cff', neuslm:'#38d9d3', neutalents:'#ff7ac8', neustudio:'#ffd54a', neustory:'#8ec5ff', }; var NAME = {}; DATA.pillars.forEach(function (p) { NAME[p.slug] = p.name; }); /* ---- the paint the orbs are made of ---- * A dot is a gaussian falloff (sigma = r/3) — what blurring the same circle * would give, but as a plain gradient fill. Two things had to be true: * * · one gradient per colour, not one colourless gradient used as a mask. * A mask puts every dot through its own offscreen buffer every frame and * cost this graph three quarters of its frame rate. * · defined once, here, in a container that is actually rendered. The * graph partial is included inside the credentials panel, which is * display:none until it opens, and a gradient found inside a hidden * subtree is not painted with — so nothing painted at all. */ (function defs() { if (document.getElementById('ngDefs')) return; var HUE = { motion:'#2f8fff', nature:'#3ddc97', city:'#ffa53d', factory:'#b98cff', slm:'#38d9d3', talents:'#ff7ac8', studio:'#ffd54a', story:'#8ec5ff', core:'#5cb2ff', hot:'#ffffff', mute:'#7c8ba1', }; var FADE = [[0,1],[26,0.95],[44,0.8],[58,0.55],[72,0.3],[86,0.1],[100,0]]; var out = '' + '' + ''; Object.keys(HUE).forEach(function (k) { out += '' + FADE.map(function (s) { return ''; }).join('') + ''; }); var svg = document.createElementNS(NS, 'svg'); svg.id = 'ngDefs'; svg.setAttribute('aria-hidden', 'true'); svg.setAttribute('style', 'position:absolute;width:0;height:0;overflow:hidden;pointer-events:none'); svg.innerHTML = '' + out + ''; document.body.appendChild(svg); })(); document.querySelectorAll('[data-netgraph]').forEach(build); function build(wrap) { var live = wrap.hasAttribute('data-live'); // only one is clickable var svg = wrap.querySelector('svg'); var gLink = wrap.querySelector('[data-glinks]'); var gNode = wrap.querySelector('[data-gnodes]'); if (!svg || !gNode) return; /* ---- the core, then the chapters on a sphere, items on a wider shell ---- */ var nodes = [], index = {}; nodes.push({ id: 'core', label: 'NEUON AI', hint: 'One core, eight chapters', big: true, core: true, state: 'core', href: null, x: 0, y: 0, z: 0, }); DATA.pillars.forEach(function (p, i) { var a = (i / DATA.pillars.length) * Math.PI * 2; var y = Math.sin(a * 1.7) * 0.55; nodes.push({ id: p.slug, label: p.name, hint: p.role, big: true, href: '/' + (p.slug === 'neuslm' ? 'neudoc' : p.slug), state: 'chapter', to: [p.slug], x: Math.cos(a) * 0.62, y: y, z: Math.sin(a) * 0.62, }); index[p.slug] = nodes.length - 1; }); (DATA.items || []).forEach(function (it) { // sit each item near the average of the chapters it belongs to var kin = it.to.map(function (s) { return nodes[index[s]]; }).filter(Boolean); var cx = 0, cy = 0, cz = 0; kin.forEach(function (k) { cx += k.x; cy += k.y; cz += k.z; }); var n = kin.length || 1; var jitter = function () { return (Math.random() - 0.5) * 0.5; }; nodes.push({ id: it.id, label: it.label, hint: it.when, big: false, href: it.href, state: it.active ? 'active' : 'past', to: it.to, kind: it.kind, x: cx / n * 1.5 + jitter(), y: cy / n * 1.5 + jitter(), z: cz / n * 1.5 + jitter(), }); }); /* ---- edges: core to every chapter, the chapter ring, then item to chapter ---- */ var edges = []; var P = DATA.pillars.length; for (var a2 = 0; a2 < P; a2++) { edges.push([0, a2 + 1]); // spokes out of the core edges.push([a2 + 1, (a2 + 1) % P + 1]); // the ring edges.push([a2 + 1, (a2 + 3) % P + 1]); // cross-links } nodes.forEach(function (nd, ni) { if (nd.big || !nd.to) return; nd.to.forEach(function (s) { if (index[s] !== undefined) edges.push([ni, index[s]]); }); }); /* ---- how many things each dot connects to: that is its size ---- */ var deg = nodes.map(function () { return 0; }); edges.forEach(function (e) { deg[e[0]]++; deg[e[1]]++; }); /* sized against the busiest chapter rather than a fixed number, so the spread stays readable whether there are ten items or two hundred */ var topDeg = 1; nodes.forEach(function (nd, i) { if (nd.big && !nd.core) topDeg = Math.max(topDeg, deg[i]); }); /* ---- recentre and rescale, so the cloud always fills the same frame ---- Without this, a chapter that gains ten items drags the whole picture off to its side of the circle. */ (function fit() { var live2 = nodes.slice(1); // the core defines nothing if (!live2.length) return; var mx = 0, my = 0, mz = 0; live2.forEach(function (p) { mx += p.x; my += p.y; mz += p.z; }); mx /= live2.length; my /= live2.length; mz /= live2.length; var far = 0; nodes.forEach(function (p) { p.x -= mx; p.y -= my; p.z -= mz; far = Math.max(far, Math.sqrt(p.x * p.x + p.y * p.y + p.z * p.z)); }); var k = far > 0.001 ? 1.3 / far : 1; // fills the frame, still inside it nodes.forEach(function (p) { p.x *= k; p.y *= k; p.z *= k; }); nodes[0].x = nodes[0].y = nodes[0].z = 0; // the core holds the middle })(); var lineEls = edges.map(function (e) { var l = document.createElementNS(NS, 'line'); if (nodes[e[0]].core || nodes[e[1]].core) l.setAttribute('class', 'is-spoke'); gLink.appendChild(l); return l; }); var clickable = live && wrap.dataset.stage; var nodeEls = nodes.map(function (nd, ni) { var g = document.createElementNS(NS, 'g'); g.setAttribute('class', 'ngnode is-' + nd.state + (nd.big ? ' is-big is-' + nd.id : '') + (deg[ni] >= 4 ? ' is-hub' : '')); /* an orb, not a disc: a wide coloured glow, a hot white middle, and an invisible circle carrying the click — the glow has no edge to aim at */ var bl = document.createElementNS(NS, 'circle'); bl.setAttribute('class', 'ngdot__glow'); var orb = document.createElementNS(NS, 'circle'); orb.setAttribute('class', 'ngdot__hot'); var c = document.createElementNS(NS, 'circle'); c.setAttribute('class', 'ngdot'); g.appendChild(bl); g.appendChild(orb); g.appendChild(c); if (clickable && !nd.core) { g.setAttribute('tabindex', '0'); g.setAttribute('role', 'link'); g.setAttribute('aria-label', nd.label + (nd.hint ? ' — ' + nd.hint : '')); /* the dot and its row on the right are the same thing, so they do the same thing — a chapter still opens its page, an item opens its panel */ g.addEventListener('click', function () { hit(nd); }); g.addEventListener('keydown', function (e) { if (e.key === 'Enter') { e.preventDefault(); hit(nd); } }); g.addEventListener('mouseenter', function () { tip(nd, g); }); g.addEventListener('mouseleave', hideTip); g.addEventListener('focus', function () { tip(nd, g); }); g.addEventListener('blur', hideTip); } else if (clickable && nd.core) { g.addEventListener('mouseenter', function () { tip(nd, g); }); g.addEventListener('mouseleave', hideTip); } gNode.appendChild(g); return { g: g, c: c, orb: orb, bl: bl, d: nd }; }); wrap.classList.add('is-built'); // the shell may show now /* ---- the label that follows the pointer ---- Every dot has to say what it is and which chapters it belongs to — an unlabelled dot is just decoration. */ var tipEl = wrap.querySelector('[data-gtip]'); function tip(nd, g) { if (!tipEl) return; var html = '' + esc(nd.label) + ''; if (nd.hint) html += '' + esc(nd.hint) + ''; var tags = (nd.to || []).filter(function (s) { return NAME[s]; }); if (tags.length) { html += '' + tags.map(function (s) { return '' + esc(NAME[s]) + ''; }).join('') + ''; } if (nd.href && !nd.core) html += '' + (nd.big ? 'Click to open →' : 'Click to read →') + ''; tipEl.innerHTML = html; tipEl.hidden = false; var b = g.getBoundingClientRect(), w = wrap.getBoundingClientRect(); var x = b.left - w.left + b.width / 2; var y = b.top - w.top - 10; // flip below the dot rather than run off the top of the panel tipEl.classList.toggle('is-below', b.top - w.top < 90); tipEl.style.left = x + 'px'; tipEl.style.top = (tipEl.classList.contains('is-below') ? y + b.height + 22 : y) + 'px'; } function hideTip() { if (tipEl) tipEl.hidden = true; } function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); } /* ---- spin, and a tilt you can drag ---- Two rotations, not one: yaw turns the ball, pitch tips it towards or away from you. Without the second axis it is a spinning picture rather than an object you are holding. */ var spin = 0, tilt = 0; wrap._turn = function (dx, dy) { spin += dx; tilt = Math.max(-1.15, Math.min(1.15, tilt + dy)); // don't let it flip over draw(); // answer the input now, not on the next frame }; function draw() { var cos = Math.cos(spin), sin = Math.sin(spin); var cosT = Math.cos(tilt), sinT = Math.sin(tilt); var proj = nodes.map(function (p) { var x = p.x * cos - p.z * sin; // yaw var z1 = p.x * sin + p.z * cos; var y = p.y * cosT - z1 * sinT; // pitch var z = p.y * sinT + z1 * cosT; var d = (z + 1) / 2; return { x: 100 + x * 62, y: 100 + y * 62, d: d }; }); nodeEls.forEach(function (n, i) { var p = proj[i]; // size is how much a dot carries; depth only leans on it a little, // so "busiest is biggest" survives the spin var r = n.d.core ? 5.4 : n.d.big ? 2.4 + 4.4 * (deg[i] / topDeg) : 1.0 + 0.55 * Math.min(3, deg[i]); r *= 0.86 + p.d * 0.28; var x = p.x.toFixed(1), y = p.y.toFixed(1); n.c.setAttribute('cx', x); n.c.setAttribute('cy', y); n.c.setAttribute('r', r.toFixed(2)); n.orb.setAttribute('cx', x); n.orb.setAttribute('cy', y); n.orb.setAttribute('r', (r * 0.62).toFixed(2)); n.bl.setAttribute('cx', x); n.bl.setAttribute('cy', y); n.bl.setAttribute('r', (r * 2.4).toFixed(2)); n.g.setAttribute('opacity', n.d.core ? 1 : ((n.d.big ? 0.5 : 0.3) + p.d * 0.5).toFixed(2)); }); edges.forEach(function (e, i) { var a = proj[e[0]], b = proj[e[1]]; lineEls[i].setAttribute('x1', a.x.toFixed(1)); lineEls[i].setAttribute('y1', a.y.toFixed(1)); lineEls[i].setAttribute('x2', b.x.toFixed(1)); lineEls[i].setAttribute('y2', b.y.toFixed(1)); lineEls[i].setAttribute('opacity', (0.06 + Math.min(a.d, b.d) * 0.4).toFixed(2)); }); } /* ---- picking chapters ---- Give it a set of slugs and everything outside them greys out and stops being clickable, so a presenter can say "just NEUMotion and NEUStudio" and have the ball answer. An empty set means everything is live again. */ wrap._pick = function (set) { var lit = function (nd) { if (!set || !set.size || nd.core) return true; if (nd.big) return set.has(nd.id); return (nd.to || []).some(function (s) { return set.has(s); }); }; nodeEls.forEach(function (n) { n.g.classList.toggle('is-off', !lit(n.d)); }); edges.forEach(function (e, i) { lineEls[i].classList.toggle('is-off', !(lit(nodes[e[0]]) && lit(nodes[e[1]]))); }); draw(); // answer the input now, not on the next frame }; /* Keep only these dots, by their own id rather than by chapter. `_pick` answers "show me NEUMotion"; this answers "show me RoadPlus", which is a different question — the thing being named is one item on the ball, not one of the eight. The chapters those items hang off stay lit too, or the survivors float unattached to anything. */ wrap._only = function (ids, slugs) { var lit = function (nd) { if (!ids || !ids.size || nd.core) return true; if (nd.big) return !!(slugs && slugs.has(nd.id)); return ids.has(nd.id); }; nodeEls.forEach(function (n) { n.g.classList.toggle('is-off', !lit(n.d)); }); edges.forEach(function (e, i) { lineEls[i].classList.toggle('is-off', !(lit(nodes[e[0]]) && lit(nodes[e[1]]))); }); draw(); }; /* Light one dot by id. The list beside the ball calls this on hover, so running an eye down the names lights the matching dots — which is what makes the two halves of the panel read as one thing. */ wrap._hover = function (id) { nodeEls.forEach(function (n) { n.g.classList.toggle('is-hover', n.d.id === id); }); }; /* the teach section fires bolts at real dots, so it needs to know where they are on screen right now */ wrap._dots = function () { return nodeEls.filter(function (n) { return !n.d.core; }); }; /* This one takes a node OBJECT, and it used to be called `_flash` as well — so it quietly replaced the by-id version above, and the list's hover handler had been passing a string to a function expecting `{ g }` and throwing on every row it touched. Two jobs, two names. */ wrap._flash = function (n) { if (!n || !n.g) return; n.g.classList.remove('is-lit'); void n.g.getBBox; n.g.classList.add('is-lit'); setTimeout(function () { n.g.classList.remove('is-lit'); }, 700); }; if (reduced) { draw(); return; } /* Only the graph you are looking at is worth drawing. Nine copies of this spinning at once — one per section, plus the dome, the pack and the opened stage — put ~5000 attribute writes a frame through the DOM and cost two thirds of the frame rate, all of it on graphs scrolled well off the screen. */ var onScreen = true; if (window.IntersectionObserver) { onScreen = false; new IntersectionObserver(function (es) { onScreen = es[0].isIntersecting; wrap._resume(); }, { rootMargin: '120px' }).observe(wrap); } function visible() { return onScreen && (!stageOpen || !!wrap.dataset.stage); } var running = false; function loop() { if (running && !visible()) { running = false; return; } // park it running = true; if (!document.hidden) { spin += 0.0028; draw(); } requestAnimationFrame(loop); } wrap._resume = function () { if (!running && visible()) requestAnimationFrame(loop); }; draw(); // one frame, so it is never blank loop(); /* ---- a charge runs along an edge, then both ends flare ---- */ function pulse() { if (document.hidden || !visible() || !edges.length) return; var i = Math.floor(Math.random() * edges.length); var e = edges[i]; [nodeEls[e[0]], nodeEls[e[1]]].forEach(wrap._flash); var l = lineEls[i]; if (l) { l.classList.add('is-charged'); setTimeout(function () { l.classList.remove('is-charged'); }, 700); } } /* ---- a charge sent somewhere in particular ---- * `pulse` picks an edge at random, which is right for idle scenery and * wrong for Section 1: there the ball is ANNOUNCING a chapter, so the * charge has to leave the core and arrive at that chapter, in that * chapter's own colour. Same wires, same flare, aimed rather than * scattered. */ wrap._zapTo = function (slug, colour) { if (!edges.length) return false; var target = -1; nodes.forEach(function (nd, i) { if (nd.big && nd.id === slug) target = i; }); if (target < 0) return false; var hit = -1; edges.forEach(function (e, i) { if (hit > -1) return; var a = nodes[e[0]], b = nodes[e[1]]; if ((a.core && e[1] === target) || (b.core && e[0] === target)) hit = i; }); if (hit < 0) return false; var l = lineEls[hit]; if (!l) return false; l.style.stroke = colour || '#fff'; l.style.filter = 'drop-shadow(0 0 5px ' + (colour || '#fff') + ') drop-shadow(0 0 12px ' + (colour || '#fff') + ')'; l.classList.add('is-charged', 'is-aimed'); wrap._flash(nodeEls[target]); setTimeout(function () { l.classList.remove('is-charged', 'is-aimed'); l.style.stroke = ''; l.style.filter = ''; }, 700); return true; }; /* THE IDLE PULSE IS SCENERY, AND SCENERY CAN BE TURNED OFF. * * Every ball on the page fires a charge along a random wire every 1.4 * seconds. On the seven that are decoration that is exactly right — it is * what stops them looking like a still image. * * The one in Section 1 is not decoration: it is announcing a chapter, with * an aimed charge in that chapter's colour. Left running, the random white * ones fired straight through the announcement, so Section 1 looked like * it was doing Section 2's job as well as its own. It can now be switched * off for the one ball that has something to say. */ var idle = setInterval(pulse, 1400); wrap._idleOn = true; // readable, so which balls idle can be checked wrap._idle = function (on) { clearInterval(idle); idle = on ? setInterval(pulse, 1400) : null; wrap._idleOn = !!on; }; wrap._pulse = pulse; wrap._nodes = nodes; } /* ---- the doorway: the section copy opens the full-size stage ---- */ var stage = document.querySelector('[data-graphstage]'); var doorway = document.querySelector('[data-netgraph][data-live]'); if (!stage || !doorway) return; var view = stage.querySelector('[data-gview]'); var zoomOut = stage.querySelector('[data-gzoom="-1"]'); var zoomIn = stage.querySelector('[data-gzoom="1"]'); var zoomVal = stage.querySelector('[data-gzoomval]'); var built = false, zoom = 1; function setZoom(z) { zoom = Math.max(0.6, Math.min(3, z)); var inner = view.firstElementChild; if (inner) inner.style.transform = 'scale(' + zoom + ')'; if (zoomVal) zoomVal.textContent = Math.round(zoom * 100) + '%'; } /* ---- the chapter picker ---- * Eight buttons in the chapter colours. Press one and the ball keeps only * that chapter's dots; press a second and you get both. Press again to let * it go. Nothing selected means everything is on, which is the resting * state — so the picker never has to be "cleared" before it looks normal. */ var stageGraph = null; var picked = new Set(); var pickBar = stage.querySelector('[data-gpick]'); /* opened from a chapter page, the ball starts on that chapter — you asked to see the constellation from where you already are */ if (stage.dataset.here) picked.add(stage.dataset.here); /* ---- the list beside the ball ---- Same items, written out. It follows the picker: nothing selected lists everything, one chapter selected lists that chapter's, two lists both. A dot tells you how much there is; only words tell you what it is. */ var listBox = stage.querySelector('[data-glistitems]'); var listTitle = stage.querySelector('[data-glisttitle]'); var listCount = stage.querySelector('[data-glistcount]'); var listEmpty = stage.querySelector('[data-glistempty]'); /* ── ONE THING, AS THE POPUP WANTS IT ── Taufik: "pressing the right side, currently all go to NEUStory. change it, make it pop-up the story/news/etc." Every card on the ball carried href:'/news', so all thirty-two rows threw you onto the same page and left you to find the one you had pressed. They open the site's own card popup now — the same panel the chapter pages use, not a second one built to look like it. Built here, once, because the row on the right and the dot on the ball are the same thing and must not answer differently. */ function asCard(it) { var where = (it.to || []).map(nameOf).join(' · '); /* ── A STORY, IN FULL ── Taufik, 14 October 2026: "the information is not complete as (2). With the link to the news". A story on the ball now opens the way it does on the timeline: the date and its kind, every write-up by name with its address, the chapters it is in, and a Share button. The server sends `story` for story cards only; films and brochures are as they were. */ var st = it.story || null; var links = st && Array.isArray(st.links) ? st.links : []; return { kicker: kindLabel(it.kind), title: it.label || '', sub: st ? (it.partner ? 'With ' + it.partner : '') : where, meta: st ? st.meta : [it.when, it.partner].filter(Boolean).join(' · '), body: it.body || '', imgs: it.photo ? [{ src: it.photo, alt: it.label || '' }] : [], /* the record wins; a chapter item keeps its own address; and a story with neither still offers the gallery it lives in. A story whose write-ups are listed below has no button repeating the first one. */ href: links.length ? '' : (it.source || (/^\/news$/.test(it.href || '') ? '' : it.href) || ''), cta: links.length ? '' : (it.source ? 'Read the record ↗' : (it.href && it.href !== '/news' ? 'Open →' : '')), links: links, story: st ? { id: st.id, url: st.url, /* real chapters only: a slug that is no chapter any more is never a link that answers 404 */ chapters: (it.to || []).filter(function (s) { return (DATA.pillars || []).some(function (x) { return x.slug === s; }); }).map(function (s) { return { slug: s, name: nameOf(s) }; }), } : null, }; } /* A FUNCTION, NOT A `var` OBJECT. Everything from here down sits after an early `return` a few lines up — the one for pages that draw the ball as scenery with no stage around it. Function declarations survive that; a `var` does not, and `KIND[...]` would have thrown on exactly those pages and nowhere else. */ function kindLabel(k) { return ({ news: 'News', award: 'Achievement', milestone: 'Milestone', event: 'Event', video: 'Film', paper: 'Paper', brochure: 'Brochure', profile: 'Profile', })[k] || (k ? String(k) : 'On the ball'); } /* a thing that is only a link — a film, a brochure — has nothing to read, so the panel would open empty. Those keep going where they point. */ function hasStory(it) { return !!((it.body && it.body.trim()) || it.photo); } /* `from` is what the reader actually pressed — a row in the list beside the graph, usually. The popup flies a copy of it to the middle rather than appearing there, so the row and the panel read as one thing. A dot on the ball has no `from` worth flying: it is a five-pixel circle, and a five-pixel circle growing into a panel looks like a fault. arrive.js takes null and simply settles the panel in. */ function openThing(it, from) { if (hasStory(it) && window._openCard) { window._openCard(asCard(it), from || null); return true; } if (it.href) { location.href = it.href; return true; } return false; } /* A DOT IS THE SAME THING AS ITS ROW, so pressing it does the same thing. A chapter still opens its page — that is what a chapter dot is for. An item finds itself in the data and opens its panel; the node only carries what the ball needs to draw it, not the story. */ function hit(nd) { if (!nd || nd.core) return; if (nd.big) { if (nd.href) location.href = nd.href; return; } var it = (DATA.items || []).find(function (x) { return x.id === nd.id; }); if (it) openThing(it); else if (nd.href) location.href = nd.href; } function nameOf(slug) { var p = (DATA.pillars || []).find(function (x) { return x.slug === slug; }); return p ? p.name : slug; } /* A search narrows the same list a different way: not "which chapter" but "which thing". Set by the microphone — "hey NEU, find RoadPlus" — and it takes precedence over the chapter buttons while it lasts, because it is the more specific of the two answers. */ var search = null; // { text: 'RoadPlus', ids: Set } function renderList() { if (!listBox) return; var items = (DATA.items || []).filter(function (it) { if (search) return search.ids.has(it.id); if (!picked.size) return true; return (it.to || []).some(function (s) { return picked.has(s); }); }); listTitle.textContent = search ? '“' + search.text + '”' : picked.size ? Array.from(picked).map(nameOf).join(' + ') : 'Everything on the ball'; listCount.textContent = items.length + (items.length === 1 ? ' thing' : ' things'); listEmpty.hidden = items.length > 0; listEmpty.textContent = search ? 'Nothing on the ball matches “' + search.text + '”.' : 'Nothing here yet. Anything a team publishes turns up on this list.'; listBox.textContent = ''; items.forEach(function (it) { var li = document.createElement('li'); /* a button, not a link, when it opens a panel: an promises a page, and the browser's own "open in new tab" would break that promise by loading /news. A thing that really is a link stays one. */ var opens = hasStory(it); var a = document.createElement(opens ? 'button' : 'a'); if (opens) { a.type = 'button'; } else { a.href = it.href || '/news'; } a.className = 'glist__item' + (it.active ? ' is-active' : ''); if (opens) a.addEventListener('click', function () { openThing(it, a); }); /* one pip per chapter it belongs to — this is where a thing shared between two chapters becomes obvious rather than implied */ var pips = document.createElement('span'); pips.className = 'glist__pips'; (it.to || []).forEach(function (s) { var i = document.createElement('i'); i.style.background = HUE[s] || '#8ec5ff'; i.title = nameOf(s); pips.appendChild(i); }); var txt = document.createElement('span'); txt.className = 'glist__txt'; var b = document.createElement('b'); b.textContent = it.label || ''; txt.appendChild(b); /* `when` is a free-text detail line and it is often just the chapter name again, which read as "NEUCity — NEUCity · NEUStudio". Drop it when the chapter list already says the same thing. */ var where = (it.to || []).map(nameOf).join(' · '); var when = (it.when || '').trim(); if (when && where.toLowerCase().indexOf(when.toLowerCase()) > -1) when = ''; var meta = [when, where].filter(Boolean).join(' — '); if (meta) { var em = document.createElement('em'); em.textContent = meta; txt.appendChild(em); } a.appendChild(pips); a.appendChild(txt); if (it.active) { var now = document.createElement('span'); now.className = 'glist__now'; now.textContent = 'now'; a.appendChild(now); } /* hovering a row flashes its dot, so the two halves of the panel are obviously the same set rather than two lists that happen to agree */ a.addEventListener('mouseenter', function () { if (stageGraph && stageGraph._hover) stageGraph._hover(it.id); }); li.appendChild(a); listBox.appendChild(li); }); } function buildPicker() { if (!pickBar || pickBar.childElementCount) return; DATA.pillars.forEach(function (p) { var b = document.createElement('button'); b.type = 'button'; b.className = 'gpick__btn is-' + p.slug; b.style.setProperty('--c', HUE[p.slug] || '#8ec5ff'); b.textContent = p.name; b.classList.toggle('is-on', picked.has(p.slug)); b.setAttribute('aria-pressed', picked.has(p.slug) ? 'true' : 'false'); b.addEventListener('click', function () { search = null; // a hand on the buttons outranks a voice if (picked.has(p.slug)) picked.delete(p.slug); else picked.add(p.slug); b.classList.toggle('is-on', picked.has(p.slug)); b.setAttribute('aria-pressed', picked.has(p.slug) ? 'true' : 'false'); pickBar.classList.toggle('has-pick', picked.size > 0); if (stageGraph && stageGraph._pick) stageGraph._pick(picked); renderList(); }); pickBar.appendChild(b); }); pickBar.classList.toggle('has-pick', picked.size > 0); var all = document.createElement('button'); all.type = 'button'; all.className = 'gpick__all'; all.textContent = 'Show all'; all.addEventListener('click', function () { search = null; picked.clear(); pickBar.querySelectorAll('.gpick__btn').forEach(function (b) { b.classList.remove('is-on'); b.setAttribute('aria-pressed', 'false'); }); pickBar.classList.remove('has-pick'); if (stageGraph && stageGraph._pick) stageGraph._pick(picked); renderList(); }); pickBar.appendChild(all); } /* ---- drag to turn it ---- */ function armDrag() { var from = null; view.addEventListener('pointerdown', function (e) { if (e.target.closest('.ngnode')) return; // a dot is a link, not a handle from = { x: e.clientX, y: e.clientY }; view.setPointerCapture(e.pointerId); view.classList.add('is-turning'); }); view.addEventListener('pointermove', function (e) { if (!from || !stageGraph || !stageGraph._turn) return; stageGraph._turn((e.clientX - from.x) * 0.008, (e.clientY - from.y) * -0.006); from = { x: e.clientX, y: e.clientY }; }); ['pointerup', 'pointercancel', 'pointerleave'].forEach(function (ev) { view.addEventListener(ev, function () { from = null; view.classList.remove('is-turning'); }); }); } function open() { if (!built) { // a second copy of the same graph, big enough to hit, and clickable var big = doorway.cloneNode(true); big.classList.add('netgraph--stage'); // the doorway may be mid-charge when it is cloned, and a copied state // class has nothing to take it off again — the wires stayed white big.classList.remove('is-charging'); big.setAttribute('data-stage', '1'); big.querySelectorAll('[data-glinks],[data-gnodes],[data-gzaps]').forEach(function (g) { g.innerHTML = ''; }); view.appendChild(big); build(big); stageGraph = big; buildPicker(); armDrag(); built = true; } if (stageGraph && stageGraph._pick) stageGraph._pick(picked); renderList(); stageOpen = true; // everything else is behind it now /* ── IT ARRIVES THE WAY EVERY OTHER BOX ON THE SITE DOES ── The doorway — the small graph in the section — turns, flies to the middle and stops; only then does the page behind go soft and the stage take its place. One order, four boxes: see public/assets/js/arrive.js. The doorway is a graph rather than a card, and that is the point. It is what was pressed, so it is what travels; the reader watches the small constellation become the big one instead of watching it be replaced. */ /* IT ALWAYS OPENS ON THE BALL. The diagram is a thing Dr KC turns TO mid-sentence; a stage that reopened on whatever was last showing would have him pressing a button to get back to the thing he came for. Above the two paths below, because it is true of both. */ showTech(false); if (!window.NEUArrive) { stage.hidden = false; stage.classList.add('is-veiled', 'is-here'); document.body.style.overflow = 'hidden'; setZoom(1); resumeAll(); return; } window.NEUArrive.open({ from: doorway, root: stage, panel: stage.querySelector('.gstage__panel'), done: function () { setZoom(1); resumeAll(); }, }); /* the zoom is set on the way in as well as on arrival: the stage is measured before the flight, and a stage measured at the last zoom is measured at the wrong size */ setZoom(1); } function close() { stageOpen = false; if (!window.NEUArrive) { stage.classList.remove('is-veiled', 'is-here'); stage.hidden = true; document.body.style.overflow = ''; resumeAll(); return; } window.NEUArrive.close({ root: stage, panel: stage.querySelector('.gstage__panel'), from: doorway, done: resumeAll, }); } function resumeAll() { document.querySelectorAll('[data-netgraph]').forEach(function (w) { if (w._resume) w._resume(); }); } doorway.classList.add('netgraph--door'); doorway.setAttribute('role', 'button'); doorway.setAttribute('tabindex', '0'); doorway.setAttribute('aria-label', 'Open the knowledge graph'); doorway.addEventListener('click', open); doorway.addEventListener('keydown', function (e) { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); open(); } }); /* The words under the ball are the other door. People read AI CORE, decide that is the thing they want, and press the label rather than the picture above it — so the label opens the same stage. It is a real