From 1065b088ffc663418ba6284d18efd2c8c6dd2713 Mon Sep 17 00:00:00 2001 From: unlishema Date: Thu, 18 Sep 2025 12:55:58 -0400 Subject: [PATCH] Added HR for multiple items and fixed combobox for item selection to work better --- dist/dev.html | 22 ++++++++++++++++++---- src/dev.html | 22 ++++++++++++++++++---- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/dist/dev.html b/dist/dev.html index 7078c07..6113499 100644 --- a/dist/dev.html +++ b/dist/dev.html @@ -102,7 +102,7 @@
-

Extracted Item Data

+

Extracted Item Data (Max Shown: 10)

Select an item to display its data here.

@@ -204,11 +204,19 @@ // Clear previous content extractedDataElement.innerHTML = ""; + const maxCount = 10; // Limit the number of displayed items + let previousItemValue = null; for (let i = 0; i < itemData.bucket.length; i++) { const item = itemData.bucket[i]; if (updateItemList && itemData.bucket.length > 1) { - if (i == 0) document.getElementById("itemSelect").innerHTML = ""; + if (i == 0) { + document.getElementById("itemSelect").innerHTML = ""; + const option = document.createElement("option"); + option.value = query; + option.textContent = `--- Select an item ---`; + document.getElementById("itemSelect").appendChild(option); + } // Add each item to the combobox const option = document.createElement("option"); @@ -221,13 +229,19 @@ option.value += `).where('${keys[0]}', '${item[keys[0]].replaceAll("'", "\\'")}').run()`; option.textContent = keys ? item[keys[0]] : "No KEYS"; - document.getElementById("itemSelect").appendChild(option); + if (!previousItemValue || previousItemValue != item[keys[0]]) + document.getElementById("itemSelect").appendChild(option); + + previousItemValue = item[keys[0]]; } - if (i > 0) continue; // Only display the first item by default + if (i > maxCount) continue; // Only display the first item by default for (const key of keys) extractedDataElement.innerHTML += `

${key}: ${!(key in item) ? 'false' : (item[key] === '' ? 'true' : item[key])}

`; + // Show a horizontal line between items, but not after the last one + if (i < maxCount && i < itemData.bucket.length - 1) extractedDataElement.innerHTML += `
`; + } rawDataElement.innerHTML = `
${JSON.stringify(itemData, null, 2)}
`; diff --git a/src/dev.html b/src/dev.html index 7078c07..6113499 100644 --- a/src/dev.html +++ b/src/dev.html @@ -102,7 +102,7 @@
-

Extracted Item Data

+

Extracted Item Data (Max Shown: 10)

Select an item to display its data here.

@@ -204,11 +204,19 @@ // Clear previous content extractedDataElement.innerHTML = ""; + const maxCount = 10; // Limit the number of displayed items + let previousItemValue = null; for (let i = 0; i < itemData.bucket.length; i++) { const item = itemData.bucket[i]; if (updateItemList && itemData.bucket.length > 1) { - if (i == 0) document.getElementById("itemSelect").innerHTML = ""; + if (i == 0) { + document.getElementById("itemSelect").innerHTML = ""; + const option = document.createElement("option"); + option.value = query; + option.textContent = `--- Select an item ---`; + document.getElementById("itemSelect").appendChild(option); + } // Add each item to the combobox const option = document.createElement("option"); @@ -221,13 +229,19 @@ option.value += `).where('${keys[0]}', '${item[keys[0]].replaceAll("'", "\\'")}').run()`; option.textContent = keys ? item[keys[0]] : "No KEYS"; - document.getElementById("itemSelect").appendChild(option); + if (!previousItemValue || previousItemValue != item[keys[0]]) + document.getElementById("itemSelect").appendChild(option); + + previousItemValue = item[keys[0]]; } - if (i > 0) continue; // Only display the first item by default + if (i > maxCount) continue; // Only display the first item by default for (const key of keys) extractedDataElement.innerHTML += `

${key}: ${!(key in item) ? 'false' : (item[key] === '' ? 'true' : item[key])}

`; + // Show a horizontal line between items, but not after the last one + if (i < maxCount && i < itemData.bucket.length - 1) extractedDataElement.innerHTML += `
`; + } rawDataElement.innerHTML = `
${JSON.stringify(itemData, null, 2)}
`; -- 2.43.0