diff --git a/CHANGELOG.md b/CHANGELOG.md index b69fa898..bb667524 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,49 +1,81 @@ # ![ThunderAI icon](images/icon-32px.png "ThunderAI") ThunderAI Release Notes + +

Version 1.1.0 - ??/??/2024

+ +

Version 1.0.10 - 17/05/2024

+ + +

Version 1.0.9 - 16/05/2024

+ + +

Version 1.0.8 - 15/05/2024

+ + +

Version 1.0.7 - 09/05/2024

+ +

Version 1.0.6 - 08/05/2024

+

Version 1.0.5 - 03/05/2024

+

Version 1.0.4 - 01/05/2024

+

Version 1.0.3 - 27/04/2024

+

Version 1.0.2 - 18/04/2024

+

Version 1.0.1 - 13/04/2024

+

Version 1.0 - 05/04/2024

\ No newline at end of file +
  • First release.
  • + diff --git a/README.md b/README.md index 787b743b..4eda0624 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,13 @@ # ![ThunderAI icon](images/icon-32px.png "ThunderAI") ThunderAI +> [!IMPORTANT] +> ## Custom Prompts are coming! +> +> Try this new feature in the [new pre-release version](https://github.com/micz/ThunderAI/releases/tag/v1.1.0pre3). + +
    + + ThunderAI is a Thunderbird Addon that uses the capabilities of ChatGPT to enhance email management. It enables users to analyze, write, correct, and optimize their emails, facilitating more effective and professional communication. diff --git a/js/mzta-chatgpt.js b/js/mzta-chatgpt.js index 8379694d..d06ed593 100644 --- a/js/mzta-chatgpt.js +++ b/js/mzta-chatgpt.js @@ -107,8 +107,7 @@ async function chatgpt_getFromDOM(pos) { ); response = responseDivs[nthOfResponse - 1].textContent; } - response = response.replace(/^ChatGPTChatGPT/, ''); // strip sender name - response = response.replace(/^ChatGPT/, ''); // strip sender name + response = response.replace(/^ChatGPT(?:ChatGPT)?/, ''); // strip sender name response = response.trim().replace(/^"|"$/g, ''); // strip quotation marks //console.log('chatgpt_getFromDOM: ' + response); } diff --git a/js/mzta-compose-script.js b/js/mzta-compose-script.js index b7ad0295..99d8f45e 100644 --- a/js/mzta-compose-script.js +++ b/js/mzta-compose-script.js @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -// Some original methods are a modified version derived from https://github.com/ali-raheem/Aify/blob/13ff87583bc520fb80f555ab90a90c5c9df797a7/plugin/content_scripts/compose.js +// Some methods are a modified version derived from https://github.com/ali-raheem/Aify/blob/13ff87583bc520fb80f555ab90a90c5c9df797a7/plugin/content_scripts/compose.js const makeParagraphs = (text, func) => { const chunks = text.split(/\n{2,}/); diff --git a/js/mzta-utils.js b/js/mzta-utils.js index 336f2010..098e149b 100644 --- a/js/mzta-utils.js +++ b/js/mzta-utils.js @@ -93,15 +93,31 @@ export async function replaceBody(tabId, text){ const insertText = function (text, fullBody_string) { const parser = new DOMParser(); let fullBody = parser.parseFromString(fullBody_string, "text/html"); - const prefix = fullBody.getElementsByClassName("moz-cite-prefix"); - if (prefix.length > 0) { - const divider = prefix[0]; - let sibling = divider.previousSibling; + + // looking for the first quoted mail or the signature, which come first in case of "signature above the quote". + const prefix_quote = fullBody.getElementsByClassName("moz-cite-prefix"); + const prefix_sign = fullBody.getElementsByClassName("moz-signature"); + + let firstElement = null; + if (prefix_quote.length > 0 && prefix_sign.length > 0) { + firstElement = prefix_quote[0].compareDocumentPosition(prefix_sign[0]) & Node.DOCUMENT_POSITION_FOLLOWING ? prefix_quote[0] : prefix_sign[0]; + //console.log('>>>>>>>>>>>>>>> quote and signature found: ' + JSON.stringify(firstElement.innerHTML)) + //console.log('>>>>>>>>>>>>>>> DocPosition: ' + prefix_quote[0].compareDocumentPosition(prefix_sign[0])) + } else if (prefix_quote.length > 0) { + firstElement = prefix_quote[0]; + //console.log('>>>>>>>>>>>>>>> quote found') + } else if (prefix_sign.length > 0) { + firstElement = prefix_sign[0]; + //console.log('>>>>>>>>>>>>>>> signature found') + } + if (firstElement) { + let sibling = firstElement.previousSibling; while (sibling) { fullBody.body.removeChild(sibling); - sibling = divider.previousSibling; + sibling = firstElement.previousSibling; } } + let final_p = document.createElement("p"); final_p.innerHTML = "



    "; fullBody.body.insertBefore(final_p, fullBody.body.firstChild); diff --git a/options/mzta-release-notes.html b/options/mzta-release-notes.html index 314b71b0..8cebe284 100644 --- a/options/mzta-release-notes.html +++ b/options/mzta-release-notes.html @@ -15,46 +15,76 @@
  • Added some error messages to handle potential changes in the ChatGPT web interface.
  • German translation added.
  • -

    Version 1.0.6 - 08/05/2024

    - -

    Version 1.0.5 - 03/05/2024

    - -

    Version 1.0.4 - 01/05/2024

    - + +

    Version 1.0.3 - 27/04/2024

    + + +

    Version 1.0.2 - 18/04/2024

    + + +

    Version 1.0.1 - 13/04/2024

    + + +

    Version 1.0 - 05/04/2024

    +