iantrich / list-card

📰 Display sensor list data in a table
Apache License 2.0
123 stars 34 forks source link

Possibility to scroll down automatically the list for news display #54

Open frantzphilippe opened 1 year ago

frantzphilippe commented 1 year ago

Hello, I use this card after a feedparser of a RSS news stream, and it works very well. I was wondering if this could be possible to automatically scroll down the list, or to select randomly only one row to display. It should be possible using a javascript on the DIV displaying the card, but what I tried didn't work so far. How should I proceed ? I thank you for your help. Regards.

versile2 commented 8 months ago

I have a pull-request in for some changes I submitted but I think this would work in either code base. Add this above the line for (let entry in feed) { `// Choose a random index for the entry to keep const randomIndex = Math.floor(Math.random() * feed.length);

// Save the random entry const randomEntry = feed[randomIndex];

// Delete all other entries feed.splice(0, randomIndex); feed.splice(1, feed.length - 1);`