sirius/js/site-footer.js
Local Dev 94bf3bcf68 feat(sirius-x): merge register.html into landing via shared mint flow
Register.html and the landing were running duplicate name-search UIs.
The register one was reported broken; the landing one already works
inline. Merged both into the landing:

- New js/register-flow.js — the full mint modal + wallet setup (Create /
  Import / Unlock / WizardConnect / Fund / Confirm / Register / Point
  it somewhere) extracted from register.html's <script type='module'>
  and turned into a shared module. Injects its own scoped modal HTML +
  CSS into the host page on load and exposes
  window.siriusRegisterName(fullName) as its public entry point.

- Landing search results now have Register buttons that call the shared
  flow directly. The whole 'search -> pick name -> mint' journey stays
  on one page, no redirects, no duplicate search UI to maintain.

- register.html reduced to a redirect stub: preserves ?q= if present,
  refreshes/JS-forwards to './' (landing), and shows a one-line
  'Name search moved to the home page' fallback for JS-off users.
  Old links keep working; no /register.html deep links are broken.

- All nav 'Register' entries now point at './#search-input' (or
  '../#search-input' on subpages), scrolling straight to the landing
  search box. Footer injector and every internal href updated the
  same way. Zero live href='.../register.html' left in the tree.

Verified: register.html?q=hello redirects to /?q=hello; landing
search 'fresh42abc' -> Register button -> modal opens with
'Register fresh42abc.bch' at the wallet-choice step.
2026-09-07 22:36:02 +02:00

99 lines
5.3 KiB
JavaScript

// Injects the Sirius.X site footer into the current page. Every page in
// site-sirius-x/ ships an empty <footer id="site-footer"></footer> and a
// `<script defer src=".../js/site-footer.js">` include — this file paints
// the four-column layout, meta row, and CSS once, so nav changes stay
// single-source.
//
// Base URL detection: the nav's brand link is already set with the right
// relative path per page (./ at root, ../ in subdirs). Reuse it as the base
// for every same-site href, so root pages and subdir pages both link to the
// right destinations without the script needing to know its own depth.
(() => {
const mount = document.getElementById("site-footer");
if (!mount) return;
const brand = document.querySelector(".topnav .brand");
const base = (brand?.getAttribute("href") || "./").replace(/index\.html$/, "");
// Same-site link builder — prefixes the current-page base so ./docs/ becomes
// ./docs/ from root and ../docs/ from a subdir.
const s = (path) => base + path;
mount.className = "site-footer";
mount.innerHTML = `
<div class="cols">
<div class="brand-col">
<div class="mark">⭐</div>
<h4>Sirius<span class="g">.X</span></h4>
<p>The home for names on Bitcoin Cash. Register a TLD, register a name, verify anything against the chain.</p>
</div>
<div>
<h5>Product</h5>
<ul>
<li><a href="${s("#search-input")}">🪪 Register a name</a></li>
<li><a href="${s("tld.html")}">🌐 Register a TLD</a></li>
<li><a href="${s("portal.html")}">🔑 My names portal</a></li>
<li><a href="${s("theseus/")}">🧭 Theseus browser</a></li>
</ul>
</div>
<div>
<h5>Learn</h5>
<ul>
<li><a href="${s("docs/")}">📚 Docs</a></li>
<li><a href="${s("#roadmap")}">🗺 Roadmap</a></li>
<li><a href="${s("#pantheon")}">🏛 The Pantheon</a></li>
<li><a href="${s("brand/")}">🎨 Brand kit</a></li>
</ul>
</div>
<div>
<h5>Silent Mode</h5>
<ul>
<li><a href="https://silentmode.st/" rel="noopener">silentmode.st <span class="ext">↗</span></a></li>
<li><a href="https://silentmode.st/tlds/" rel="noopener">TLD registry <span class="ext">↗</span></a></li>
<li><a href="https://silentmode.st/bns/theseus.x/" rel="noopener">theseus.x downloads <span class="ext">↗</span></a></li>
<li><a href="https://silentmode.st/bns/hephaestus.x/" rel="noopener">hephaestus.x forge <span class="ext">↗</span></a></li>
</ul>
</div>
</div>
<div class="meta">
<span><span class="footer-badge">Alpha</span>Chipnet only. You hold your own keys; verify everything against the chain.</span>
<span>© 2026 · MIT-licensed content · <a href="${s("brand/")}">brand assets</a></span>
</div>
`;
// Inline CSS — kept out of every page's <style> block so the footer stays
// single-source and consistent. Uses the CSS variables every page already
// sets on :root (so any page's palette applies automatically).
if (!document.getElementById("site-footer-css")) {
const css = document.createElement("style");
css.id = "site-footer-css";
css.textContent = `
footer.site-footer{background:linear-gradient(180deg,transparent,rgba(255,255,255,.015));
border-top:1px solid var(--line);padding:3.2rem 1.2rem 2rem;margin-top:3rem;color:var(--mut)}
footer.site-footer .cols{max-width:980px;margin:0 auto;display:grid;
grid-template-columns:1.4fr repeat(3,1fr);gap:2.2rem}
@media (max-width:760px){ footer.site-footer .cols{grid-template-columns:1fr 1fr;gap:1.6rem} }
@media (max-width:440px){ footer.site-footer .cols{grid-template-columns:1fr} }
footer.site-footer .brand-col .mark{font-size:26px;line-height:1;margin-bottom:.4rem}
footer.site-footer .brand-col h4{color:var(--ink);font-size:15px;font-weight:600;margin:0 0 .35rem;letter-spacing:.2px}
footer.site-footer .brand-col h4 .g{color:var(--acid)}
footer.site-footer .brand-col p{font-size:12.5px;color:var(--dim);max-width:260px;margin:0}
footer.site-footer h5{color:var(--ink);font-size:11.5px;font-weight:600;text-transform:uppercase;
letter-spacing:.6px;margin:0 0 .8rem}
footer.site-footer ul{list-style:none;padding:0;margin:0;display:grid;gap:.55rem}
footer.site-footer ul a{color:var(--mut);text-decoration:none;font-size:13.5px;transition:color .1s}
footer.site-footer ul a:hover{color:var(--acid)}
footer.site-footer ul a .ext{color:var(--dim);font-size:11px;margin-left:2px}
footer.site-footer .meta{max-width:980px;margin:2.4rem auto 0;padding-top:1.4rem;
border-top:1px solid var(--line);display:flex;flex-wrap:wrap;gap:.6rem 1.2rem;
font-size:12px;color:var(--dim);justify-content:space-between;align-items:center}
footer.site-footer .meta a{color:var(--mut);text-decoration:none}
footer.site-footer .meta a:hover{color:var(--acid)}
footer.site-footer .footer-badge{display:inline-block;padding:2px 8px;border-radius:999px;
background:rgba(255,199,95,.13);color:var(--warn);font-size:10.5px;font-weight:600;
text-transform:uppercase;letter-spacing:.4px;margin-right:.5rem}
`;
document.head.appendChild(css);
}
})();