// Global configuration for MathJax window.MathJax = { tex: { inlineMath: [['$', '$'], ['\\(', '\\)']] }, options: { skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre'] } }; // Initialize interactive elements document.addEventListener('DOMContentLoaded', function() { // Handle algorithm card clicks document.querySelectorAll('algorithm-card').forEach(card => { card.addEventListener('click', function() { const href = this.getAttribute('href'); if (href) { window.location.href = href; } }); }); // Initialize tooltips const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); tooltipTriggerList.map(function (tooltipTriggerEl) { return new bootstrap.Tooltip(tooltipTriggerEl); }); }); // Utility function for creating interactive graphs function createInteractiveGraph(canvasId, config, interactiveOptions = {}) { const ctx = document.getElementById(canvasId).getContext('2d'); const chart = new Chart(ctx, config); // Add interactive features if specified if (interactiveOptions.draggablePoints) { makePointsDraggable(chart); } return chart; } function makePointsDraggable(chart) { // Implementation for making chart points draggable // This would be extended based on specific algorithm needs } // Tab switching functionality for algorithm pages function setupAlgorithmTabs() { const tabs = document.querySelectorAll('.tab'); if (tabs.length > 0) { tabs.forEach(tab => { tab.addEventListener('click', () => { // Remove active class from all tabs and contents document.querySelectorAll('.tab').forEach(t => t.classList.remove('active')); document.querySelectorAll('.tab-content').forEach(c => c.classList.add('hidden')); // Add active class to clicked tab and corresponding content tab.classList.add('active'); const tabId = tab.getAttribute('data-tab'); document.getElementById(tabId).classList.remove('hidden'); }); }); } } // Initialize page functionality document.addEventListener('DOMContentLoaded', function() { setupAlgorithmTabs(); // Handle algorithm card clicks document.querySelectorAll('algorithm-card').forEach(card => { card.addEventListener('click', function() { const href = this.getAttribute('href'); if (href) { window.location.href = href; } }); }); });