Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ const searchInput = document.getElementById('searchInput');
+ const specializationFilter = document.getElementById('specializationFilter');
+ const grid = document.getElementById('researcherGrid');
+
+ // Create researcher cards from table data
+ const table = document.querySelector('table');
+ const researchers = Array.from(table.querySelectorAll('tr')).slice(1)
+ .map(row => {
+ const cells = row.querySelectorAll('td');
+ return {
+ name: cells[1].textContent,
+ institution: cells[2].textContent,
+ specialization: cells[3].textContent,
+ hIndex: cells[4].textContent,
+ citations: cells[5].textContent,
+ activeYears: cells[6].textContent
+ };
+ });
+
+ function createResearcherCard(researcher) {
+ return `
+
+
${researcher.name}
+
+
Institution: ${researcher.institution}
+
Specialization: ${researcher.specialization}
+
h-index: ${researcher.hIndex}
+
Citations: ${researcher.citations}
+
Active Years: ${researcher.activeYears}
+
+
+ `;
+ }
+
+ function updateDisplay() {
+ const searchTerm = searchInput.value.toLowerCase();
+ const specializationTerm = specializationFilter.value.toLowerCase();
+
+ const filtered = researchers.filter(r => {
+ const matchesSearch = Object.values(r).some(val =>
+ val.toString().toLowerCase().includes(searchTerm)
+ );
+ const matchesSpecialization = specializationTerm === '' ||
+ r.specialization.toLowerCase().includes(specializationTerm);
+ return matchesSearch && matchesSpecialization;
+ });
+
+ grid.innerHTML = filtered.map(createResearcherCard).join('');
+ }
+
+ searchInput.addEventListener('input', updateDisplay);
+ specializationFilter.addEventListener('change', updateDisplay);
+
+ // Hide the original table
+ table.style.display = 'none';
+
+ // Initial display
+ updateDisplay();
+ });