···11+document.addEventListener('DOMContentLoaded', function() {
22+ var currentYear = new Date().getFullYear();
33+ document.getElementById('currentYear').textContent = currentYear;
44+});
+32
script/search.js
···11+ document.addEventListener('DOMContentLoaded', function() {
22+ // Existing script for current year (if main.js doesn't handle it)
33+ const currentYearSpan = document.getElementById('currentYear');
44+ if (currentYearSpan) {
55+ currentYearSpan.textContent = new Date().getFullYear();
66+ }
77+88+ // Search functionality
99+ const searchInput = document.getElementById('projectSearch');
1010+ const projectCards = document.querySelectorAll('.project-card'); // Select all project cards
1111+1212+ searchInput.addEventListener('keyup', function() {
1313+ const searchTerm = searchInput.value.toLowerCase(); // Get search term and convert to lowercase
1414+1515+ projectCards.forEach(card => {
1616+ // Get the title and description elements within the current card
1717+ const titleElement = card.querySelector('.project-title-text');
1818+ const descriptionElement = card.querySelector('.project-description');
1919+2020+ // Extract text content and convert to lowercase for comparison
2121+ const titleText = titleElement ? titleElement.textContent.toLowerCase() : '';
2222+ const descriptionText = descriptionElement ? descriptionElement.textContent.toLowerCase() : '';
2323+2424+ // Check if the search term is found in either the title or description
2525+ if (titleText.includes(searchTerm) || descriptionText.includes(searchTerm)) {
2626+ card.style.display = ''; // Show the project card
2727+ } else {
2828+ card.style.display = 'none'; // Hide the project card
2929+ }
3030+ });
3131+ });
3232+ });