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
}
});
});

4
js/main.js Normal file
View File

@ -0,0 +1,4 @@
function toggleLike(button) {
button.classList.toggle('active');
}

11
js/post.js Normal file
View File

@ -0,0 +1,11 @@
const textarea = document.getElementById('postInput');
textarea.addEventListener('input', function () {
textarea.style.height = 'auto'; // Reset az eredeti magasságra
textarea.style.height = textarea.scrollHeight + 'px'; // Dinamikusan növeli a szövegdoboz méretét
});
function toggleComments(button) {
const commentsSection = button.closest('.card').querySelector('.comments-section');
commentsSection.style.display = commentsSection.style.display === 'none' ? 'block' : 'none';
}