From 3d0199b2c6ee3dff69e624086502df605f4411d2 Mon Sep 17 00:00:00 2001 From: mic Date: Sun, 22 Sep 2024 21:17:26 +0200 Subject: [PATCH] menu query using include --- popup/mzta-popup.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/popup/mzta-popup.js b/popup/mzta-popup.js index 5441d3be..bd26dc24 100644 --- a/popup/mzta-popup.js +++ b/popup/mzta-popup.js @@ -45,6 +45,7 @@ async function searchPrompt(allPrompts, tabId, tabType){ // Function to filter and display autocomplete suggestions input.addEventListener('input', function() { const query = this.value.trim().toLowerCase(); + console.log(">>>>>>>>>>>> query: " + query); autocompleteList.innerHTML = ''; // Clear previous suggestions currentFocus = -1; // Reset the highlighted index selectedId = null; // Reset the selected ID since input has changed @@ -59,8 +60,9 @@ async function searchPrompt(allPrompts, tabId, tabType){ // Filter data based on the query const filteredData = allPrompts.filter(item => - item.label.toLowerCase().startsWith(query) + item.label.toLowerCase().includes(query) ); + // console.log(">>>>>>>>>>>>> filteredData: " + JSON.stringify(filteredData)); if (filteredData.length === 0) { autocompleteList.style.display = 'none'; @@ -77,6 +79,8 @@ async function searchPrompt(allPrompts, tabId, tabType){ } }); + // console.log(">>>>>>>>>>>>> filteredData: " + JSON.stringify(filteredData)); + // Create a div for each filtered result filteredData.forEach(item => { const itemDiv = document.createElement('div');