Filter out duplicate carousel cards
Also respect reply config option in carousel
This commit is contained in:
parent
3ba54e1653
commit
12fca72480
1 changed files with 9 additions and 1 deletions
10
script.js
10
script.js
|
@ -165,9 +165,17 @@ const updateCarousel = function(slides, posts) {
|
|||
var newHTML = ` <!-- No Indicators -->`
|
||||
newHTML += `<!-- the slides -->
|
||||
<div class="carousel-inner">
|
||||
`
|
||||
`;
|
||||
|
||||
let existingCards = [];
|
||||
|
||||
for( let i = 0; i < posts.length; i++ ) {
|
||||
let post = posts[i];
|
||||
|
||||
if (existingCards.includes(post.id) || (!includeReplies && post.in_reply_to_id !== null)) continue;
|
||||
|
||||
existingCards.push(post.id);
|
||||
|
||||
/*console.log( post.content )*/
|
||||
if ( i == 0 ) {
|
||||
newHTML += `<div class="carousel-item active" data-mdb-interval="${duration}" data-mdb-pause="false">`;
|
||||
|
|
Loading…
Reference in a new issue