Improve age-restricted hyperlinks and clean up markup

This commit is contained in:
Bad Manners 2024-08-25 12:36:37 -03:00
parent 67e17ae27f
commit 4f6b320d31
13 changed files with 117 additions and 63 deletions

View file

@ -86,6 +86,11 @@ import IconTriangleExclamation from "./icons/IconTriangleExclamation.astro";
localStorage.ageVerified = ageVerified;
document.body.style.overflow = "auto";
document.querySelectorAll("body > :not(#modal-age-restricted)").forEach((el) => el.removeAttribute("inert"));
document.body.querySelectorAll<HTMLElementTagNameMap["a"]>("a[href][data-age-restricted]").forEach((el) => {
let newHref = new URL(el.href);
newHref.searchParams.set("ageVerified", "true");
el.href = newHref.href;
});
modal.style.display = "none";
},
{ once: true },