This commit is contained in:
2024-09-25 20:49:15 +02:00
parent b572feeb5a
commit 73a9e04c2b
22 changed files with 1982 additions and 682 deletions

28
js/login.js Normal file
View File

@ -0,0 +1,28 @@
document.addEventListener('DOMContentLoaded', () => {
const themeToggleBtn = document.getElementById('theme-toggle-btn');
const body = document.body;
// Ellenőrizzük, hogy van-e tárolt beállítás a localStorage-ban
const savedTheme = localStorage.getItem('theme');
// Alkalmazzuk a tárolt beállítást, ha van
if (savedTheme) {
body.classList.add(savedTheme === 'dark' ? 'dark-mode' : 'light-mode');
themeToggleBtn.textContent = savedTheme === 'dark' ? '☀️' : '🌙';
}
// Funkció a téma váltásához
themeToggleBtn.addEventListener('click', () => {
if (body.classList.contains('dark-mode')) {
body.classList.remove('dark-mode');
body.classList.add('light-mode');
themeToggleBtn.textContent = '🌙';
localStorage.setItem('theme', 'light'); // Mentés a localStorage-ba
} else {
body.classList.remove('light-mode');
body.classList.add('dark-mode');
themeToggleBtn.textContent = '☀️';
localStorage.setItem('theme', 'dark'); // Mentés a localStorage-ba
}
});
});