xi-conversations

Minimal clone of thunderbird conversations
git clone https://git.ce9e.org/xi-conversations.git

commit
d21b2499c1e581095f641d491d6c42e0c78c93d4
parent
a849fccaf896d48e3cc8e21dc389f5a9e23ad8cc
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-09-06 02:31
refactor author

Diffstat

M content/js/message.js 12 +++++-------
M content/js/util.js 6 +++++-

2 files changed, 10 insertions, 8 deletions


diff --git a/content/js/message.js b/content/js/message.js

@@ -41,12 +41,6 @@ var autoMarkAsRead = function(e, msg) {
   41    41 	};
   42    42 };
   43    43 
   44    -1 var createAuthor = function(author) {
   45    -1 	var a = util.h('a', {'class': 'message__author', 'href': `mailto:${author.email}`}, [author.name]);
   46    -1 	a.style.color = util.pseudoRandomColor(author.email);
   47    -1 	return a;
   48    -1 };
   49    -1 
   50    44 export default function(msg, expanded) {
   51    45 	var h = util.h;
   52    46 	var _ = browser.i18n.getMessage;
@@ -60,7 +54,11 @@ export default function(msg, expanded) {
   60    54 	var e = h('article', {'class': expanded ? 'message is-expanded' : 'message', 'id': `msg-${msg.id}`, 'tabindex': -1}, [
   61    55 		h('header', {'class': 'message__header'}, [
   62    56 			h('button', {'class': msg.flagged ? 'star is-active' : 'star', 'data-action': 'toggleFlagged'}, [util.createIcon('star')]),
   63    -1 			createAuthor(util.parseContacts([msg.author])[0]),
   -1    57 			...util.parseContacts([msg.author]).map(author => h('a', {
   -1    58 				'class': 'message__author',
   -1    59 				'href': `mailto:${author.email}`,
   -1    60 				'style:color': util.pseudoRandomColor(author.email),
   -1    61 			}, [author.name])),
   64    62 			' ',
   65    63 			h('span', {'class': 'message__recipients'}, [
   66    64 				_('to'),

diff --git a/content/js/util.js b/content/js/util.js

@@ -41,7 +41,11 @@ export var getBody = function(msgPart) {
   41    41 export var h = function(tag, attrs, children) {
   42    42 	var el = document.createElement(tag);
   43    43 	for (let attr in attrs) {
   44    -1 		el.setAttribute(attr, attrs[attr]);
   -1    44 		if (attr.startsWith('style:')) {
   -1    45 			el.style[attr.substring(6)] = attrs[attr];
   -1    46 		} else {
   -1    47 			el.setAttribute(attr, attrs[attr]);
   -1    48 		}
   45    49 	}
   46    50 	for (let child of children) {
   47    51 		if (child) {