1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
<!-- ui-version: 5 (do not change when modifying theme for yourself) -->
<html>
<head>
<title>Astroid</title>
</head>
<body>
<div id="message_container"><span id="placeholder"></span></div>
<div id="multiple_messages"><div id="selection_counter" class="email"></div></div>
<div id="email_template" class="email">
<div class="compressed_note"><span><span></div>
<div class="geary_spacer"></div>
<div class="email_container">
<div class="email_warning"></div>
<div class="email_info"></div>
<div class="header_container">
<img src="" class="avatar" />
<div class="button_bar">
<!--<div class="starred button"><img src="" class="icon" /></div>-->
<!--<div class="unstarred button"><img src="" class="icon" /></div>-->
<!--<div class="menu button"><img src="" class="icon" /></div>-->
</div>
<img src="" class="attachment icon first" />
<img src="" class="marked icon first" />
<div class="header"></div>
<img src="" class="attachment icon sec" />
<img src="" class="marked icon sec" />
<div class="tags"></div>
<div class="subject"></div>
<div class="preview"></div>
</div>
<div class="remote_images"><img class="close_show_images button" /></div>
<div class="body"></div>
<div class="draft_edit"><span class="draft_edit_button button"></span></div>
</div>
</div>
<div id="attachment_template" class="attachment_container">
<div class="top_border"></div>
<table class="attachment"><tr>
<td class="preview"><img src="" /></td>
<td class="info">
<div class="filename"></div>
<div class="filesize"></div>
</td>
</tr></table>
</div>
<div id="encrypt_template" class="encrypt_container">
<div class="message"></div>
</div>
<div id="sibling_template" class="sibling_container">
<div class="message"></div>
</div>
<div id="mime_template" class="mime_container">
<div class="message"></div>
</div>
<div id="body_template" class="body_part">
<!--
sandbox="allow-same-origin" is required, otherwise the scrollHeight of the
embedded document cannot be accessed.
Do not add 'allow-scripts' to the sandbox attribute. This would allow the
document to execute scripts itself.
-->
<iframe class="body_iframe" sandbox="allow-same-origin" onload="handleLoadIframe(this);" srcdoc=""></iframe>
</div>
<script>
function onSetFocused(element, callback) {
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.target.classList.contains("focused")) {
callback(mutation.target);
}
});
});
observer.observe(element, { attributeFilter: ["class"] });
return observer.disconnect;
}
function sizeIframe(iframe) {
iframe.height = 0; // hack, no idea why it only works with this
iframe.height = iframe.contentWindow.document.body.scrollHeight;
}
function getParentWithClass(element, c) {
p = element.parentElement;
while (p != document.body && !p.classList.contains(c)) {
p = p.parentElement;
}
return p;
}
function handleLoadIframe(iframe) {
sizeIframe(iframe);
const email = getParentWithClass(iframe, "email");
if (email != document.body)
onSetFocused(email, _ => sizeIframe(iframe));
};
</script>
</body>
</html>
|