Fix NavHeader for production and improve AgeRestrictedModal script
This commit is contained in:
parent
eccd4d8bfe
commit
e2527064db
7 changed files with 58 additions and 54 deletions
|
|
@ -54,13 +54,18 @@ import IconTriangleExclamation from "./icons/IconTriangleExclamation.astro";
|
|||
|
||||
<script>
|
||||
import { ENABLE_VIEW_TRANSITIONS } from "astro:env/client";
|
||||
type AgeVerified = "true" | undefined;
|
||||
|
||||
const ageRestrictedModalSetup = () => {
|
||||
const modal = document.querySelector<HTMLElementTagNameMap["div"]>("body > div#modal-age-restricted");
|
||||
const modal = document.querySelector<HTMLElementTagNameMap["div"]>("div#modal-age-restricted");
|
||||
// Not an age-restricted page
|
||||
if (!modal) {
|
||||
throw new Error("Missing #modal-age-restricted element! Make sure that it's a direct child of body.");
|
||||
return;
|
||||
}
|
||||
let ageVerified: "true" | undefined = localStorage.ageVerified;
|
||||
if (modal !== document.querySelector("body > div#modal-age-restricted")) {
|
||||
throw new Error("#modal-age-restricted must be a direct child of the body element!");
|
||||
}
|
||||
let ageVerified: AgeVerified = localStorage.ageVerified;
|
||||
if (ageVerified !== "true") {
|
||||
const rejectButton = modal.querySelector<HTMLElementTagNameMap["button"]>("button[data-modal-reject]")!;
|
||||
const onRejectButtonClick = (e: MouseEvent) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue