src/23-infoModal.ts (raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
class InfoModal implements Modal { constructor() { const _this = this; const closeBtn = document.getElementById("info-closeBtn"); if (closeBtn) { closeBtn.onclick = ()=>{_this.setVisible(false)}; } } self(): HTMLElement | null { return document.getElementById("info-container"); } visible(): boolean { return this.self()?.style.display != "none"; } infoMsg(): HTMLElement | null { return document.getElementById("info-content"); } setMsg(s: string) { const infoMsg = this.infoMsg(); if (infoMsg) { infoMsg.innerText = s; } } setVisible(v: boolean): void { const modal = this.self(); if (modal) { modal.style.display = v ? "block" : "none"; } } } |