Files
bitvid/js/disclaimer.js
T
google-labs-jules[bot] f75531d2db chore(ai): format sources and fix moderation bugs (agent)
- Format `css/tailwind.source.css` with Prettier.
- Add allowlist entry for `VideoCard.js` media query pixel value in `scripts/check-design-tokens.mjs`.
- Remove accidental artifact `js/ui/dm/jules_session_4520373547615093905.zip`.
- Fix bug in `js/app.js` and `js/services/moderationActionController.js` where blocked users' videos were not correctly hidden in the UI immediately after blocking.
- Fix bug in `tests/app/moderation-overrides.test.mjs` where `userBlocks` mocks were insufficient to reflect state changes.
2026-01-22 14:58:35 +00:00

63 lines
1.5 KiB
JavaScript

// js/disclaimer.js
import {
prepareStaticModal,
openStaticModal,
closeStaticModal,
} from "./ui/components/staticModalAccessibility.js";
class DisclaimerModal {
constructor() {
this.modal = null;
this.acceptButton = null;
this.acceptHandler = null;
}
init() {
this.modal = document.getElementById("disclaimerModal");
if (this.modal) {
prepareStaticModal({ root: this.modal });
}
const nextAcceptButton = document.getElementById("acceptDisclaimer");
if (!this.acceptHandler) {
this.acceptHandler = () => {
this.hide();
};
}
if (this.acceptButton && this.acceptHandler) {
this.acceptButton.removeEventListener("click", this.acceptHandler);
}
this.acceptButton = nextAcceptButton || null;
if (this.acceptButton && this.acceptHandler) {
this.acceptButton.addEventListener("click", this.acceptHandler);
}
}
hide() {
if (this.modal && !closeStaticModal(this.modal)) {
this.modal.classList.add("hidden");
}
localStorage.setItem("hasSeenDisclaimer", "true");
}
show() {
// In case the modal hasn't been initialized yet.
if (!this.modal) {
this.init();
}
if (!localStorage.getItem("hasSeenDisclaimer") && this.modal) {
if (!openStaticModal(this.modal)) {
this.modal.classList.remove("hidden");
}
}
}
}
// Create and export a default instance.
const disclaimerModal = new DisclaimerModal();
export default disclaimerModal;