-
Notifications
You must be signed in to change notification settings - Fork 1
/
MMM-OnThisDayWikiApi.njk
56 lines (54 loc) · 2.11 KB
/
MMM-OnThisDayWikiApi.njk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{#
# MagicMirror²
# Module: MMM-OnThisDayWikiApi
#
# By Ryan Seeber (github.com/slugmuffin)
# MIT Licensed.
#}
{% macro escapeText(text) %}
{{ text }}
{% endmacro %}
{% if error %}
<div class="small dimmed">
{{ "MODULE_CONFIG_ERROR" | translate({MODULE_NAME: "MMM-OnThisWayWikiApi", ERROR: error}) | safe }}
</div>
{% elseif loaded %}
{% if empty %}
<div class="small dimmed">{{ "ONTHISDAY_NO_ITEMS" | translate | safe }}</div>
{% else %}
{% if config.showAsList %}
{% if config.showTitle %}
<div class="title dimmed xsmall normal" style="max-width:{{config.maxWidth}}px;">{{ config.title }}</div>
{% endif %}
<ul class="MMM-OnThisDayWikiApi-list" style="max-width:{{config.maxWidth}}px;">
{% for item in items %}
<li>
<span class="title bright xsmall light">{{ item.year }} – </span>
<span class="text xsmall light{{ ' no-wrap' if not config.wrapTitle }}">
{{ escapeText(item.text) }}
</span>
</li>
{% endfor %}
</ul>
{% else %}
<div class="container small normal MMM-OnThisDayWikiApi-single">
{% if config.showTitle %}
<div class="title dimmed">
{{ config.title }}
<span class="bright light">{{ activeItem.year }}</span>:
</div>
{% endif %}
<div class="title small normal">
{% if not config.showTitle %}
<span class="bright light">{{ activeItem.year }}</span><span class="dimmed">:</span>
{% endif %}
<span class="bright light {{ ' no-wrap' if not config.wrapTitle }}">
{{ escapeText(activeItem.text) }}
</span>
</div>
</div>
{% endif %}
{% endif %}
{% else %}
<div class="small dimmed">{{ "LOADING" | translate | safe }}</div>
{% endif %}