summaryrefslogtreecommitdiff
path: root/src/rendermail.js
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-08-18 23:20:57 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-08-18 23:20:57 +0200
commiteb1dcb7d003293a56993552f6cc130ad13abcc30 (patch)
treedd219e7dd6bc69b98bb99b1fbde3cca3e824b822 /src/rendermail.js
parent1229bb6a838e96eb52be7aa1cac8d692746bc783 (diff)
added tabbing to multipart/alternative
Diffstat (limited to 'src/rendermail.js')
-rw-r--r--src/rendermail.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/rendermail.js b/src/rendermail.js
new file mode 100644
index 0000000..1331913
--- /dev/null
+++ b/src/rendermail.js
@@ -0,0 +1,21 @@
+function tabSelection(evt) {
+ const self = evt.target;
+
+ for (const ts of self.parentElement.parentElement.children) {
+ ts.classList.remove('is-active');
+ }
+ self.parentNode.classList.add('is-active');
+
+ const bodies = self.parentElement.parentElement.parentElement.parentElement.children[1].children;
+ for (const ts of bodies) {
+ ts.classList.add('is-hidden');
+ }
+ bodies[+self.parentElement.attributes.data.value].classList.remove('is-hidden');
+}
+
+document.addEventListener("DOMContentLoaded", function() {
+ const tabSections = document.getElementsByClassName("jwm-mail-body-multipart-alternative");
+ for (const ts of tabSections) {
+ Array.from(ts.children[0].children[0].children).forEach(element => element.children[0].addEventListener('click', tabSelection));
+ }
+})