Skip to content

Commit 53aa48d

Browse files
authored
Merge pull request #133 from jeevatkm/for-v2.6.0-release
For v2.6.0 release
2 parents a0271bc + 763cf8f commit 53aa48d

File tree

7 files changed

+59
-62
lines changed

7 files changed

+59
-62
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Quoting Email Headers in Thunderbird
2-
[![Version](https://img.shields.io/badge/version-2.4.0-blue.svg)](https://github.com/jeevatkm/ReplyWithHeaderMozilla/releases/latest) [![License](https://img.shields.io/github/license/jeevatkm/ReplyWithHeaderMozilla.svg)](LICENSE)
2+
[![Version](https://img.shields.io/badge/version-2.6.0-blue.svg)](https://github.com/jeevatkm/ReplyWithHeaderMozilla/releases/latest) [![License](https://img.shields.io/github/license/jeevatkm/ReplyWithHeaderMozilla.svg)](LICENSE)
33

44
ReplyWithHeaderMozilla aka [RWH Thunderbird] is an add-on for Thunderbird mail client that enables email header.
55
Brings Outlook header capabilities into Thunderbird.

chrome/content/core.js

Lines changed: 37 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,16 @@ var ReplyWithHeader = {
298298
return recipients.trim();
299299
},
300300

301+
getHeaderQuotSeq: function(selectedOption) {
302+
let quotSeq = {
303+
0: ['subject', 'date', 'from', 'to', 'cc'], // Default
304+
1: ['from', 'date', 'to', 'cc', 'subject'], // Outlook
305+
2: ['from', 'date', 'subject'], // Simple
306+
3: ['from', 'to', 'cc', 'date', 'subject'] // Lookout
307+
};
308+
return quotSeq[selectedOption];
309+
},
310+
301311
parseMsgHeader: function(hdr) {
302312
// Decoding values into object
303313
// Ref: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMsgDBHdr
@@ -328,6 +338,8 @@ var ReplyWithHeader = {
328338
let rawHdr = this.getMsgHeader(this.messageUri);
329339
let pHeader = this.parseMsgHeader(rawHdr);
330340
let headerQuotLblSeq = this.prefs.headerQuotLblSeq;
341+
let headerQuotLblSeqValues = this.getHeaderQuotSeq(headerQuotLblSeq);
342+
this.log.debug('headerQuotLblSeq: ' + headerQuotLblSeq + ' \tValues: ' + headerQuotLblSeqValues);
331343

332344
var rwhHdr = '<div id="rwhMsgHeader">';
333345

@@ -341,10 +353,19 @@ var ReplyWithHeader = {
341353
let fontSize = this.prefs.headerFontSize;
342354
let fontSizeUnit = this.prefs.headerFontSizeUnit;
343355
let fontColor = this.prefs.headerFontColor;
356+
let systemFontColor = this.prefs.headerSystemFontColor;
357+
let systemFontFace = this.prefs.headerSystemFontFace;
358+
this.log.debug('System Font face: ' + systemFontFace + '\tSystem Font Color: ' + systemFontColor);
344359
this.log.debug('Font face: ' + fontFace + '\tFont size: ' + fontSize + fontSizeUnit + '\tColor: ' + fontColor);
345360

346-
let htmlTagPrefix = '<div style="font-family:' + fontFace + ' !important; color:'
347-
+ fontColor + ' !important; font-size:' + fontSize + fontSizeUnit + ' !important;">';
361+
let htmlTagPrefix = '<div style="';
362+
if (!systemFontFace) {
363+
htmlTagPrefix += 'font-family:' + fontFace + ' !important;';
364+
}
365+
if (!systemFontColor) {
366+
htmlTagPrefix += ' color:' + fontColor + ' !important;';
367+
}
368+
htmlTagPrefix += ' font-size:' + fontSize + fontSizeUnit + ' !important;">';
348369
let htmlTagSuffix = '</div>';
349370

350371
let lineColor = this.prefs.headerSepLineColor;
@@ -353,38 +374,16 @@ var ReplyWithHeader = {
353374

354375
rwhHdr += this.createBrTags(this.prefs.beforeHdrSpaceCnt);
355376

356-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.from[locale] + '</b> ' + pHeader.from + htmlTagSuffix;
357-
358-
if (headerQuotLblSeq == 0) { // jshint ignore:line
359-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.subject[locale] + '</b> ' + pHeader.subject + htmlTagSuffix;
360-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.date[locale] + '</b> ' + pHeader.date + htmlTagSuffix;
361-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.to[locale] + '</b> ' + pHeader.to + htmlTagSuffix;
362-
363-
if (pHeader.cc) {
364-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.cc[locale] + '</b> ' + pHeader.cc + htmlTagSuffix;
377+
headerQuotLblSeqValues.forEach(function (hdrKey, _) {
378+
let lbl = this.i18n[hdrKey][locale]
379+
if (headerQuotLblSeq == 1 && hdrKey == 'date') {
380+
lbl = this.i18n['sent'][locale]
365381
}
366-
} else if (headerQuotLblSeq == 3) {
367-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.to[locale] + '</b> ' + pHeader.to + htmlTagSuffix;
368382

369-
if (pHeader.cc) {
370-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.cc[locale] + '</b> ' + pHeader.cc + htmlTagSuffix;
371-
}
372-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.date[locale] + '</b> ' + pHeader.date + htmlTagSuffix;
373-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.subject[locale] + '</b> ' + pHeader.subject + htmlTagSuffix;
374-
} else if (headerQuotLblSeq == 1) {
375-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.sent[locale] + '</b> ' + pHeader.date + htmlTagSuffix;
376-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.to[locale] + '</b> ' + pHeader.to + htmlTagSuffix;
377-
378-
if (pHeader.cc) {
379-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.cc[locale] + '</b> ' + pHeader.cc + htmlTagSuffix;
383+
if (pHeader[hdrKey]) {
384+
rwhHdr += htmlTagPrefix + '<b>' + lbl + '</b> ' + pHeader[hdrKey] + htmlTagSuffix;
380385
}
381-
382-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.subject[locale] + '</b> ' + pHeader.subject + htmlTagSuffix;
383-
384-
} else if (headerQuotLblSeq == 2) {
385-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.sent[locale] + '</b> ' + pHeader.date + htmlTagSuffix;
386-
rwhHdr += htmlTagPrefix + '<b>' + this.i18n.subject[locale] + '</b> ' + pHeader.subject + htmlTagSuffix;
387-
}
386+
}, this);
388387

389388
} else { // for plain/text emails
390389
if (!this.prefs.excludePlainTxtHdrPrefix) {
@@ -399,38 +398,17 @@ var ReplyWithHeader = {
399398

400399
rwhHdr += this.createBrTags(this.prefs.beforeHdrSpaceCnt);
401400

402-
rwhHdr += this.i18n.from[locale] + ' ' + pHeader.from + '<br/>';
403-
404-
if (headerQuotLblSeq == 0) { // jshint ignore:line
405-
rwhHdr += this.i18n.subject[locale] + ' ' + pHeader.subject + '<br/>';
406-
rwhHdr += this.i18n.date[locale] + ' ' + pHeader.date + '<br/>';
407-
rwhHdr += this.i18n.to[locale] + ' ' + pHeader.to + '<br/>';
408-
409-
if (pHeader.cc) {
410-
rwhHdr += this.i18n.cc[locale] + ' ' + pHeader.cc + '<br/>';
401+
headerQuotLblSeqValues.forEach(function (hdrKey, _) {
402+
let lbl = this.i18n[hdrKey][locale]
403+
if (headerQuotLblSeq == 1 && hdrKey == 'date') {
404+
lbl = this.i18n['sent'][locale]
411405
}
412-
} else if (headerQuotLblSeq == 3) {
413-
rwhHdr += this.i18n.to[locale] + ' ' + pHeader.to + '<br/>';
414406

415-
if (pHeader.cc) {
416-
rwhHdr += this.i18n.cc[locale] + ' ' + pHeader.cc + '<br/>';
417-
}
418-
rwhHdr += this.i18n.date[locale] + ' ' + pHeader.date + '<br/>';
419-
rwhHdr += this.i18n.subject[locale] + ' ' + pHeader.subject + '<br/>';
420-
} else if (headerQuotLblSeq == 1) {
421-
rwhHdr += this.i18n.sent[locale] + ' ' + pHeader.date + '<br/>';
422-
rwhHdr += this.i18n.to[locale] + ' ' + pHeader.to + '<br/>';
423-
424-
if (pHeader.cc) {
425-
rwhHdr += this.i18n.cc[locale] + ' ' + pHeader.cc + '<br/>';
407+
if (pHeader[hdrKey]) {
408+
rwhHdr += lbl + ' ' + pHeader[hdrKey] + '<br/>';
426409
}
410+
}, this);
427411

428-
rwhHdr += this.i18n.subject[locale] + ' ' + pHeader.subject + '<br/>';
429-
430-
} else if (headerQuotLblSeq == 2) {
431-
rwhHdr += this.i18n.sent[locale] + ' ' + pHeader.date + '<br/>';
432-
rwhHdr += this.i18n.subject[locale] + ' ' + pHeader.subject + '<br/>';
433-
}
434412
}
435413

436414
rwhHdr += this.createBrTags(this.prefs.afterHdrSpaceCnt);

chrome/content/i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ var i18n = {
166166
"pt": "Mensagem encaminhada",
167167
"pt-BR": "Encaminhou",
168168
"ko": "전달된 메시지",
169-
"nl": "het volgende geschreven",
169+
"nl": "Doorgestuurd bericht",
170170
"nb": "Videresendt melding",
171171
"ru": "переадресованного сообщения",
172172
"sv": "Vidarebefordrat brev",

chrome/content/prefs.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ var prefs = {
7777
return this.getStringPref('header.font.face');
7878
},
7979

80+
get headerSystemFontFace() {
81+
return this.getBoolPref('header.system.font.face');
82+
},
83+
8084
get headerFontSize() {
8185
return this.getIntPref('header.font.size');
8286
},
@@ -89,6 +93,10 @@ var prefs = {
8993
return this.getStringPref('header.font.color');
9094
},
9195

96+
get headerSystemFontColor() {
97+
return this.getBoolPref('header.system.font.color');
98+
},
99+
92100
get headerQuotLblSeq() {
93101
return this.getIntPref('header.lblseq.style');
94102
},

manifest.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "ReplyWithHeader",
3-
"short_name": "RWH",
43
"description": "Outlook style headers and few goodies for Thunderbird",
54
"version": "2.6.0",
65
"author": "Jeevanandam M.",

options/options.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@
102102
<div class="label" id="lblFontface">Font face:</div>
103103
<div class="hbox">
104104
<select id="hdrFontface" data-preference="header.font.face"></select>
105+
<div class="spacer"></div>
106+
<label style="margin-right: 7px;">
107+
<input type="checkbox" id="hdrSystemFontface" data-preference="header.system.font.face" />
108+
Use system font
109+
</label>
105110
</div>
106111

107112
<div class="label" id="lblFontsize">Font size:</div>
@@ -116,6 +121,11 @@
116121
<div class="label" id="lblFontcolor">Color:</div>
117122
<div class="hbox">
118123
<input id="hdrFontColor" type="color" data-preference="header.font.color" />
124+
<div class="spacer"></div>
125+
<label>
126+
<input type="checkbox" id="hdrFontSystemColor" data-preference="header.system.font.color" />
127+
Use system color
128+
</label>
119129
</div>
120130
</div>
121131
</fieldset>

scripts/background.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ const PREF_DEFAULTS = {
1919
"header.lblseq.style": 1,
2020
"header.locale": "en-US",
2121
"header.font.face": "Tahoma",
22+
"header.system.font.face": false,
2223
"header.font.size": 13,
2324
"header.font.size.unit": "px",
2425
"header.font.color": "#000000",
26+
"header.system.font.color": false,
2527
"header.separator.space.before": 1,
2628
"header.space.before": 0,
2729
"header.space.after": 1,

0 commit comments

Comments
 (0)