From c8f67293661cfab49edf5ca9fd9c2aeeaf6ff7e4 Mon Sep 17 00:00:00 2001 From: mic Date: Sun, 2 Feb 2025 21:43:08 +0100 Subject: [PATCH] add_tags_auto and add_tags_auto_force_existing options added. see #237 --- _locales/en/messages.json | 16 ++++++++++++++++ options/mzta-options-default.js | 2 ++ pages/addtags/mzta-add-tags.css | 2 +- pages/addtags/mzta-add-tags.html | 18 ++++++++++++++++++ pages/addtags/mzta-add-tags.js | 10 ++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index c96484bd..a801908c 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1018,5 +1018,21 @@ "sparks_not_installed": { "message": "ThunderAI Sparks not installed!", "description": "" + }, + "prefs_OptionText_add_tags_auto": { + "message": "Add tags automatically", + "description": "" + }, + "prefs_OptionText_add_tags_auto_Info": { + "message": "If checked, the AI will automatically add tags to newly received emails.", + "description": "" + }, + "prefs_OptionText_add_tags_auto_force_existing": { + "message": "Force existing tags when autotagging", + "description": "" + }, + "prefs_OptionText_add_tags_auto_force_existing_Info": { + "message": "If checked, the AI will add only existing tags to newly received emails, and won't create new tags.", + "description": "" } } \ No newline at end of file diff --git a/options/mzta-options-default.js b/options/mzta-options-default.js index 10e08fe6..6c804352 100644 --- a/options/mzta-options-default.js +++ b/options/mzta-options-default.js @@ -46,5 +46,7 @@ export const prefs_default = { add_tags_hide_exclusions: false, add_tags_first_uppercase: true, add_tags_force_lang: true, + add_tags_auto: false, + add_tags_auto_force_existing: false, get_calendar_event: true, } \ No newline at end of file diff --git a/pages/addtags/mzta-add-tags.css b/pages/addtags/mzta-add-tags.css index c012a1a7..dd2f01a8 100644 --- a/pages/addtags/mzta-add-tags.css +++ b/pages/addtags/mzta-add-tags.css @@ -27,7 +27,7 @@ justify-content: space-between; } -#addtags_info_additional_statements{ +#addtags_info_additional_statements, #add_tags_auto_force_existing_tr{ display: none; } diff --git a/pages/addtags/mzta-add-tags.html b/pages/addtags/mzta-add-tags.html index f7e0f81f..b6b8c94c 100644 --- a/pages/addtags/mzta-add-tags.html +++ b/pages/addtags/mzta-add-tags.html @@ -49,6 +49,24 @@ + + __MSG_prefs_OptionText_add_tags_auto__ + + + + + + __MSG_prefs_OptionText_add_tags_auto_force_existing__ + + + +
__MSG_AddTags_prompt_text_title__ diff --git a/pages/addtags/mzta-add-tags.js b/pages/addtags/mzta-add-tags.js index b770c8dd..06d9119d 100644 --- a/pages/addtags/mzta-add-tags.js +++ b/pages/addtags/mzta-add-tags.js @@ -53,6 +53,16 @@ document.addEventListener('DOMContentLoaded', async () => { } }); + let add_tags_auto_el = document.getElementById('add_tags_auto'); + let add_tags_auto_force_existing_tr = document.getElementById('add_tags_auto_force_existing_tr'); + add_tags_auto_el.addEventListener('click', (event) => { + add_tags_auto_force_existing_tr.style.display = event.target.checked ? 'table-row' : 'none'; + if(!event.target.checked){ + document.getElementById('add_tags_auto_force_existing').checked = false; + } + }); + add_tags_auto_force_existing_tr.style.display = add_tags_auto_el.checked ? 'table-row' : 'none'; + addtags_reset_btn.addEventListener('click', () => { addtags_textarea.value = browser.i18n.getMessage('prompt_add_tags_full_text'); addtags_reset_btn.disabled = true;