mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
add maxNewsItems config
Added extra config parameter to limit the amount of news items this module cycles through.
This commit is contained in:
@@ -24,6 +24,7 @@ Module.register("newsfeed",{
|
|||||||
reloadInterval: 5 * 60 * 1000, // every 5 minutes
|
reloadInterval: 5 * 60 * 1000, // every 5 minutes
|
||||||
updateInterval: 10 * 1000,
|
updateInterval: 10 * 1000,
|
||||||
animationSpeed: 2.5 * 1000,
|
animationSpeed: 2.5 * 1000,
|
||||||
|
maxNewsItems: 0 // 0 for unlimited
|
||||||
},
|
},
|
||||||
|
|
||||||
// Define required scripts.
|
// Define required scripts.
|
||||||
@@ -151,7 +152,9 @@ Module.register("newsfeed",{
|
|||||||
var dateB = new Date(b.pubdate);
|
var dateB = new Date(b.pubdate);
|
||||||
return dateB - dateA;
|
return dateB - dateA;
|
||||||
});
|
});
|
||||||
|
if(this.config.maxNewsItems > 0) {
|
||||||
|
newsItems = newsItems.slice(0, this.config.maxNewsItems);
|
||||||
|
}
|
||||||
this.newsItems = newsItems;
|
this.newsItems = newsItems;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user