From 7ec709590a2ff53d0061258a5ce27cbb04eea98b Mon Sep 17 00:00:00 2001 From: radmanplays <95340057+radmanplays@users.noreply.github.com> Date: Sun, 4 Feb 2024 10:59:14 +0330 Subject: [PATCH] Update index.html --- index.html | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 694d3c9..7109a1d 100644 --- a/index.html +++ b/index.html @@ -13,8 +13,12 @@
-
+
+

 EaglerRinth

+
+ +
@@ -27,6 +31,7 @@ .then(response => response.json()) .then(data => { const modContainer = document.getElementById('modContainer'); + const searchInput = document.getElementById('searchInput'); // Remove existing cards modContainer.innerHTML = ''; @@ -51,6 +56,40 @@ modContainer.appendChild(card); }); + + // Add event listener for search input + searchInput.addEventListener('input', () => { + const searchValue = searchInput.value.toLowerCase(); + + // Filter mods based on search input + const filteredMods = data.mods.filter(mod => + mod.name.toLowerCase().includes(searchValue) || + mod.description.toLowerCase().includes(searchValue) || + mod.author.toLowerCase().includes(searchValue) + ); + + // Update mod cards based on filtered mods + modContainer.innerHTML = ''; + filteredMods.forEach(mod => { + const card = document.createElement('div'); + card.className = 'col-md-11 col-lg-12 col-xl-11'; + + card.innerHTML = ` +
+
+

${mod.name}

+

Author : 

+ +  ${mod.author}  + +

${mod.description}

+ +
+
`; + + modContainer.appendChild(card); + }); + }); }) .catch(error => console.error('Error fetching mods.json:', error));