var dashwall_theme=localStorage.getItem('theme');
if(! dashwall_theme){
localStorage.setItem('theme', 'light');
dashwall_theme='light';
}
if(document.readyState==='loading'){
document.addEventListener('DOMContentLoaded', initThemeToggle);
}else{
initThemeToggle();
}
function initThemeToggle(){
if(document.body){
document.body.classList.add(dashwall_theme);
}
var themeToggle=document.getElementById('theme-toggle');
if(themeToggle){
themeToggle.addEventListener('click', ()=> {
if(document.body){
document.body.classList.remove('light');
document.body.classList.remove('dark');
dashwall_theme=(dashwall_theme==='light') ? 'dark':'light';
localStorage.setItem('theme', dashwall_theme);
document.body.classList.add(dashwall_theme);
}});
}};