for-pi2 #2
1 changed files with 5 additions and 3 deletions
|
@ -132,8 +132,6 @@ const displayPost = function(post) {
|
||||||
const processPosts = function(posts) {
|
const processPosts = function(posts) {
|
||||||
posts = posts.filter((post) => secondsAgo(new Date(post.created_at)) < maxAge);
|
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;
|
return posts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -143,6 +141,8 @@ const updateWall = function(posts) {
|
||||||
|
|
||||||
posts = processPosts(posts);
|
posts = processPosts(posts);
|
||||||
|
|
||||||
|
posts.sort((a, b) => new Date(a.created_at) - new Date(b.created_at));
|
||||||
|
|
||||||
let ret = 0
|
let ret = 0
|
||||||
posts.forEach(post => ret += displayPost(post));
|
posts.forEach(post => ret += displayPost(post));
|
||||||
$('.masonry-grid').masonry('layout');
|
$('.masonry-grid').masonry('layout');
|
||||||
|
@ -155,7 +155,9 @@ const updateCarousel = function(slides, posts) {
|
||||||
if (!posts || posts.length === 0) return;
|
if (!posts || posts.length === 0) return;
|
||||||
|
|
||||||
posts = processPosts(posts);
|
posts = processPosts(posts);
|
||||||
|
|
||||||
|
posts.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
|
||||||
|
|
||||||
// remove slides in carousel
|
// remove slides in carousel
|
||||||
slides.innerHTML = "";
|
slides.innerHTML = "";
|
||||||
var newHTML = ` <!-- No Indicators -->`
|
var newHTML = ` <!-- No Indicators -->`
|
||||||
|
|
Loading…
Reference in a new issue