// Voting function vote(entryId) { let score = parseInt(localStorage.getItem('vote-' + entryId)) || 0; score++; localStorage.setItem('vote-' + entryId, score); document.getElementById('score-' + entryId).textContent = score; } function loadVote(entryId) { let score = parseInt(localStorage.getItem('vote-' + entryId)) || 0; document.getElementById('score-' + entryId).textContent = score; } // Comments function loadComments(entryId) { const comments = JSON.parse(localStorage.getItem('comments-' + entryId)) || []; const list = document.getElementById('comment-list'); list.innerHTML = ''; comments.forEach(text => { const li = document.createElement('li'); li.textContent = text; list.appendChild(li); }); } function addComment(entryId) { const text = document.getElementById('comment-box').value.trim(); if (text) { const comments = JSON.parse(localStorage.getItem('comments-' + entryId)) || []; comments.push(text); localStorage.setItem('comments-' + entryId, JSON.stringify(comments)); document.getElementById('comment-box').value = ''; loadComments(entryId); } }