diff --git a/src/main.ts b/src/main.ts index fe9b553..8677d9d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -32,12 +32,6 @@ import i18next from "i18next"; // @ts-ignore import translations from "./translations/index.mjs"; -declare global { - interface Window { - pageContent: Element; - } -} - async function onLoad(): Promise { document.body.innerHTML = ""; document.body.appendChild(makeElement({ tag: "div", id: "navBarReplace" })); @@ -64,8 +58,6 @@ async function onLoad(): Promise { }), ); - window.pageContent = document.querySelector("#pageContent"); - const pageRouter = new PageRouter( pageList, pageState, diff --git a/src/pages/Transit/TransitDecrypt.ts b/src/pages/Transit/TransitDecrypt.ts index b2c53c2..f0be5a8 100644 --- a/src/pages/Transit/TransitDecrypt.ts +++ b/src/pages/Transit/TransitDecrypt.ts @@ -106,7 +106,7 @@ export class TransitDecryptPage extends Page { i18next.t("transit_decrypt_decryption_result_modal_title"), plaintext, ); - document.body.querySelector("#pageContent").appendChild(modal); + this.router.pageContentElement.appendChild(modal); modal.show(); } catch (e: unknown) { const error = e as Error; diff --git a/src/pages/Transit/TransitEncrypt.ts b/src/pages/Transit/TransitEncrypt.ts index 3f02c1e..abd9d9c 100644 --- a/src/pages/Transit/TransitEncrypt.ts +++ b/src/pages/Transit/TransitEncrypt.ts @@ -104,7 +104,7 @@ export class TransitEncryptPage extends Page { i18next.t("transit_encrypt_encryption_result_modal_title"), res.ciphertext, ); - document.body.querySelector("#pageContent").appendChild(modal); + this.router.pageContentElement.appendChild(modal); modal.show(); } catch (e: unknown) { const error = e as Error; diff --git a/src/pages/Transit/TransitRewrap.ts b/src/pages/Transit/TransitRewrap.ts index 426e4a4..13af704 100644 --- a/src/pages/Transit/TransitRewrap.ts +++ b/src/pages/Transit/TransitRewrap.ts @@ -97,7 +97,7 @@ export class TransitRewrapPage extends Page { key_version: parseInt(formData.get("version") as string, 10), }); const modal = CopyableModal(i18next.t("transit_rewrap_result_modal_title"), res.ciphertext); - document.body.querySelector("#pageContent").appendChild(modal); + this.router.pageContentElement.appendChild(modal); modal.show(); } catch (e: unknown) { const error = e as Error;