(rl => { // if (rl.settings.get('Nextcloud')) const templateId = 'MailMessageView'; // DATA_IMAGE_USER_DOT_PIC = 'data:image/svg+xml;utf8,'; addEventListener('rl-view-model.create', e => { if (templateId === e.detail.viewModelTemplateID) { const template = document.getElementById(templateId), messageItemHeader = template.content.querySelector('.messageItemHeader'); if (messageItemHeader) { messageItemHeader.prepend(Element.fromHTML( `` )); } let view = e.detail; view.viewUserPic = ko.observable(''); view.viewUserPicVisible = ko.observable(false); view.message.subscribe(msg => { view.viewUserPicVisible(false); if (msg) { let from = msg.from[0], bimi = 'pass' == from.dkimStatus ? 1 : 0; // view.viewUserPic(`?Avatar/${bimi}/${encodeURIComponent(from.email)}`); // view.viewUserPicVisible(true); rl.pluginRemoteRequest((iError, data) => { if (!iError && data?.Result.type) { view.viewUserPic(`data:${data.Result.type};base64,${data.Result.data}`); view.viewUserPicVisible(true); } }, 'Avatar', { bimi: bimi, email: from.email }); } }); } /* if ('MailMessageList' === e.detail.viewModelTemplateID) { const template = document.getElementById('MailMessageList' ), messageCheckbox = template.content.querySelector('.messageCheckbox'); messageCheckbox.dataset.bind = 'attr:{style:$root.viewUserPic($data)}'; e.detail.viewUserPic = msg => { let from = msg.from[0], bimi = 'pass' == from.dkimStatus ? 1 : 0; return `background:no-repeat url("?Avatar/${bimi}/${encodeURIComponent(from.email)}") center / contain`; return `background:no-repeat url("?Avatar/${bimi}/${encodeURIComponent(from.email)}") right / 32px;width:68px`; }; .checkboxMessage { background: #000; } } */ }); })(window.rl);