Files
aitbc/website/docs/js/theme.js
oib 9b9c5beb23 ```
chore: enhance .gitignore and remove obsolete documentation files

- Reorganize .gitignore with categorized sections for better maintainability
- Add comprehensive ignore patterns for Python, Node.js, databases, logs, and build artifacts
- Add project-specific ignore rules for coordinator, explorer, and deployment files
- Remove outdated documentation: BITCOIN-WALLET-SETUP.md, LOCAL_ASSETS_SUMMARY.md, README-CONTAINER-DEPLOYMENT.md, README-DOMAIN-DEPLOYMENT.md
```
2026-01-24 14:44:51 +01:00

55 lines
1.5 KiB
JavaScript

/**
* AITBC Documentation Theme Toggle
* Handles dark/light mode switching with localStorage persistence
*/
(function() {
'use strict';
const STORAGE_KEY = 'aitbc-docs-theme';
// Initialize theme on page load
function initTheme() {
const savedTheme = localStorage.getItem(STORAGE_KEY);
const themeToggle = document.getElementById('theme-toggle');
if (savedTheme === 'light') {
document.body.classList.add('light');
if (themeToggle) {
themeToggle.innerHTML = '<i class="fas fa-moon"></i>';
}
}
// Setup toggle button listener
if (themeToggle) {
themeToggle.addEventListener('click', toggleTheme);
}
}
// Toggle between light and dark themes
function toggleTheme() {
const themeToggle = document.getElementById('theme-toggle');
document.body.classList.toggle('light');
const isLight = document.body.classList.contains('light');
if (themeToggle) {
themeToggle.innerHTML = isLight
? '<i class="fas fa-moon"></i>'
: '<i class="fas fa-sun"></i>';
}
localStorage.setItem(STORAGE_KEY, isLight ? 'light' : 'dark');
}
// Run on DOM ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initTheme);
} else {
initTheme();
}
// Expose for manual use if needed
window.toggleTheme = toggleTheme;
})();