Fix sorting in carousel

This commit is contained in:
Max L. 2023-11-23 20:57:33 +01:00
parent 191dc33e28
commit 8cdc4ea5c3
No known key found for this signature in database
GPG key ID: 2F963B95632B8467

View file

@ -132,8 +132,6 @@ const displayPost = function(post) {
const processPosts = function(posts) {
posts = posts.filter((post) => secondsAgo(new Date(post.created_at)) < maxAge);
posts.sort((a, b) => new Date(a.created_at) - new Date(b.created_at));
return posts;
};
@ -143,6 +141,8 @@ const updateWall = function(posts) {
posts = processPosts(posts);
posts.sort((a, b) => new Date(a.created_at) - new Date(b.created_at));
let ret = 0
posts.forEach(post => ret += displayPost(post));
$('.masonry-grid').masonry('layout');
@ -155,7 +155,9 @@ const updateCarousel = function(slides, posts) {
if (!posts || posts.length === 0) return;
posts = processPosts(posts);
posts.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
// remove slides in carousel
slides.innerHTML = "";
var newHTML = ` <!-- No Indicators -->`