diff --git a/public/my.js b/public/my.js index 1403aa0..cd4b5f1 100644 --- a/public/my.js +++ b/public/my.js @@ -35,7 +35,10 @@ function pathId(){const m=location.pathname.match(/^\/my\/(\d+)$/);if(m)return m[1];const q=new URLSearchParams(location.search).get('id');if(q&&/^\d+$/.test(q))return q;try{return localStorage.getItem('ctb.myId')||''}catch(e){return ''}} - const treeUI={byId:{},parent:{},homeId:0,rootId:0,mode:'pyramid',zoom:null,_applied:1}; + const treeUI={byId:{},parent:{},depth:{},reach:7,homeId:0,rootId:0,mode:'pyramid',zoom:null,_applied:1}; + // Marty 2026-09-26: show only the generations this position can be paid from. A member at + // level L catches upgrades from generations 1..L (7 at most); deeper ones only confused people. + const reachOf=d=>Math.max(1,Math.min(7,Number(d&&d.level)||1)); // Zoom the matrix so it fits small screens. treeUI.zoom: null = auto-fit (shrink // to fit width, never enlarge), or a manual factor. Uses CSS `zoom` so the layout // reflows cleanly (no leftover box, centering + scroll keep working). @@ -62,7 +65,7 @@ if(fit)fit.addEventListener('click',()=>{treeUI.zoom=null;applyMatrixZoom()}); let t;window.addEventListener('resize',()=>{clearTimeout(t);t=setTimeout(()=>{if(treeUI.mode==='pyramid')applyMatrixZoom()},160)}); })(); - function indexTree(n,par){if(!n)return;treeUI.byId[n.id]=n;if(par)treeUI.parent[n.id]=par.id;indexTree(n.left,n);indexTree(n.right,n)} + function indexTree(n,par){if(!n)return;treeUI.byId[n.id]=n;treeUI.depth[n.id]=par?treeUI.depth[par.id]+1:0;if(par)treeUI.parent[n.id]=par.id;indexTree(n.left,n);indexTree(n.right,n)} function isSpill(n){return !!(n&&treeUI.parent[n.id]&&n.referrerId&&n.referrerId!==treeUI.parent[n.id])} function card(n,focus){ if(!n)return '