2020-05-31 13:19:29 +00:00
|
|
|
<script src="{{ '/assets/plugins/jquery/jquery.min.js' | prepend: site.baseurl }}"></script>
|
|
|
|
<script src="{{ '/assets/plugins/bootstrap/js/bootstrap.bundle.min.js' | prepend: site.baseurl }}"></script>
|
|
|
|
<script src="{{ '/assets/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js' | prepend: site.baseurl }}"></script>
|
|
|
|
<script src="{{ '/assets/js/adminlte.min.js' | prepend: site.baseurl }}"></script>
|
2021-03-18 16:59:18 +00:00
|
|
|
<script>
|
|
|
|
var toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]');
|
|
|
|
var currentTheme = localStorage.getItem('theme');
|
|
|
|
var mainHeader = document.querySelector('.main-header');
|
|
|
|
|
|
|
|
if (currentTheme) {
|
|
|
|
if (currentTheme === 'dark') {
|
|
|
|
if (!document.body.classList.contains('dark-mode')) {
|
|
|
|
document.body.classList.add("dark-mode");
|
|
|
|
}
|
|
|
|
if (mainHeader.classList.contains('navbar-light')) {
|
|
|
|
mainHeader.classList.add('navbar-dark');
|
|
|
|
mainHeader.classList.remove('navbar-light');
|
|
|
|
}
|
|
|
|
toggleSwitch.checked = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function switchTheme(e) {
|
|
|
|
if (e.target.checked) {
|
|
|
|
if (!document.body.classList.contains('dark-mode')) {
|
|
|
|
document.body.classList.add("dark-mode");
|
|
|
|
}
|
|
|
|
if (mainHeader.classList.contains('navbar-light')) {
|
|
|
|
mainHeader.classList.add('navbar-dark');
|
|
|
|
mainHeader.classList.remove('navbar-light');
|
|
|
|
}
|
|
|
|
localStorage.setItem('theme', 'dark');
|
|
|
|
} else {
|
|
|
|
if (document.body.classList.contains('dark-mode')) {
|
|
|
|
document.body.classList.remove("dark-mode");
|
|
|
|
}
|
|
|
|
if (mainHeader.classList.contains('navbar-dark')) {
|
|
|
|
mainHeader.classList.add('navbar-light');
|
|
|
|
mainHeader.classList.remove('navbar-dark');
|
|
|
|
}
|
|
|
|
localStorage.setItem('theme', 'light');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
toggleSwitch.addEventListener('change', switchTheme, false);
|
|
|
|
</script>
|