mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-06-29 21:52:09 -07:00
website: redesign part 13
This commit is contained in:
@@ -12,24 +12,6 @@ const pageByPath = new Map();
|
||||
const header = createHeader();
|
||||
document.body.append(header);
|
||||
|
||||
const navLinks = [...header.querySelectorAll("nav a")];
|
||||
|
||||
/** @param {string} pathname */
|
||||
function updateCurrentLink(pathname) {
|
||||
const currentPath = normalizePath(pathname);
|
||||
|
||||
for (const link of navLinks) {
|
||||
const linkPath = new URL(/** @type {HTMLAnchorElement} */ (link).href)
|
||||
.pathname;
|
||||
|
||||
if (linkPath === currentPath) {
|
||||
link.setAttribute("aria-current", "page");
|
||||
} else {
|
||||
link.removeAttribute("aria-current");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** @param {string} pathname */
|
||||
function getPage(pathname) {
|
||||
let page = pageByPath.get(pathname);
|
||||
@@ -60,7 +42,6 @@ function activatePage(page) {
|
||||
function renderPage() {
|
||||
const pathname = normalizePath(window.location.pathname);
|
||||
activatePage(getPage(pathname));
|
||||
updateCurrentLink(pathname);
|
||||
}
|
||||
|
||||
/** @param {string} pathname */
|
||||
|
||||
Reference in New Issue
Block a user