diff --git a/background.js b/background.js index f569bbb..7aeaa36 100644 --- a/background.js +++ b/background.js @@ -25,9 +25,12 @@ messenger.runtime.onInstalled.addListener(async function (details) { messenger.accounts.onCreated.addListener(async function (id, account) { rwhLogger.debug('onCreated', id, account); - if (account.type === 'imap' || account.type === 'pop3') { - rwhSettings.setDefault(`${id}.enabled`, true); - } + rwhSettings.setDefault(`${id}.enabled`, true); + + // TODO revisit later on + // if (account.type === 'imap' || account.type === 'pop3') { + // rwhSettings.setDefault(`${id}.enabled`, true); + // } }); messenger.accounts.onDeleted.addListener(async function (id) { diff --git a/manifest.json b/manifest.json index 900bfbc..1bd6ad6 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "ReplyWithHeader", "description": "Outlook style headers and few goodies for Thunderbird", - "version": "3.0.0", + "version": "3.1.0-dev", "author": "Jeevanandam M.", "homepage_url": "https://myjeeva.com/replywithheader-mozilla", "browser_specific_settings": { diff --git a/modules/accounts.mjs b/modules/accounts.mjs index 4eefc52..a0d5044 100644 --- a/modules/accounts.mjs +++ b/modules/accounts.mjs @@ -22,7 +22,7 @@ export async function findIdByIdentityId(identityId) { } export async function all() { - let accounts = await messenger.accounts.list(); + let accounts = await messenger.accounts.list(false); let res = []; for (let account of accounts) { if (account.type === 'none') { continue }; diff --git a/modules/compose.mjs b/modules/compose.mjs index e1188cf..b88cff3 100644 --- a/modules/compose.mjs +++ b/modules/compose.mjs @@ -19,6 +19,7 @@ const positionBeforeBegin = 'beforebegin'; const positionAfterBegin = 'afterbegin'; const fwdHdrLookupString = '-------- '; const plainTextFirstChars = '> '; +const cleanBlockQuoteStyle = 'border:none !important; padding-left:0px !important; margin-left:0px !important;'; export async function process(tab) { rwhLogger.debug(`tab.id=${tab.id}, tab.type=${tab.type}, tab.mailTab=${tab.mailTab}`); @@ -176,6 +177,17 @@ class ReplyWithHeader { // put back the cleaned up
tags as-is if (this.isReply) { div.insertAdjacentElement(positionAfterBegin, this._createElement('br')); + + // blockquote + if (await rwhSettings.isCleanAllBlockQuoteColor()) { // all + let bqs = this._getAllByTagName('blockquote'); + for (let b of bqs) { + b.setAttribute('style', cleanBlockQuoteStyle); + } + } else if (await rwhSettings.isCleanBlockQuoteColor()) { // first level + let bq = this._getByTagName('blockquote'); + bq.setAttribute('style', cleanBlockQuoteStyle); + } } if (this.isForward) { let mozForwardContainer = this._getByClassName('moz-forward-container'); @@ -183,12 +195,6 @@ class ReplyWithHeader { mozForwardContainer.insertAdjacentElement(positionAfterBegin, this._createElement('br')); } - // blockquote - if (await rwhSettings.isCleanBlockQuoteColor() && this.isReply) { - let bq = this._getByTagName('blockquote'); - bq.setAttribute('style', 'border:none !important;padding-left:0 !important;'); - } - return { body: new XMLSerializer().serializeToString(this.#document), } @@ -410,7 +416,11 @@ class ReplyWithHeader { } _getByTagName(tagName) { - return this.#document?.getElementsByTagName(tagName)?.[0]; + return this._getAllByTagName(tagName)?.[0]; + } + + _getAllByTagName(tagName) { + return this.#document?.getElementsByTagName(tagName); } _createElement(tagName) { diff --git a/modules/settings.mjs b/modules/settings.mjs index e96ab5b..0e7c5aa 100755 --- a/modules/settings.mjs +++ b/modules/settings.mjs @@ -37,6 +37,7 @@ let keyHeaderHtmlPrefixLine = 'header.html.prefix.line'; let keyHeaderHtmlPrefixLineColor = 'header.html.prefix.line.color'; let keyTransSubjectPrefix = 'trans.subject.prefix'; let keyCleanBlockQuoteColor = 'clean.blockquote.color'; +let keyCleanAllBlockQuoteColor = 'clean.blockquote.all.color'; let keyCleanQuoteCharGreaterThan = 'clean.quote.char.greaterthan'; let rwhDefaultSettings = { @@ -63,6 +64,7 @@ let rwhDefaultSettings = { [keyHeaderTimeZone]: true, [keyCleanBlockQuoteColor]: true, + [keyCleanAllBlockQuoteColor]: false, [keyCleanQuoteCharGreaterThan]: true, } @@ -157,6 +159,10 @@ export async function isCleanBlockQuoteColor() { return await get(keyCleanBlockQuoteColor, rwhDefaultSettings[keyCleanBlockQuoteColor]); } +export async function isCleanAllBlockQuoteColor() { + return await get(keyCleanAllBlockQuoteColor, rwhDefaultSettings[keyCleanAllBlockQuoteColor]); +} + export async function isCleanQuoteCharGreaterThan() { return await get(keyCleanQuoteCharGreaterThan, rwhDefaultSettings[keyCleanQuoteCharGreaterThan]); } diff --git a/options/options.html b/options/options.html index 2913c1e..46294fa 100644 --- a/options/options.html +++ b/options/options.html @@ -104,7 +104,13 @@
+
+
+