61af688ff3
- Added theme.js for managing light/dark mode with user preference persistence. - Updated lab.php to include theme toggle button and adjust styles for light mode. - Enhanced CSS styles in style.css for light theme support, including background and text colors. - Introduced DNS record lookup functionality in tools.php with user input for domain queries. - Improved UI for DNS lookup and outbound connectivity tests in tools.php. - Added historical benchmark trend chart in lab.php to visualize previous benchmark scores. - Refactored various UI elements for better spacing and alignment across components.
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
/**
|
|
* Web & PC Studio - Theme Manager (Dark / Light Mode)
|
|
* Persisteert gebruikersvoorkeur in localStorage over alle pagina's.
|
|
*/
|
|
|
|
(function() {
|
|
const savedTheme = localStorage.getItem('wpc_theme') || 'dark';
|
|
document.documentElement.setAttribute('data-theme', savedTheme);
|
|
})();
|
|
|
|
function toggleTheme() {
|
|
const current = document.documentElement.getAttribute('data-theme') || 'dark';
|
|
const next = current === 'dark' ? 'light' : 'dark';
|
|
document.documentElement.setAttribute('data-theme', next);
|
|
localStorage.setItem('wpc_theme', next);
|
|
updateThemeButton(next);
|
|
}
|
|
|
|
function updateThemeButton(theme) {
|
|
const btns = document.querySelectorAll('.theme-btn');
|
|
btns.forEach(btn => {
|
|
if (theme === 'light') {
|
|
btn.innerHTML = '☀️ Thema: Licht';
|
|
btn.title = 'Schakel over naar Donker thema';
|
|
} else {
|
|
btn.innerHTML = '🌙 Thema: Donker';
|
|
btn.title = 'Schakel over naar Licht thema';
|
|
}
|
|
});
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
const current = document.documentElement.getAttribute('data-theme') || 'dark';
|
|
updateThemeButton(current);
|
|
});
|