add_tags_auto and add_tags_auto_force_existing options added. see #237

This commit is contained in:
mic 2025-02-02 21:43:08 +01:00
parent 80dc0aa2c8
commit c8f6729366
5 changed files with 47 additions and 1 deletions

View file

@ -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": ""
}
}

View file

@ -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,
}

View file

@ -27,7 +27,7 @@
justify-content: space-between;
}
#addtags_info_additional_statements{
#addtags_info_additional_statements, #add_tags_auto_force_existing_tr{
display: none;
}

View file

@ -49,6 +49,24 @@
</label>
</td>
</tr>
<tr class="add_tags_tr">
<td><span>__MSG_prefs_OptionText_add_tags_auto__</span></td>
<td>
<label>
<input type="checkbox" id="add_tags_auto" name="add_tags_auto" class="option-input" />
__MSG_prefs_OptionText_add_tags_auto_Info__
</label>
</td>
</tr>
<tr class="add_tags_tr" id="add_tags_auto_force_existing_tr">
<td><span>__MSG_prefs_OptionText_add_tags_auto_force_existing__</span></td>
<td>
<label>
<input type="checkbox" id="add_tags_auto_force_existing" name="add_tags_auto_force_existing" class="option-input" />
__MSG_prefs_OptionText_add_tags_auto_force_existing_Info__
</label>
</td>
</tr>
</table>
<div id="addtags_prompt_container">
<span class="section_title">__MSG_AddTags_prompt_text_title__</span><span id="addtags_prompt_unsaved" class="unsaved hidden"> __MSG_customPrompts_unsaved_changes__</span>

View file

@ -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;