diff --git a/README.md b/README.md index 1ff056d..c9a64a9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Quoting Email Headers in Thunderbird - [![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) + [![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) ReplyWithHeaderMozilla aka [RWH Thunderbird] is an add-on for Thunderbird mail client that enables email header. Brings Outlook header capabilities into Thunderbird. diff --git a/chrome/content/core.js b/chrome/content/core.js index 7c5f481..26669db 100755 --- a/chrome/content/core.js +++ b/chrome/content/core.js @@ -298,6 +298,16 @@ var ReplyWithHeader = { return recipients.trim(); }, + getHeaderQuotSeq: function(selectedOption) { + let quotSeq = { + 0: ['subject', 'date', 'from', 'to', 'cc'], // Default + 1: ['from', 'date', 'to', 'cc', 'subject'], // Outlook + 2: ['from', 'date', 'subject'], // Simple + 3: ['from', 'to', 'cc', 'date', 'subject'] // Lookout + }; + return quotSeq[selectedOption]; + }, + parseMsgHeader: function(hdr) { // Decoding values into object // Ref: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMsgDBHdr @@ -328,6 +338,8 @@ var ReplyWithHeader = { let rawHdr = this.getMsgHeader(this.messageUri); let pHeader = this.parseMsgHeader(rawHdr); let headerQuotLblSeq = this.prefs.headerQuotLblSeq; + let headerQuotLblSeqValues = this.getHeaderQuotSeq(headerQuotLblSeq); + this.log.debug('headerQuotLblSeq: ' + headerQuotLblSeq + ' \tValues: ' + headerQuotLblSeqValues); var rwhHdr = '
'; @@ -341,10 +353,19 @@ var ReplyWithHeader = { let fontSize = this.prefs.headerFontSize; let fontSizeUnit = this.prefs.headerFontSizeUnit; let fontColor = this.prefs.headerFontColor; + let systemFontColor = this.prefs.headerSystemFontColor; + let systemFontFace = this.prefs.headerSystemFontFace; + this.log.debug('System Font face: ' + systemFontFace + '\tSystem Font Color: ' + systemFontColor); this.log.debug('Font face: ' + fontFace + '\tFont size: ' + fontSize + fontSizeUnit + '\tColor: ' + fontColor); - let htmlTagPrefix = '
'; + let htmlTagPrefix = '
'; let htmlTagSuffix = '
'; let lineColor = this.prefs.headerSepLineColor; @@ -353,38 +374,16 @@ var ReplyWithHeader = { rwhHdr += this.createBrTags(this.prefs.beforeHdrSpaceCnt); - rwhHdr += htmlTagPrefix + '' + this.i18n.from[locale] + ' ' + pHeader.from + htmlTagSuffix; - - if (headerQuotLblSeq == 0) { // jshint ignore:line - rwhHdr += htmlTagPrefix + '' + this.i18n.subject[locale] + ' ' + pHeader.subject + htmlTagSuffix; - rwhHdr += htmlTagPrefix + '' + this.i18n.date[locale] + ' ' + pHeader.date + htmlTagSuffix; - rwhHdr += htmlTagPrefix + '' + this.i18n.to[locale] + ' ' + pHeader.to + htmlTagSuffix; - - if (pHeader.cc) { - rwhHdr += htmlTagPrefix + '' + this.i18n.cc[locale] + ' ' + pHeader.cc + htmlTagSuffix; + headerQuotLblSeqValues.forEach(function (hdrKey, _) { + let lbl = this.i18n[hdrKey][locale] + if (headerQuotLblSeq == 1 && hdrKey == 'date') { + lbl = this.i18n['sent'][locale] } - } else if (headerQuotLblSeq == 3) { - rwhHdr += htmlTagPrefix + '' + this.i18n.to[locale] + ' ' + pHeader.to + htmlTagSuffix; - if (pHeader.cc) { - rwhHdr += htmlTagPrefix + '' + this.i18n.cc[locale] + ' ' + pHeader.cc + htmlTagSuffix; - } - rwhHdr += htmlTagPrefix + '' + this.i18n.date[locale] + ' ' + pHeader.date + htmlTagSuffix; - rwhHdr += htmlTagPrefix + '' + this.i18n.subject[locale] + ' ' + pHeader.subject + htmlTagSuffix; - } else if (headerQuotLblSeq == 1) { - rwhHdr += htmlTagPrefix + '' + this.i18n.sent[locale] + ' ' + pHeader.date + htmlTagSuffix; - rwhHdr += htmlTagPrefix + '' + this.i18n.to[locale] + ' ' + pHeader.to + htmlTagSuffix; - - if (pHeader.cc) { - rwhHdr += htmlTagPrefix + '' + this.i18n.cc[locale] + ' ' + pHeader.cc + htmlTagSuffix; + if (pHeader[hdrKey]) { + rwhHdr += htmlTagPrefix + '' + lbl + ' ' + pHeader[hdrKey] + htmlTagSuffix; } - - rwhHdr += htmlTagPrefix + '' + this.i18n.subject[locale] + ' ' + pHeader.subject + htmlTagSuffix; - - } else if (headerQuotLblSeq == 2) { - rwhHdr += htmlTagPrefix + '' + this.i18n.sent[locale] + ' ' + pHeader.date + htmlTagSuffix; - rwhHdr += htmlTagPrefix + '' + this.i18n.subject[locale] + ' ' + pHeader.subject + htmlTagSuffix; - } + }, this); } else { // for plain/text emails if (!this.prefs.excludePlainTxtHdrPrefix) { @@ -399,38 +398,17 @@ var ReplyWithHeader = { rwhHdr += this.createBrTags(this.prefs.beforeHdrSpaceCnt); - rwhHdr += this.i18n.from[locale] + ' ' + pHeader.from + '
'; - - if (headerQuotLblSeq == 0) { // jshint ignore:line - rwhHdr += this.i18n.subject[locale] + ' ' + pHeader.subject + '
'; - rwhHdr += this.i18n.date[locale] + ' ' + pHeader.date + '
'; - rwhHdr += this.i18n.to[locale] + ' ' + pHeader.to + '
'; - - if (pHeader.cc) { - rwhHdr += this.i18n.cc[locale] + ' ' + pHeader.cc + '
'; + headerQuotLblSeqValues.forEach(function (hdrKey, _) { + let lbl = this.i18n[hdrKey][locale] + if (headerQuotLblSeq == 1 && hdrKey == 'date') { + lbl = this.i18n['sent'][locale] } - } else if (headerQuotLblSeq == 3) { - rwhHdr += this.i18n.to[locale] + ' ' + pHeader.to + '
'; - if (pHeader.cc) { - rwhHdr += this.i18n.cc[locale] + ' ' + pHeader.cc + '
'; - } - rwhHdr += this.i18n.date[locale] + ' ' + pHeader.date + '
'; - rwhHdr += this.i18n.subject[locale] + ' ' + pHeader.subject + '
'; - } else if (headerQuotLblSeq == 1) { - rwhHdr += this.i18n.sent[locale] + ' ' + pHeader.date + '
'; - rwhHdr += this.i18n.to[locale] + ' ' + pHeader.to + '
'; - - if (pHeader.cc) { - rwhHdr += this.i18n.cc[locale] + ' ' + pHeader.cc + '
'; + if (pHeader[hdrKey]) { + rwhHdr += lbl + ' ' + pHeader[hdrKey] + '
'; } + }, this); - rwhHdr += this.i18n.subject[locale] + ' ' + pHeader.subject + '
'; - - } else if (headerQuotLblSeq == 2) { - rwhHdr += this.i18n.sent[locale] + ' ' + pHeader.date + '
'; - rwhHdr += this.i18n.subject[locale] + ' ' + pHeader.subject + '
'; - } } rwhHdr += this.createBrTags(this.prefs.afterHdrSpaceCnt); diff --git a/chrome/content/i18n.js b/chrome/content/i18n.js index d51a904..c1effd3 100755 --- a/chrome/content/i18n.js +++ b/chrome/content/i18n.js @@ -166,7 +166,7 @@ var i18n = { "pt": "Mensagem encaminhada", "pt-BR": "Encaminhou", "ko": "전달된 메시지", - "nl": "het volgende geschreven", + "nl": "Doorgestuurd bericht", "nb": "Videresendt melding", "ru": "переадресованного сообщения", "sv": "Vidarebefordrat brev", diff --git a/chrome/content/prefs.js b/chrome/content/prefs.js index dc80266..86c5e2c 100755 --- a/chrome/content/prefs.js +++ b/chrome/content/prefs.js @@ -77,6 +77,10 @@ var prefs = { return this.getStringPref('header.font.face'); }, + get headerSystemFontFace() { + return this.getBoolPref('header.system.font.face'); + }, + get headerFontSize() { return this.getIntPref('header.font.size'); }, @@ -89,6 +93,10 @@ var prefs = { return this.getStringPref('header.font.color'); }, + get headerSystemFontColor() { + return this.getBoolPref('header.system.font.color'); + }, + get headerQuotLblSeq() { return this.getIntPref('header.lblseq.style'); }, diff --git a/manifest.json b/manifest.json index ce289ed..6284715 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,5 @@ { "name": "ReplyWithHeader", - "short_name": "RWH", "description": "Outlook style headers and few goodies for Thunderbird", "version": "2.6.0", "author": "Jeevanandam M.", diff --git a/options/options.html b/options/options.html index 4ff98d2..06d3758 100644 --- a/options/options.html +++ b/options/options.html @@ -102,6 +102,11 @@
Font face:
+
+
Font size:
@@ -116,6 +121,11 @@
Color:
+
+
diff --git a/scripts/background.js b/scripts/background.js index 45f2f54..f7c1c96 100644 --- a/scripts/background.js +++ b/scripts/background.js @@ -19,9 +19,11 @@ const PREF_DEFAULTS = { "header.lblseq.style": 1, "header.locale": "en-US", "header.font.face": "Tahoma", + "header.system.font.face": false, "header.font.size": 13, "header.font.size.unit": "px", "header.font.color": "#000000", + "header.system.font.color": false, "header.separator.space.before": 1, "header.space.before": 0, "header.space.after": 1,