Each section carried its own copy of the header: Home's nav had no Home, the docs' nav had no Docs, the research post had no star or theme button, and the generated Alpha Library pages had no header at all. Only the docs could switch language, and they guessed Chinese from the browser while every other page stayed English. - partials/ holds one head block, header and footer; sync_site_chrome.py writes them into every page between markers and, with --check in CI, also requires <body data-section> (the current section is highlighted by CSS), the language attributes and a single ?v= token site-wide. The Alpha Library generator inserts the same partials. - site.js is the shared shell (theme, stars, language, footer traffic on home only). English is the HTML; Chinese comes from locales/zh.json via data-i18n hooks, and check_i18n.py fails on a key with no Chinese or a Chinese string nothing uses. A URL that names a language (/docs/zh/, the two articles) shows it and remembers it; everything else follows the stored choice, English by default. theme-init.js keeps a page hidden until its Chinese text is in, so it never flashes English. - English tutorial and Chinese research post added. The Chinese tutorial gets the corrections its translation surfaced: 462 alphas in five zoos, AAPL.US, the mandate caps trades per day (it has no daily loss limit), Shadow Account extracts up to five rules, the web UI needs Docker or a checkout. - Alpha Library: the zoo pages were never deployed — content/ is gitignored and nothing built it, so every zoo link served the root redirect. The deploy now exports the manifest and renders the pages (and redeploys when agent/src/factors changes); the fifth zoo, fundamental, is listed; generated pages allow same-origin scripts only. - Phones keep the nav as a scrollable row instead of hiding it.
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
import { initSite } from "/site.js?v=20260929d";
|
|
|
|
// Home page install tabs; a no-op on pages without them.
|
|
function initInstallTabs() {
|
|
const tabs = Array.from(document.querySelectorAll("[data-tab]"));
|
|
if (!tabs.length) return;
|
|
|
|
for (const tab of tabs) {
|
|
tab.addEventListener("click", () => {
|
|
const key = tab.getAttribute("data-tab");
|
|
for (const item of tabs) {
|
|
const selected = item === tab;
|
|
item.setAttribute("aria-selected", String(selected));
|
|
const panelId = item.getAttribute("aria-controls");
|
|
if (panelId) {
|
|
const panel = document.getElementById(panelId);
|
|
if (panel) panel.hidden = !selected;
|
|
}
|
|
}
|
|
if (key) {
|
|
try {
|
|
localStorage.setItem("vibetrading-install-tab", key);
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
try {
|
|
const saved = localStorage.getItem("vibetrading-install-tab");
|
|
const selected = tabs.find((tab) => tab.getAttribute("data-tab") === saved);
|
|
if (selected) selected.click();
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
}
|
|
|
|
initSite();
|
|
initInstallTabs();
|