Resources are now real

This commit is contained in:
Nathan Schneider
2025-06-25 16:44:42 -07:00
parent deb7b4f1b8
commit 975158ad0c
13 changed files with 111 additions and 141 deletions

View File

@@ -176,6 +176,30 @@ document.addEventListener('DOMContentLoaded', function() {
tagFilter.appendChild(option);
});
function updateTagFilter() {
// Clear existing options except "All tags"
tagFilter.innerHTML = '<option value="">All tags</option>';
// Collect tags from currently visible cards
const visibleTags = new Set();
cards.forEach(card => {
if (!card.classList.contains('hidden')) {
const tags = card.dataset.tags;
if (tags) {
tags.split(',').forEach(tag => visibleTags.add(tag.trim()));
}
}
});
// Populate tag filter dropdown with current tags
Array.from(visibleTags).sort().forEach(tag => {
const option = document.createElement('option');
option.value = tag;
option.textContent = tag;
tagFilter.appendChild(option);
});
}
function filterAndSort() {
const searchTerm = searchInput.value.toLowerCase();
const selectedTag = tagFilter.value;
@@ -219,6 +243,9 @@ document.addEventListener('DOMContentLoaded', function() {
card.classList.remove('hidden');
card.style.order = index;
});
// Update tag filter to show only current tags
updateTagFilter();
}
// Event listeners