diff --git a/src/web/app.js b/src/web/app.js index 76a11f9..cfe77cc 100644 --- a/src/web/app.js +++ b/src/web/app.js @@ -201,6 +201,11 @@ async function openDialog({ url, data, asyncContext, promptBeforeOpen, ...params }); } +function charsToPercentage(chars, maxSize) { + const bodyFontSize = parseInt(window.getComputedStyle(document.body).fontSize); + return Math.floor(((bodyFontSize * chars) / maxSize) * 100); +} + async function tryConfirm(data, asyncContext) { const { to, cc, bcc } = data.target; const { trustedDomains, unsafeDomains } = data.config; @@ -220,11 +225,11 @@ async function tryConfirm(data, asyncContext) { } const { status, asyncContext: updatedAsyncContext } = await openDialog({ - url: window.location.origin + "/dialog.html", + url: window.location.origin + "/confirm.html", data, asyncContext, - height: 60, - width: 60, + height: Math.min(60, charsToPercentage(50, screen.availHeight)), + width: Math.min(80, charsToPercentage(45, screen.availWidth)), }); console.debug("status: ", status); @@ -263,8 +268,8 @@ async function tryCountDown(data, asyncContext) { url: window.location.origin + "/count-down.html", data, asyncContext, - height: 60, - width: 60, + height: Math.min(20, charsToPercentage(15, screen.availHeight)), + width: Math.min(20, charsToPercentage(25, screen.availWidth)), }); console.debug("status: ", status); diff --git a/src/web/confirm.css b/src/web/confirm.css new file mode 100644 index 0000000..4df2906 --- /dev/null +++ b/src/web/confirm.css @@ -0,0 +1,69 @@ +.heading-container { + display: flex; + align-items: center; +} + +.heading-container fluent-button { + margin-left: 10px; +} + +.check-target { + margin-left: 20px; + display: flex; + margin-bottom: 10px; +} + +#untrusted-domains fluent-checkbox::part(label) { + color: red; +} + +#attachment-and-others fluent-checkbox.warning::part(label) { + color:red; +} + +/* fluent-dialog { + --dialog-background-color: red; + background: red !important; + padding: 1.5em; + color: white !important; + font-size: x-large !important; + font-weight: bold !important; + text-align: center; +} */ + +fluent-dialog::part(control) { + color: white; + background-color: red; + padding: 0 1.5em 1.5em 1.5em; + text-align: center; + --dialog-width: fit-content; + --dialog-height: fit-content; +} + +fluent-dialog::part(control) .newly-added-domain-content { + background-color: white; + background: var(--bg-color) !important; +} + +fluent-dialog .newly-added-domain-content { + color: black; + padding: 2em; + text-align: left; +} + +fluent-dialog .newly-added-domain-content strong { + font-size: large; + font-weight: bold; +} + +#newly-added-domain-address-list { + margin: 1em 0; +} + +#cancel-new-domain-button { + margin-left: 10px; +} + +.new-domain-button-container { + margin-top: 20px; +} diff --git a/src/web/dialog.html b/src/web/confirm.html similarity index 66% rename from src/web/dialog.html rename to src/web/confirm.html index 5c008e5..4e96b4a 100644 --- a/src/web/dialog.html +++ b/src/web/confirm.html @@ -7,29 +7,32 @@ +