RECORDGOD/site/nav.js

35 lines
1.6 KiB
JavaScript

// Unified RecordGod owner nav — included on the back-office pages (admin / builder / dash).
// One source of truth: edit the links here, every page updates. Kept OFF the customer shop/store.
(function () {
const LINKS = [
{ href: '/admin', label: 'Admin' },
{ href: '/search', label: 'Search' },
{ href: '/pos', label: 'Sales' },
{ href: '/builder', label: 'Builder' },
{ href: '/shop', label: 'Shop' },
{ href: '/store/', label: '3D store' },
];
const here = (location.pathname.replace(/\/+$/, '') || '/');
const css = document.createElement('style');
css.textContent =
'#rg-nav{position:fixed;top:0;left:0;right:0;height:44px;display:flex;align-items:center;gap:4px;' +
'padding:0 16px;background:#0a0a0c;border-bottom:1px solid #26262c;z-index:99999;font:14px system-ui}' +
'#rg-nav .b{font-weight:700;color:#eee;text-decoration:none;margin-right:14px}' +
'#rg-nav .b i{color:#ff5db1;font-style:normal}' +
'#rg-nav a.l{color:#cfcfd6;text-decoration:none;padding:6px 11px;border-radius:7px}' +
'#rg-nav a.l:hover{background:#17171c}' +
'#rg-nav a.l.on{background:#221a20;color:#ff5db1}' +
'#rg-nav .sp{flex:1}' +
'body{padding-top:44px}';
document.head.appendChild(css);
const bar = document.createElement('nav');
bar.id = 'rg-nav';
bar.innerHTML = '<a class="b" href="/">Record<i>God</i></a>' +
LINKS.map(p => {
const on = here === p.href.replace(/\/+$/, '');
return `<a class="l${on ? ' on' : ''}" href="${p.href}">${p.label}</a>`;
}).join('') +
'<span class="sp"></span>';
document.body.insertBefore(bar, document.body.firstChild);
})();