document.addEventListener('DOMContentLoaded', function() { // DOM Elements const cardSearch = document.getElementById('cardSearch'); const searchBtn = document.getElementById('searchBtn'); const cardResults = document.getElementById('cardResults'); const resultsSection = document.getElementById('resultsSection'); const deckSuggestions = document.getElementById('deckSuggestions'); const suggestionsList = document.getElementById('suggestionsList'); // Event Listeners searchBtn.addEventListener('click', searchCards); document.getElementById('searchByNameBtn').addEventListener('click', () => searchCards('name')); document.getElementById('searchByTypeBtn').addEventListener('click', () => searchCards('type')); document.getElementById('searchByColorBtn').addEventListener('click', () => searchCards('color')); // Mock data for demonstration const mockCards = [ { name: "Lightning Bolt", type: "Instant", color: "Red", image: "http://static.photos/red/320x240/1" }, { name: "Counterspell", type: "Instant", color: "Blue", image: "http://static.photos/blue/320x240/2" }, { name: "Llanowar Elves", type: "Creature", color: "Green", image: "http://static.photos/green/320x240/3" }, { name: "Swords to Plowshares", type: "Instant", color: "White", image: "http://static.photos/white/320x240/4" }, { name: "Dark Ritual", type: "Instant", color: "Black", image: "http://static.photos/black/320x240/5" }, { name: "Sol Ring", type: "Artifact", color: "Colorless", image: "http://static.photos/minimal/320x240/6" } ]; const mockDecks = [ { name: "Red Deck Wins", description: "Aggressive red deck with lots of direct damage", cards: ["Lightning Bolt", "Goblin Guide", "Monastery Swiftspear"] }, { name: "Blue Control", description: "Control the game with counterspells and card draw", cards: ["Counterspell", "Serum Visions", "Snapcaster Mage"] }, { name: "Green Ramp", description: "Ramp into big creatures quickly", cards: ["Llanowar Elves", "Cultivate", "Primeval Titan"] } ]; // Functions function searchCards(mode = 'name') { const searchTerm = cardSearch.value.trim(); if (!searchTerm) return; // Show loading state cardResults.innerHTML = '
${deck.description}