40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
|
|
</main>
|
|
</div>
|
|
<script>
|
|
// Dark Mode Toggle
|
|
const themeBtn = document.getElementById('theme-toggle');
|
|
const iconLight = document.getElementById('theme-icon-light');
|
|
const iconDark = document.getElementById('theme-icon-dark');
|
|
|
|
function updateThemeIcon() {
|
|
if(document.body.classList.contains('dark-mode')) {
|
|
iconLight.style.display = 'block';
|
|
iconDark.style.display = 'none';
|
|
} else {
|
|
iconLight.style.display = 'none';
|
|
iconDark.style.display = 'block';
|
|
}
|
|
}
|
|
|
|
if(themeBtn) {
|
|
updateThemeIcon();
|
|
themeBtn.addEventListener('click', () => {
|
|
document.body.classList.toggle('dark-mode');
|
|
const isDark = document.body.classList.contains('dark-mode');
|
|
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
|
updateThemeIcon();
|
|
});
|
|
}
|
|
|
|
// Toast Notifier
|
|
function showToast(msg) {
|
|
const t = document.getElementById('toast');
|
|
t.textContent = msg;
|
|
t.classList.add('show');
|
|
setTimeout(() => t.classList.remove('show'), 3000);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|