Spaces:
Running
Running
| // Search functionality | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const searchInput = document.getElementById('searchInput'); | |
| if (searchInput) { | |
| searchInput.addEventListener('input', function(e) { | |
| const searchTerm = e.target.value.toLowerCase(); | |
| const categoryCards = document.querySelectorAll('.category-card'); | |
| categoryCards.forEach(card => { | |
| const title = card.querySelector('h2').textContent.toLowerCase(); | |
| const description = card.querySelector('p:not(.count)').textContent.toLowerCase(); | |
| if (title.includes(searchTerm) || description.includes(searchTerm)) { | |
| card.style.display = 'flex'; | |
| } else { | |
| card.style.display = 'none'; | |
| } | |
| }); | |
| }); | |
| } | |
| // Project search functionality (for category pages) | |
| const projectSearchInput = document.getElementById('projectSearch'); | |
| if (projectSearchInput) { | |
| projectSearchInput.addEventListener('input', function(e) { | |
| const searchTerm = e.target.value.toLowerCase(); | |
| const projectCards = document.querySelectorAll('.project-card'); | |
| projectCards.forEach(card => { | |
| const title = card.querySelector('h3').textContent.toLowerCase(); | |
| const description = card.querySelector('p').textContent.toLowerCase(); | |
| if (title.includes(searchTerm) || description.includes(searchTerm)) { | |
| card.style.display = 'block'; | |
| } else { | |
| card.style.display = 'none'; | |
| } | |
| }); | |
| }); | |
| } | |
| }); | |