Skip to content

Commit cecc5f9

Browse files
committed
Added configuration option to limit displayed events
1 parent ee628c5 commit cecc5f9

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

MMM-OnThisDay.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const moduleDefinition = {
1212
updateInterval: 3600, // 60 min.
1313

1414
// Appearance
15+
maxEvents: null,
1516
reverseOrder: false,
1617

1718
// Style

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ All options are optional so the module works out of the box.
8383
| ---------------- | -------------------------------------------------------------------------------------------------------------------- |
8484
| `animationSpeed` | Duration of content refresh animation in seconds.<br><br>**Type:** `Number`<br>**Default:** `1` |
8585
| `updateInterval` | Time between loading new events data in seconds.<br><br>**Type:** `Number`<br>**Default:** `3600` (1 hour) |
86+
| `maxEvents` | Display up to the given number of events if supported.<br><br>**Type:** `Number`<br>**Default:** `null` |
8687
| `reverseOrder` | Display events in reversed order if supported.<br><br>**Type:** `Boolean`<br>**Default:** `false` |
8788
| `maxWidth` | Max width of the displayed events content.<br><br>**Type:** `String`<br>**Default:** `400px` |
8889
| `textSize` | CSS class to set the text size, use MagicMirror core classes here<br><br>**Type:** `String`<br>**Default:** `xsmall` |

template/MMM-OnThisDay.njk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
{% set items = items | reverse %}
1616
{% endif %}
1717

18+
{% if config.maxEvents %}
19+
{% set items = items.slice(0, config.maxEvents) %}
20+
{% endif %}
21+
1822
<ul>
1923
{% for item in items %}
2024
<li>{{ item }}</li>

0 commit comments

Comments
 (0)