This commit is contained in:
forgejo-actions 2026-10-25 10:31:27 +00:00
commit ac2e7cc8fc
73 changed files with 104 additions and 2 deletions

View file

@ -0,0 +1,16 @@
(() => {
const versionRoot = new URL(document.documentElement.dataset.content_root, window.location.href);
const switcherUrl = new URL(DOCUMENTATION_OPTIONS.theme_switcher_json_url, versionRoot);
const resolveLinks = (root) => {
root.querySelectorAll(".version-switcher__menu a[href]").forEach((anchor) => {
anchor.href = new URL(anchor.getAttribute("href"), switcherUrl).href;
});
};
resolveLinks(document);
new MutationObserver(() => resolveLinks(document)).observe(document.documentElement, {
childList: true,
subtree: true,
});
})();