From 9b5f93895366f33019ff61a4caccf8be0bb5337d Mon Sep 17 00:00:00 2001 From: mic Date: Mon, 13 Jan 2025 21:38:53 +0100 Subject: [PATCH] current datetime placeholder added. fixes #224 --- _locales/en/messages.json | 8 ++++++++ js/mzta-menus.js | 5 ++++- js/mzta-placeholders.js | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 03a7f0b7..83c4826c 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -998,5 +998,13 @@ "prefs_OptionText_download_now": { "message": "Download ThunderAI Sparks now!", "description": "" + }, + "placeholder_mail_datetime": { + "message": "The date and time of the email", + "description": "" + }, + "placeholder_current_datetime": { + "message": "The current date and time", + "description": "" } } \ No newline at end of file diff --git a/js/mzta-menus.js b/js/mzta-menus.js index 68b9ce7e..1c62bdec 100644 --- a/js/mzta-menus.js +++ b/js/mzta-menus.js @@ -178,6 +178,9 @@ export class mzta_Menus { case 'mail_datetime': finalSubs['mail_datetime'] = curr_message.date; break; + case 'current_datetime': + finalSubs['current_datetime'] = new Date().toString(); + break; case 'tags_current_email': let tags_current_email_array = await transformTagsLabels(curr_message.tags, tags_full_list[1]); finalSubs['tags_current_email'] = tags_current_email_array.join(", "); @@ -269,7 +272,7 @@ export class mzta_Menus { await cmd_GetCalendarEvent.initWorker(); try{ calendar_event_data = await cmd_GetCalendarEvent.sendPrompt(); - console.log(">>>>>>>>>>> calendar_event_data: " + calendar_event_data); + // console.log(">>>>>>>>>>> calendar_event_data: " + calendar_event_data); }catch(err){ console.error("[ThunderAI] Error getting calendar event data: ", JSON.stringify(err)); browser.tabs.sendMessage(tabs[0].id, { command: "sendAlert", curr_tab_type: tabs[0].type, message: "Error getting calendar event data: " + JSON.stringify(err) }); diff --git a/js/mzta-placeholders.js b/js/mzta-placeholders.js index 0be1f83f..11b9a51b 100644 --- a/js/mzta-placeholders.js +++ b/js/mzta-placeholders.js @@ -110,6 +110,13 @@ const defaultPlaceholders = [ type: 1, is_default: "1", }, + { + id: 'current_datetime', + name: "__MSG_placeholder_current_datetime__", + default_value: "", + type: 0, + is_default: "1", + }, { id: 'tags_current_email', name: "__MSG_placeholder_tags_current_email__",