showing a warning message if sparks is not present. see #182

This commit is contained in:
mic 2025-01-11 23:09:48 +01:00
parent 5ea13e6443
commit decb529cb0
4 changed files with 29 additions and 3 deletions

View file

@ -990,5 +990,13 @@
"prefs_OptionText_GetCalendarEvent_infoline2": {
"message": "You can change the prompt as you wish, but the response received from the AI must be in JSON format as specified in the default prompt!",
"description": ""
},
"prefs_OptionText_get_calendar_event_Sparks_not_present": {
"message": "To use the calendar event feature, please install the ThunderAI Sparks addon.",
"description": ""
},
"prefs_OptionText_download_now": {
"message": "Download ThunderAI Sparks now!",
"description": ""
}
}

View file

@ -118,6 +118,12 @@ tr.conntype_google_gemini_api, tr.conntype_google_gemini_api2{
font-style: italic;
}
#no_sparks td{
text-align: center;
padding: 1em !important;
background: #bbf7f1;
}
textarea.option-textarea{
width: -moz-available;
height: 10em;
@ -244,4 +250,7 @@ input.option-input[type="text"]{
background-color: rgb(2, 0, 100);
}
#no_sparks td{
background: #3b514f;
}
}

View file

@ -344,6 +344,12 @@
</label>
</td>
</tr>
<tr class="get_calendar_event_tr" id="no_sparks">
<td colspan="2">
<span>__MSG_prefs_OptionText_get_calendar_event_Sparks_not_present__</span>
<br><a href="https://addons.thunderbird.net/it/thunderbird/addon/thunderai-sparks">__MSG_prefs_OptionText_download_now__</a>
</td>
</tr>
<tr>
<td style="width:20em"><label>
<span>__MSG_Debug__</span>

View file

@ -262,14 +262,17 @@ function disable_AddTags(){
});
}
function disable_GetCalendarEvent(){
async function disable_GetCalendarEvent(){
let get_calendar_event = document.getElementById('get_calendar_event');
let no_sparks_tr = document.getElementById('no_sparks');
let is_spark_present = await checkSparksPresence()
let conntype_select = document.getElementById("connection_type");
get_calendar_event.disabled = (conntype_select.value === "chatgpt_web");
get_calendar_event.disabled = (conntype_select.value === "chatgpt_web") || !is_spark_present;
let get_calendar_event_tr_elements = document.querySelectorAll('.get_calendar_event_tr');
get_calendar_event_tr_elements.forEach(get_calendar_event_tr => {
get_calendar_event_tr.style.display = (get_calendar_event.disabled) ? 'none' : 'table-row';
get_calendar_event_tr.style.display = get_calendar_event.disabled ? 'none' : 'table-row';
});
no_sparks_tr.style.display = is_spark_present ? 'none' : 'table-row';
}
document.addEventListener('DOMContentLoaded', async () => {