diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 240e4b0a..23c334b3 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -563,11 +563,11 @@ "message": "If checked, using the keyboard shortcut CTRL+ALT+A will automatically send the hightlighted prompt from the menu. Otherwise, the prompt name will be displayed to the user, requiring another press of the Enter key to send it.", "description": "" }, - "prefs_OptionText_dynamic_menu_order_prompt_alphabetically": { + "prefs_OptionText_dynamic_menu_order_alphabet": { "message": "Menu: order alphabetically", "description": "" }, - "prefs_OptionText_dynamic_menu_order_prompt_alphabetically_info": { + "prefs_OptionText_dynamic_menu_order_alphabet_info": { "message": "If checked, the prompts in the menu will be ordered alphabetically.", "description": "" } diff --git a/options/mzta-options-default.js b/options/mzta-options-default.js index 03d65378..818bbb37 100644 --- a/options/mzta-options-default.js +++ b/options/mzta-options-default.js @@ -30,5 +30,5 @@ export const prefs_default = { openai_comp_model: '', openai_comp_chat_name: 'OpenAI Comp', dynamic_menu_force_enter: false, - dynamic_menu_order_prompt_alphabetically: true, + dynamic_menu_order_alphabet: true, } \ No newline at end of file diff --git a/options/mzta-options.html b/options/mzta-options.html index 32fde5d6..ed793e56 100644 --- a/options/mzta-options.html +++ b/options/mzta-options.html @@ -61,12 +61,12 @@ diff --git a/popup/mzta-popup.js b/popup/mzta-popup.js index cd7db504..8372c74a 100644 --- a/popup/mzta-popup.js +++ b/popup/mzta-popup.js @@ -42,6 +42,14 @@ document.addEventListener('DOMContentLoaded', async () => { async function searchPrompt(allPrompts, tabId, tabType){ taLog.log("tabType: " + tabType); + let prefs_order = await browser.storage.sync.get({dynamic_menu_order_alphabet: true}); + + if(prefs_order.dynamic_menu_order_alphabet){ + allPrompts.sort((a, b) => a.label.localeCompare(b.label)); + } + + // console.log(">>>>>>>>> allPrompts: " + JSON.stringify(allPrompts)); + let input = document.getElementById('mzta_search_input'); let autocompleteList = document.getElementById('mzta_autocomplete-items'); let autocompleteListLoading = document.getElementById('mzta_autocomplete-items-loading');