MCPcopy Create free account
hub / github.com/bywwcnll/StreamPanel / showDropdown

Function showDropdown

devtools/modules/filterManager.js:224–238  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

222 let currentMatches = [];
223
224 const showDropdown = () => {
225 currentMatches = getFuzzyMatchedFields(availableFields, input.value);
226 activeIndex = currentMatches.length > 0 ? 0 : -1;
227
228 if (currentMatches.length > 0) {
229 dropdown.innerHTML = currentMatches.map((field, itemIndex) =>
230 `<div class="dropdown-item ${itemIndex === activeIndex ? 'active' : ''}" data-value="${escapeHtml(field)}">${escapeHtml(field)}</div>`
231 ).join('');
232 dropdown.style.display = 'block';
233 setupDropdownItemListeners();
234 } else {
235 dropdown.innerHTML = '<div class="dropdown-empty">无匹配字段</div>';
236 dropdown.style.display = 'block';
237 }
238 };
239
240 const setupDropdownItemListeners = () => {
241 dropdown.querySelectorAll('.dropdown-item').forEach((item, itemIndex) => {

Callers 1

Calls 3

escapeHtmlFunction · 0.90
getFuzzyMatchedFieldsFunction · 0.70

Tested by

no test coverage detected