diff --git a/public/mail.js b/public/mail.js
index 700738b..3c3a9fb 100644
--- a/public/mail.js
+++ b/public/mail.js
@@ -33,6 +33,14 @@ function mailDoc(html, images) {
return `
${html}`;
}
+/** On a phone the message is as tall as its text and the page scrolls, so there is one scroll, not a box inside a page. (The box keeps its own scroll on a wide screen.) No scripts run in it: only same-origin so its height can be read. */
+function mailFit(fr) {
+ if (!fr) return;
+ const fit = () => { if (!fr.isConnected) return; if (innerWidth >= 1024) { fr.style.height = ''; return; } try { const d = fr.contentDocument; d.documentElement.style.overflowY = 'hidden'; fr.style.height = Math.max(160, Math.ceil(d.documentElement.scrollHeight) + 2) + 'px'; } catch {} };
+ fr.addEventListener('load', () => { fit(); try { fr.contentDocument.addEventListener('load', fit, true); } catch {} setTimeout(fit, 300); setTimeout(fit, 1200); });
+ if (!mailFit.on) { mailFit.on = true; addEventListener('resize', () => { const f = document.querySelector('.mbody'); if (f) f.dispatchEvent(new Event('fit')); }); }
+ fr.addEventListener('fit', fit);
+}
const mailHasRemote = html => /]+src=["']?https?:|url\(\s*["']?https?:/i.test(html || '');
// ---- unread badge and Home card
@@ -462,8 +470,9 @@ function mailDrawReader() {
${m.attachments.length ? `