Resources are now real
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user