Skip to content

Commit d68265b

Browse files
committed
added ui improvements
1 parent 4a95af1 commit d68265b

File tree

2 files changed

+41
-12
lines changed

2 files changed

+41
-12
lines changed

extension/css/cryptup.css

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3505,14 +3505,22 @@ body#settings div.webmail_notifications div.webmail_notification a:hover {
35053505
/* thunderbird ui css */
35063506

35073507
.thunderbird_attachment_root {
3508-
display: inline-flex;
35093508
margin: 0 7px 7px 0;
3509+
padding: 6px 4px;
35103510
background: #fff;
3511+
border: 1px solid #d8d8d8;
3512+
color: #444;
3513+
text-overflow: ellipsis;
35113514
align-items: center;
35123515
align-content: center;
3513-
border: 1px solid gray;
3514-
padding: 2px;
3516+
width: 240px;
3517+
max-width: 270px;
3518+
display: inline-flex;
35153519
cursor: pointer;
3520+
position: relative;
3521+
border-radius: 2px;
3522+
height: 40px;
3523+
font-size: 16px;
35163524
}
35173525

35183526
.thunderbird_attachment_root div {
@@ -3528,13 +3536,28 @@ body#settings div.webmail_notifications div.webmail_notification a:hover {
35283536
width: 40px;
35293537
background: #fff;
35303538
overflow: hidden;
3539+
opacity: 0.4;
35313540
}
35323541

35333542
.thunderbird_attachment_root .thunderbird_attachment_download {
3534-
background: url('/img/svgs/download-link.svg') center / auto no-repeat;
3535-
padding: 2px;
3536-
height: 40px;
3537-
width: 40px;
3543+
display: none;
3544+
padding: 6px;
3545+
height: 30px;
3546+
width: 30px;
3547+
right: 0;
3548+
position: absolute;
3549+
background: #333;
3550+
opacity: 0.88;
3551+
border-radius: 2px;
3552+
margin: 3px 6px;
3553+
}
3554+
3555+
.thunderbird_attachment_root:hover .thunderbird_attachment_download {
3556+
display: inline-block;
3557+
}
3558+
3559+
.thunderbird_attachment_download img {
3560+
width: 100%;
35383561
}
35393562

35403563
/* print class */

extension/js/content_scripts/webmail/thunderbird/thunderbird-element-replacer.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,25 @@ export class ThunderbirdElementReplacer extends WebmailElementReplacer {
114114
};
115115

116116
private generatePgpAttachmentTemplate = (attachment: messenger.messages.MessageAttachment) => {
117+
const uiFileExtensions = ['excel', 'word', 'png', 'jpg', 'generic'];
117118
const attachmentHtmlRoot = $('<div>').addClass('thunderbird_attachment_root');
118119
const attachmentFileTypeIcon = $('<img>').addClass('thunderbird_attachment_icon');
119120
attachmentFileTypeIcon.attr('alt', Xss.escape(attachment.name));
120-
attachmentFileTypeIcon.attr('src', '/image/fileformat/generic.png');
121-
const attachmentFilename = $('<div>').addClass('thunderbird_attachment_name').text(Xss.escape(attachment.name));
121+
uiFileExtensions.some(fileExtension => {
122+
if (attachment.name.replace(/\.(pgp|gpg|asc)$/i, '').endsWith(fileExtension)) {
123+
attachmentFileTypeIcon.attr('src', messenger.runtime.getURL(`/img/fileformat/${fileExtension}.png`));
124+
}
125+
});
126+
const attachmentFilename = $('<div>').addClass('thunderbird_attachment_name').text(attachment.name);
122127
const attachmentDownloadBtn = $('<div>')
123128
.addClass('thunderbird_attachment_download')
124129
.on('click', async () => {
125130
await this.downloadThunderbirdAttachmentHandler(attachment);
126-
});
131+
})
132+
.prepend($('<img>').attr('src', messenger.runtime.getURL('/img/svgs/download-link.svg'))); // xss-safe-value
127133
attachmentHtmlRoot.append(attachmentFileTypeIcon); // xss-escaped
128-
attachmentHtmlRoot.append(attachmentFilename); // xss-escaped
129-
attachmentHtmlRoot.append(attachmentDownloadBtn); // xss-escaped
134+
attachmentHtmlRoot.append(attachmentFilename); // xss-safe-value
135+
attachmentHtmlRoot.append(attachmentDownloadBtn); // xss-safe-value
130136
return attachmentHtmlRoot;
131137
};
132138

0 commit comments

Comments
 (0)