Files
Karim shoair 5bc85cf768 docs: Add Arabic docs for the website
- Changed the structure to make it easier to add others soon.
- Moved the sponsors to a shared template between languages.
2026-10-16 18:47:34 +03:00

14 lines
669 B
JavaScript

(() => {
const base = new URL(JSON.parse(document.getElementById("__config").textContent).base, location);
if (!base.pathname.endsWith("/")) base.pathname += "/";
const links = [...document.querySelectorAll(".md-select a[hreflang]")].map(link => [link, link.href]);
const update = () => links.forEach(([link, root]) => {
link.href = new URL(location.pathname.slice(base.pathname.length) + location.search + location.hash, root).href;
link.target = "_self";
});
update();
location$.subscribe(update);
addEventListener("hashchange", update);
for (const event of ["click", "auxclick", "contextmenu"]) addEventListener(event, update, true);
})();