// Main application script document.addEventListener('DOMContentLoaded', function() { // Initialize tooltips const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); tooltipTriggerList.map(function (tooltipTriggerEl) { return new bootstrap.Tooltip(tooltipTriggerEl); }); // Toggle sidebar on mobile const sidebarToggle = document.getElementById('sidebarToggle'); if (sidebarToggle) { sidebarToggle.addEventListener('click', function() { document.querySelector('.sidebar').classList.toggle('-translate-x-full'); }); } // Dark mode toggle (placeholder - would need implementation) const darkModeToggle = document.getElementById('darkModeToggle'); if (darkModeToggle) { darkModeToggle.addEventListener('click', function() { document.documentElement.classList.toggle('dark'); }); } // Simulate loading data function simulateLoading() { const loadingElements = document.querySelectorAll('.loading-placeholder'); loadingElements.forEach(el => { el.innerHTML = '
'; }); setTimeout(() => { loadingElements.forEach(el => { el.innerHTML = '

Data loaded successfully!

'; }); }, 1500); } // Initialize any buttons that might need loading simulation const loadDataButtons = document.querySelectorAll('.load-data'); loadDataButtons.forEach(button => { button.addEventListener('click', simulateLoading); }); // Company search functionality const companySearch = document.getElementById('companySearch'); if (companySearch) { companySearch.addEventListener('input', function(e) { const searchTerm = e.target.value.toLowerCase(); // This would be replaced with actual search functionality console.log('Searching for:', searchTerm); }); } }); // API function to fetch MAD landscape data async function fetchMADLandscapeData() { try { // In a real implementation, this would fetch from the MAD API // For demo purposes, we'll use a mock response const mockResponse = { categories: [ { name: "Generative AI", companies: ["OpenAI", "Anthropic", "Stability AI", "Midjourney"] }, { name: "Computer Vision", companies: ["Scale AI", "Hive", "Clarifai", "Labelbox"] } ] }; return mockResponse; } catch (error) { console.error("Error fetching MAD landscape data:", error); return null; } } // Function to render company cards function renderCompanyCards(companies, containerId) { const container = document.getElementById(containerId); if (!container) return; container.innerHTML = companies.map(company => `
${company} logo

${company}

${company} description

`).join(''); feather.replace(); }