| |
| |
| |
| |
| |
| |
|
|
| (function () { |
| 'use strict'; |
|
|
| |
| const LINKS = [ |
| { key: 'home', href: 'index.html', label: 'Home' }, |
| { key: 'models', href: 'models.html', label: 'Models' }, |
| { key: 'pricing', href: 'pricing.html', label: 'Pricing' }, |
| { key: 'docs', href: 'docs.html', label: 'Docs' }, |
| { key: 'faq', href: 'faq.html', label: 'FAQ' }, |
| { key: 'dashboard', href: 'dashboard.html', label: 'Dashboard' }, |
| ]; |
|
|
| const ENDPOINT = 'https://apiarium-labs.hf.space/v1/chat/completions'; |
| const PROVIDERS = ['Claude', 'DeepSeek', 'MiniMax', 'MiMo', 'Gemini', 'GLM', |
| 'Qwen', 'NVIDIA', 'Kimi', 'Grok', 'Ollama', 'OpenRouter']; |
|
|
| function navHtml(current) { |
| const items = LINKS.map(l => |
| `<li><a href="${l.href}"${l.key === current ? ' aria-current="page"' : ''}>${l.label}</a></li>` |
| ).join(''); |
| return ` |
| <a class="skip-link" href="#main">Skip to content</a> |
| <nav class="site-nav" aria-label="Primary"> |
| <span class="nav-brand" data-page-root> |
| <img class="nav-logo" src="assets/svg/logo.svg?v=2" alt="" /> |
| <span class="nav-brand-text"> |
| <span class="brand-name">DreamRouter</span> |
| <span class="brand-sub">by Apiarium labs</span> |
| </span> |
| </span> |
| <ul class="nav-links">${items}</ul> |
| <a class="nav-cta" href="login.html" id="nav-auth">Sign in</a> |
| </nav>`; |
| } |
|
|
| function footerHtml() { |
| const provs = PROVIDERS.map(p => `<span>${p}</span>`).join(''); |
| const year = new Date().getFullYear(); |
| return ` |
| <footer class="footer"> |
| <div class="container"> |
| <p class="made">DreamRouter · one endpoint, every model</p> |
| <p class="byline">by Apiarium labs</p> |
| <div class="providers">${provs}</div> |
| <nav class="footer-links" aria-label="Footer"> |
| <a href="index.html">Home</a> |
| <a href="models.html">Models</a> |
| <a href="pricing.html">Pricing</a> |
| <a href="docs.html">Docs</a> |
| <a href="faq.html">FAQ</a> |
| </nav> |
| <p class="copyright">© ${year} Apiarium labs · endpoint |
| <code>${ENDPOINT.replace('https://', '')}</code></p> |
| </div> |
| </footer>`; |
| } |
|
|
| |
| function build() { |
| const current = document.body.dataset.page || ''; |
| const navHost = document.querySelector('[data-site-nav]'); |
| const footHost = document.querySelector('[data-site-footer]'); |
|
|
| if (navHost) { |
| navHost.innerHTML = navHtml(current); |
| |
| const nav = navHost.querySelector('.site-nav'); |
| if (nav) { |
| const onScroll = () => { |
| nav.classList.toggle('is-scrolled', window.scrollY > 40); |
| }; |
| window.addEventListener('scroll', onScroll, { passive: true }); |
| onScroll(); |
| } |
| |
| const authLink = navHost.querySelector('#nav-auth'); |
| if (authLink) { |
| fetch('/auth/me').then(r => r.ok ? r.json() : null).then(me => { |
| if (me) { |
| authLink.textContent = 'Dashboard'; |
| authLink.setAttribute('href', 'dashboard.html'); |
| } |
| }).catch(() => { }); |
| } |
| } |
| if (footHost) footHost.innerHTML = footerHtml(); |
| } |
|
|
| if (document.readyState === 'loading') { |
| document.addEventListener('DOMContentLoaded', build); |
| } else { |
| build(); |
| } |
| })(); |
|
|