()
| 17 | this.requireUpdateAllDev = false; |
| 18 | } |
| 19 | onOpen() { |
| 20 | const { contentEl } = this; |
| 21 | const t = (x: TransItemType, vars?: any) => { |
| 22 | return this.plugin.i18n.t(x, vars); |
| 23 | }; |
| 24 | |
| 25 | contentEl.createEl("h2", { |
| 26 | text: t("syncalgov3_title"), |
| 27 | }); |
| 28 | |
| 29 | const ul = contentEl.createEl("ul"); |
| 30 | t("syncalgov3_texts") |
| 31 | .split("\n") |
| 32 | .forEach((val) => { |
| 33 | ul.createEl("li", { |
| 34 | text: stringToFragment(val), |
| 35 | }); |
| 36 | }); |
| 37 | |
| 38 | // code modified partially from BART released under MIT License |
| 39 | contentEl.createDiv("modal-button-container", (buttonContainerEl) => { |
| 40 | let agreeBtn: HTMLButtonElement | undefined = undefined; |
| 41 | |
| 42 | buttonContainerEl.createEl( |
| 43 | "label", |
| 44 | { |
| 45 | cls: "mod-checkbox", |
| 46 | }, |
| 47 | (labelEl) => { |
| 48 | const checkboxEl = labelEl.createEl("input", { |
| 49 | attr: { tabindex: -1 }, |
| 50 | type: "checkbox", |
| 51 | }); |
| 52 | checkboxEl.checked = this.manualBackup; |
| 53 | checkboxEl.addEventListener("click", () => { |
| 54 | this.manualBackup = checkboxEl.checked; |
| 55 | if (agreeBtn !== undefined) { |
| 56 | if (this.manualBackup && this.requireUpdateAllDev) { |
| 57 | agreeBtn.removeAttribute("disabled"); |
| 58 | } else { |
| 59 | agreeBtn.setAttr("disabled", true); |
| 60 | } |
| 61 | } |
| 62 | }); |
| 63 | labelEl.appendText(t("syncalgov3_checkbox_manual_backup")); |
| 64 | } |
| 65 | ); |
| 66 | |
| 67 | buttonContainerEl.createEl( |
| 68 | "label", |
| 69 | { |
| 70 | cls: "mod-checkbox", |
| 71 | }, |
| 72 | (labelEl) => { |
| 73 | const checkboxEl = labelEl.createEl("input", { |
| 74 | attr: { tabindex: -1 }, |
| 75 | type: "checkbox", |
| 76 | }); |
nothing calls this directly
no test coverage detected