| 1742 | const html = elm.generateHTML(); |
| 1743 | div.append(html); |
| 1744 | this.html.set(elm, new WeakRef(div)); |
| 1745 | container.append(div); |
| 1746 | } |
| 1747 | } |
| 1748 | deleteElm(opt: OptionsElement<any>) { |
| 1749 | const html = this.html.get(opt)?.deref(); |
| 1750 | this.options = this.options.filter((_) => _ !== opt); |
| 1751 | if (!html) return; |
| 1752 | html.remove(); |
| 1753 | this.html.delete(opt); |
| 1754 | } |
| 1755 | title: WeakRef<HTMLElement> = new WeakRef(document.createElement("h2")); |
| 1756 | generateHTML(): HTMLElement { |
| 1757 | const div = document.createElement("div"); |
| 1758 | div.classList.add("flexttb", "titlediv"); |
| 1759 | if (this.vsmaller) div.classList.add("vsmaller"); |
| 1760 | if (this.owner instanceof Options) { |
| 1761 | div.classList.add("optionElement"); |
| 1762 | } |
| 1763 | const title = document.createElement("h2"); |
| 1764 | title.textContent = this.name; |
| 1765 | div.append(title); |
| 1766 | if (this.name !== "") title.classList.add("settingstitle"); |
| 1767 | this.title = new WeakRef(title); |
| 1768 | const container = document.createElement("div"); |
| 1769 | this.container = new WeakRef(container); |
| 1770 | container.classList.add(this.ltr ? "flexltr" : "flexttb", "flexspace"); |
| 1771 | this.generateContainer(); |
| 1772 | div.append(container); |
| 1773 | return div; |
| 1774 | } |
| 1775 | |