From 45b26747fa9312dde0bd3477066650f75774e537 Mon Sep 17 00:00:00 2001 From: Mic Date: Fri, 13 Dec 2024 00:18:00 +0100 Subject: [PATCH] useless css removed. var names improved --- js/mzta-compose-script.js | 44 +++++++++------------------------------ 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/js/mzta-compose-script.js b/js/mzta-compose-script.js index 5f7cf3ac..48bfb28c 100644 --- a/js/mzta-compose-script.js +++ b/js/mzta-compose-script.js @@ -155,17 +155,6 @@ switch (message.command) { --dialog-text-color: #ffffff; } } - - /* Darker overlay for the page background */ - .mzta_dialog_overlay { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: rgba(0, 0, 0, 0.7); - z-index: 1000; - } `; document.head.appendChild(style); @@ -233,29 +222,13 @@ switch (message.command) { --dialog-text-color: #ffffff; } } - - /* Darker overlay for the page background */ - .mzta_dialog_overlay { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: rgba(0, 0, 0, 0.7); - z-index: 1000; - } `; document.head.appendChild(style); function createDialog(inputString, onSubmit) { - // Create the overlay - // const overlay = document.createElement('div'); - // overlay.className = 'mzta_dialog_overlay'; - // document.body.appendChild(overlay); - // Create the dialog - const dialog = document.createElement('dialog'); - dialog.className = 'mzta_dialog'; + const tags_dialog = document.createElement('dialog'); + tags_dialog.className = 'mzta_dialog'; // Create the content const content = document.createElement('div'); @@ -305,15 +278,18 @@ switch (message.command) { buttonsDiv.appendChild(submitButton); content.appendChild(form); - dialog.appendChild(content); - document.body.appendChild(dialog); + tags_dialog.appendChild(content); + document.body.appendChild(tags_dialog); function closeDialog() { - document.body.removeChild(dialog); - document.body.removeChild(overlay); + tags_dialog.close(); + tags_dialog.addEventListener('close', () => { + tags_dialog.remove(); + style.remove(); + }); } - dialog.showModal(); + tags_dialog.showModal(); } // Example usage