Shuffle posts randomly on each page load
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -217,10 +217,19 @@ function renderCommentsList(comments) {
|
||||
// ===========================
|
||||
// RENDER CARDS
|
||||
// ===========================
|
||||
function shuffleArray(arr) {
|
||||
for (let i = arr.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[arr[i], arr[j]] = [arr[j], arr[i]];
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
function renderCards() {
|
||||
const grid = document.getElementById('postGrid');
|
||||
if (!grid) return;
|
||||
|
||||
shuffleArray(APP.posts);
|
||||
grid.innerHTML = APP.posts.map(p => {
|
||||
const liked = APP.userLikes.includes(p.id);
|
||||
const likeCount = APP.likes[p.id] || 0;
|
||||
|
||||
Reference in New Issue
Block a user