mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Merge pull request #355 from Sonaryr/add-max-newsitems-parameter
Add max newsitems parameter to the newsfeed module
This commit is contained in:
commit
2b8583e652
@ -101,7 +101,13 @@ The following properties can be configured:
|
|||||||
<br><b>Default value:</b> <code>2000</code> (2.5 seconds)
|
<br><b>Default value:</b> <code>2000</code> (2.5 seconds)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>maxNewsItems</code></td>
|
||||||
|
<td>Total amount of news items to cycle through. (0 for unlimited)<br>
|
||||||
|
<br><b>Possible values:</b><code>0</code> - <code>...</code>
|
||||||
|
<br><b>Default value:</b> <code>0</code>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -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;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user