get_calendar_event added in the options page. see micz/ThunderAI/#182

This commit is contained in:
mic 2025-01-10 23:13:54 +01:00
parent 1af7a18a84
commit a03c11794a
5 changed files with 48 additions and 4 deletions

View file

@ -955,12 +955,24 @@
"message": "Typed text before the quoted mail body", "message": "Typed text before the quoted mail body",
"description": "" "description": ""
}, },
"prompt_get_calitem": { "prompt_get_calendar_event": {
"message": "Add a new calendar event", "message": "Add a new calendar event",
"description": "" "description": ""
}, },
"prompt_get_calitem_full_text": { "prompt_get_calendar_event_full_text": {
"message": "Extract all relevant details required to generate an iCalendar (iCal) file from the following text. The extracted information should include:\n- Event Title\n- Start Date and Time (including timezone, if specified)\n- End Date and Time (including timezone, if specified)\n- Location (if available)\n- Description or Additional Notes (if available)\n- Organizer's Name and Contact Details (if available)\n- Recurrence Rules (if mentioned)\nEnsure the data is formatted clearly and consistently so that it can be directly used for creating an iCal file. Highlight any missing or ambiguous details that might require clarification. Here's the text:\"{%selected_text%}\"", "message": "Extract all relevant details required to generate an iCalendar (iCal) file from the following text. The extracted information should include:\n- Event Title\n- Start Date and Time (including timezone, if specified)\n- End Date and Time (including timezone, if specified)\n- Location (if available)\n- Description or Additional Notes (if available)\n- Organizer's Name and Contact Details (if available)\n- Recurrence Rules (if mentioned)\nEnsure the data is formatted clearly and consistently so that it can be directly used for creating an iCal file. Highlight any missing or ambiguous details that might require clarification. Here's the text:\"{%selected_text%}\"",
"description": "" "description": ""
},
"prefs_OptionText_get_calendar_event": {
"message": "Add a new calendar event from selected text",
"description": ""
},
"prefs_OptionText_get_calendar_event_Info": {
"message": "If checked, an item will be included in the menu to get a calendar event information from selected text.",
"description": ""
},
"prefs_OptionText_btnManageCalendarEventInfo": {
"message": "Manage calendar event settings",
"description": ""
} }
} }

View file

@ -46,4 +46,5 @@ export const prefs_default = {
add_tags_hide_exclusions: false, add_tags_hide_exclusions: false,
add_tags_first_uppercase: true, add_tags_first_uppercase: true,
add_tags_force_lang: true, add_tags_force_lang: true,
get_calendar_event: true,
} }

View file

@ -334,6 +334,17 @@
</label> </label>
</td> </td>
</tr> </tr>
<tr>
<tr class="get_calendar_event_tr">
<td><span>__MSG_prefs_OptionText_get_calendar_event__</span>
<br><button id="btnManageCalendarEventInfo" class="btn_small">__MSG_prefs_OptionText_btnManageCalendarEventInfo__</button></td>
<td>
<label>
<input type="checkbox" id="get_calendar_event" name="get_calendar_event" class="option-input" />
__MSG_prefs_OptionText_get_calendar_event_Info__
</label>
</td>
</tr>
<tr> <tr>
<td style="width:20em"><label> <td style="width:20em"><label>
<span>__MSG_Debug__</span> <span>__MSG_Debug__</span>

View file

@ -288,6 +288,13 @@ document.addEventListener('DOMContentLoaded', async () => {
addtags_info_btn.disabled = event.target.checked ? '' : 'disabled'; addtags_info_btn.disabled = event.target.checked ? '' : 'disabled';
}); });
addtags_info_btn.disabled = addtags_el.checked ? '' : 'disabled'; addtags_info_btn.disabled = addtags_el.checked ? '' : 'disabled';
let get_calendar_event_el = document.getElementById('get_calendar_event');
let get_calendar_event_info_btn = document.getElementById('btnManageCalendarEventInfo');
get_calendar_event_el.addEventListener('click', (event) => {
get_calendar_event_info_btn.disabled = event.target.checked ? '' : 'disabled';
});
get_calendar_event_info_btn.disabled = get_calendar_event_el.checked ? '' : 'disabled';
document.getElementById('btnManagePrompts').addEventListener('click', () => { document.getElementById('btnManagePrompts').addEventListener('click', () => {
// check if the tab is already there // check if the tab is already there
@ -315,6 +322,19 @@ document.addEventListener('DOMContentLoaded', async () => {
}) })
}); });
document.getElementById('btnManageCalendarEventInfo').addEventListener('click', () => {
// check if the tab is already there
browser.tabs.query({url: browser.runtime.getURL('../pages/get-calendar-event/mzta-get-calendar-event.html')}).then((tabs) => {
if (tabs.length > 0) {
// if the tab is already there, focus it
browser.tabs.update(tabs[0].id, {active: true});
} else {
// if the tab is not there, create it
browser.tabs.create({url: browser.runtime.getURL('../get-calendar-event/addtags/mzta-get-calendar-event.html')});
}
})
});
document.getElementById('btnOpenAICompForceModel').addEventListener('click', () => { document.getElementById('btnOpenAICompForceModel').addEventListener('click', () => {
let modelName = prompt(browser.i18n.getMessage('OpenAIComp_force_model_ask')).trim(); let modelName = prompt(browser.i18n.getMessage('OpenAIComp_force_model_ask')).trim();
if ((modelName !== null) && (modelName !== undefined) && (modelName !== '')) { if ((modelName !== null) && (modelName !== undefined) && (modelName !== '')) {

View file

@ -64,7 +64,7 @@ body {
background-color: #e9e9e9; background-color: #e9e9e9;
} }
.prompt_add_tags{ .prompt_add_tags, .prompt_get_calendar_event{
background-color: #cfe9ff; background-color: #cfe9ff;
} }
@ -102,7 +102,7 @@ body {
background-color: #444444; background-color: #444444;
} }
.prompt_add_tags{ .prompt_add_tags, .prompt_get_calendar_event{
background-color: #353542; background-color: #353542;
} }
} }