// Main JavaScript for NLP Ultimate Tutorial // Theme management function toggleTheme() { const currentTheme = document.documentElement.getAttribute('data-theme'); const newTheme = currentTheme === 'dark' ? 'light' : 'dark'; document.documentElement.setAttribute('data-theme', newTheme); localStorage.setItem('theme', newTheme); // Update theme icon const themeIcon = document.getElementById('theme-icon'); if (themeIcon) { themeIcon.className = newTheme === 'dark' ? 'fas fa-sun' : 'fas fa-moon'; } } // Initialize theme on page load function initializeTheme() { const savedTheme = localStorage.getItem('theme') || 'light'; document.documentElement.setAttribute('data-theme', savedTheme); const themeIcon = document.getElementById('theme-icon'); if (themeIcon) { themeIcon.className = savedTheme === 'dark' ? 'fas fa-sun' : 'fas fa-moon'; } } // Loading state management function showLoading(elementId) { const element = document.getElementById(elementId); if (element) { element.innerHTML = `
Processing your request...
| ${header} | `; }); table += '|
|---|---|
| ${cell} | `; }); } else { Object.values(row).forEach(value => { table += `${value} | `; }); } table += '