From 021e317a3770f0d2a3c0b3e58fedc91a55c60454 Mon Sep 17 00:00:00 2001 From: Mic Date: Wed, 25 Mar 2026 00:13:00 +0100 Subject: [PATCH 01/25] correctly setting the current model in the special prompts pages --- pages/addtags/mzta-add-tags.js | 24 ++++++++-------- .../mzta-get-calendar-event.js | 24 ++++++++-------- pages/get-task/mzta-get-task.js | 24 ++++++++-------- pages/spamfilter/mzta-spamfilter.js | 22 +++++++++------ pages/summarize/mzta-summarize.js | 28 +++++++++++-------- 5 files changed, 68 insertions(+), 54 deletions(-) diff --git a/pages/addtags/mzta-add-tags.js b/pages/addtags/mzta-add-tags.js index f9296c28..c57901f9 100644 --- a/pages/addtags/mzta-add-tags.js +++ b/pages/addtags/mzta-add-tags.js @@ -330,19 +330,21 @@ async function restoreOptions() { const restoreValue = result[element.id] || default_select_value; // Check if option exists let optionExists = Array.from(element.options).some(opt => opt.value === restoreValue); - // If it doesn't exist and restoreValue is not empty, create it - if (!optionExists && restoreValue !== '') { - let newOption = new Option(restoreValue, restoreValue); - element.add(newOption); - } - // Set value - element.value = restoreValue; - if (element.value === '') { - element.selectedIndex = -1; - } if (element.tomselect) { - element.tomselect.setValue(element.value, true); + if (!optionExists && restoreValue !== '') { + element.tomselect.addOption({ value: restoreValue, text: restoreValue }); + } + element.tomselect.setValue(restoreValue, true); setTomSelectBorder(element.tomselect); + } else { + if (!optionExists && restoreValue !== '') { + let newOption = new Option(restoreValue, restoreValue); + element.add(newOption); + } + element.value = restoreValue; + if (element.value === '') { + element.selectedIndex = -1; + } } }else{ console.error("[ThunderAI] Unhandled input type:", element.type); diff --git a/pages/get-calendar-event/mzta-get-calendar-event.js b/pages/get-calendar-event/mzta-get-calendar-event.js index ca3c8ef7..19e54981 100644 --- a/pages/get-calendar-event/mzta-get-calendar-event.js +++ b/pages/get-calendar-event/mzta-get-calendar-event.js @@ -227,19 +227,21 @@ async function restoreOptions() { const restoreValue = result[element.id] || default_select_value; // Check if option exists let optionExists = Array.from(element.options).some(opt => opt.value === restoreValue); - // If it doesn't exist and restoreValue is not empty, create it - if (!optionExists && restoreValue !== '') { - let newOption = new Option(restoreValue, restoreValue); - element.add(newOption); - } - // Set value - element.value = restoreValue; - if (element.value === '') { - element.selectedIndex = -1; - } if (element.tomselect) { - element.tomselect.setValue(element.value, true); + if (!optionExists && restoreValue !== '') { + element.tomselect.addOption({ value: restoreValue, text: restoreValue }); + } + element.tomselect.setValue(restoreValue, true); setTomSelectBorder(element.tomselect); + } else { + if (!optionExists && restoreValue !== '') { + let newOption = new Option(restoreValue, restoreValue); + element.add(newOption); + } + element.value = restoreValue; + if (element.value === '') { + element.selectedIndex = -1; + } } }else{ console.error("[ThunderAI] Unhandled input type:", element.type); diff --git a/pages/get-task/mzta-get-task.js b/pages/get-task/mzta-get-task.js index f5e3f257..34f818dc 100644 --- a/pages/get-task/mzta-get-task.js +++ b/pages/get-task/mzta-get-task.js @@ -180,19 +180,21 @@ async function restoreOptions() { const restoreValue = result[element.id] || default_select_value; // Check if option exists let optionExists = Array.from(element.options).some(opt => opt.value === restoreValue); - // If it doesn't exist and restoreValue is not empty, create it - if (!optionExists && restoreValue !== '') { - let newOption = new Option(restoreValue, restoreValue); - element.add(newOption); - } - // Set value - element.value = restoreValue; - if (element.value === '') { - element.selectedIndex = -1; - } if (element.tomselect) { - element.tomselect.setValue(element.value, true); + if (!optionExists && restoreValue !== '') { + element.tomselect.addOption({ value: restoreValue, text: restoreValue }); + } + element.tomselect.setValue(restoreValue, true); setTomSelectBorder(element.tomselect); + } else { + if (!optionExists && restoreValue !== '') { + let newOption = new Option(restoreValue, restoreValue); + element.add(newOption); + } + element.value = restoreValue; + if (element.value === '') { + element.selectedIndex = -1; + } } }else{ console.error("[ThunderAI] Unhandled input type:", element.type); diff --git a/pages/spamfilter/mzta-spamfilter.js b/pages/spamfilter/mzta-spamfilter.js index 4879abcd..1809b9bd 100644 --- a/pages/spamfilter/mzta-spamfilter.js +++ b/pages/spamfilter/mzta-spamfilter.js @@ -322,17 +322,21 @@ async function restoreOptions() { const restoreValue = result[element.id] || default_select_value; // Ensure option exists before restoring let optionExists = Array.from(element.options).some(opt => opt.value === restoreValue); - if (!optionExists && restoreValue !== '') { - let newOption = new Option(restoreValue, restoreValue); - element.add(newOption); - } - element.value = restoreValue; - if (element.value === '') { - element.selectedIndex = -1; - } if (element.tomselect) { - element.tomselect.setValue(element.value, true); + if (!optionExists && restoreValue !== '') { + element.tomselect.addOption({ value: restoreValue, text: restoreValue }); + } + element.tomselect.setValue(restoreValue, true); setTomSelectBorder(element.tomselect); + } else { + if (!optionExists && restoreValue !== '') { + let newOption = new Option(restoreValue, restoreValue); + element.add(newOption); + } + element.value = restoreValue; + if (element.value === '') { + element.selectedIndex = -1; + } } }else{ console.error("[ThunderAI] Unhandled input type:", element.type); diff --git a/pages/summarize/mzta-summarize.js b/pages/summarize/mzta-summarize.js index b41d9084..adc565a7 100644 --- a/pages/summarize/mzta-summarize.js +++ b/pages/summarize/mzta-summarize.js @@ -30,7 +30,8 @@ import { textareaAutocomplete } from "../../js/mzta-placeholders-autocomplete.js import { getAccountsList, normalizeStringList, - isAPIKeyValue + isAPIKeyValue, + setTomSelectBorder } from "../../js/mzta-utils.js"; import { initializeSpecificIntegrationUI @@ -235,18 +236,21 @@ async function restoreOptions() { const restoreValue = result[element.id] || default_select_value; // Check if option exists let optionExists = Array.from(element.options).some(opt => opt.value === restoreValue); - // If it doesn't exist and restoreValue is not empty, create it - if (!optionExists && restoreValue !== '') { - let newOption = new Option(restoreValue, restoreValue); - element.add(newOption); - } - // Set value - element.value = restoreValue; - if (element.value === '') { - element.selectedIndex = -1; - } if (element.tomselect) { - element.tomselect.setValue(element.value, true); + if (!optionExists && restoreValue !== '') { + element.tomselect.addOption({ value: String(restoreValue), text: String(restoreValue) }); + } + element.tomselect.setValue(String(restoreValue), true); + setTomSelectBorder(element.tomselect); + } else { + if (!optionExists && restoreValue !== '') { + let newOption = new Option(restoreValue, restoreValue); + element.add(newOption); + } + element.value = restoreValue; + if (element.value === '') { + element.selectedIndex = -1; + } } }else{ console.error("[ThunderAI] Unhandled input type:", element.type); From 1522e2c04c8c6c418942821fbdda2b34603fe1ed Mon Sep 17 00:00:00 2001 From: Mic Date: Wed, 25 Mar 2026 00:19:00 +0100 Subject: [PATCH 02/25] version set to 4.0.4. release notes updated --- CHANGELOG.md | 4 ++++ manifest.json | 2 +- options/mzta-release-notes.html | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdbd6cf4..4bc5f35c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ +

Version 4.0.4 - ??/??/2026

+

Version 4.0.3 - 20/03/2026