Improve age-restricted hyperlinks and clean up markup
This commit is contained in:
parent
67e17ae27f
commit
4f6b320d31
13 changed files with 117 additions and 63 deletions
|
|
@ -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 },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue