This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
forked from jclarke0000/MMM-DarkSkyForecast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mmm-darksky-forecast.njk
225 lines (165 loc) · 8.5 KB
/
mmm-darksky-forecast.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<div class="wrapper {{ config.forecastLayout }} icon-set-{{ config.iconset }}{% if config.colored %} colored{% endif %}{% if config.showInlineIcons %} inline-icons{% endif %}{% if config.forecastHeaderText %} with-forecast-header{% endif %}">
{% if loading %}
<div class="dimmed light small">{{ phrases.loading | safe }}</div>
{% else %}
{# -------------- Current Conditions -------------- #}
{% if config.showCurrentConditions %}
<div class="current-conditions-wrapper">
<span class="current-conditions-wrapper">
{% if forecast.currently.animatedIconId %}
<canvas class="skycon-{{ identifier }} current icon current" id="{{ forecast.currently.animatedIconId }}" data-animated-icon-name="{{ forecast.currently.animatedIconName }}" width="{{ animatedIconSizes.main }}" height="{{ animatedIconSizes.main }}"></canvas>
{% else %}
<img class="current icon current" src="{{ forecast.currently.iconPath }}" />
{% endif %}
<span class="current temperature bright large light">{{ forecast.currently.temperature }}</span>
</span>
</div>
{% endif %}
{# -------------- Extra Current Conditions -------------- #}
{% if config.showExtraCurrentConditions %}
<div class="extra-current-conditions-wrapper small bright">
<span class="temperature-container">
<span class="high-temperature">{{ forecast.currently.tempRange.high }}</span>
<span class="temperature-separator dimmed">/</span>
<span class="low-temperature">{{ forecast.currently.tempRange.low }}</span>
</span>
{% if config.showPrecipitation %}
<span class="precipitation-container">
{% if (config.showInlineIcons) %}
<img class="inline-icon rain" src="{{ inlineIcons.rain }}" />
{% endif %}
<span class="pop">{{ forecast.currently.precipitation.pop }}</span>
{% if forecast.currently.precipitation.accumulation %}
<span class="pop">{{ forecast.currently.precipitation.accumulation }}</span>
{% endif %}
</span>
{% endif %}
{% if config.showWind %}
<span class="wind-container">
{% if (config.showInlineIcons) %}
<img class="inline-icon wind-icon" src="{{ inlineIcons.wind }}" />
{% endif %}
<span class="wind-speed">{{ forecast.currently.wind.windSpeed }}</span>
{% if forecast.currently.wind.windGust %}
<span class="wind-gusts">{{ forecast.currently.wind.windGust }}</span>
{% endif %}
</span>
{% endif %}
</div>
{% endif %}
{# -------------- Summary -------------- #}
{% if config.showSummary %}
<div class="summary-wrapper small">
<div class="summary">{{ forecast.summary }}</div>
</div>
{% endif %}
{# -------------- Forecast Title -------------- #}
{% if not (config.forecastHeaderText == "") and (config.showHourlyForecast or config.showDailyForecast) %}
<header class="module-header forecast-header">{{ config.forecastHeaderText | safe }}</header>
{% endif %}
{# -------------- Forecast -------------- #}
{% if config.showHourlyForecast or config.showDailyForecast %}
<div class="forecast-container">
{% if config.showForecastTableColumnHeaderIcons and config.forecastLayout == "table" %}
<div class="header-row">
<span class="date-time-header"> </span>
<span class="weather-icon-header"> </span>
<span class="temperature-header"> </span>
{% if config.showPrecipitation %}
<span class="precipitation-header">
<img class="inline-icon rain" src="{{ inlineIcons.rain }}" />
</span>
{% endif %}
{% if config.showWind %}
<span class="wind-header">
<img class="inline-icon wind" src="{{ inlineIcons.wind }}" />
</span>
{% endif %}
</div>
{% endif %}
{# Hourly #}
{% if config.showHourlyForecast %}
{% for h in forecast.hourly %}
<div class="forecast-item hourly">
<span class="time">{{ h.time }}</span>
<span class="forecast-icon-container">
{% if h.animatedIconId %}
<canvas class="skycon-{{ identifier }} forecast-icon" data-animated-icon-name="{{ h.animatedIconName }}" id="{{ h.animatedIconId }}" width="{{ animatedIconSizes.forecast }}" height="{{ animatedIconSizes.forecast }}"></canvas>
{% else %}
<img class="forecast-icon" src="{{ h.iconPath }}" />
{% endif %}
</span>
<span class="temperature small">{{ h.temperature }}</span>
{% if config.showPrecipitation %}
<span class="precipitation-container">
{% if (config.showInlineIcons and config.forecastLayout == "tiled" ) %}
<img class="inline-icon rain" src="{{ inlineIcons.rain }}" />
{% endif %}
<span class="pop">{{ h.precipitation.pop }}</span>
{% if h.precipitation.accumulation %}
<span class="pop">{{ h.precipitation.accumulation }}</span>
{% endif %}
</span>
{% endif %}
{% if config.showWind %}
<span class="wind-container">
{% if (config.showInlineIcons and config.forecastLayout == "tiled" ) %}
<img class="inline-icon wind-icon" src="{{ inlineIcons.wind }}" />
{% endif %}
<span class="wind-speed">{{ h.wind.windSpeed }}</span>
{% if h.wind.windGust %}
<span class="wind-gusts">{{ h.wind.windGust }}</span>
{% endif %}
</span>
{% endif %}
</div>
{% endfor %}
{% endif %}
{# Daily #}
{% if config.showDailyForecast %}
{% for d in forecast.daily %}
<div class="forecast-item hourly">
<span class="day-name">{{ d.day }}</span>
<span class="forecast-icon-container">
{% if d.animatedIconId %}
<canvas class="skycon-{{ identifier }} forecast-icon" data-animated-icon-name="{{ d.animatedIconName }}" id="{{ d.animatedIconId }}" width="{{ animatedIconSizes.forecast }}" height="{{ animatedIconSizes.forecast }}"></canvas>
{% else %}
<img class="forecast-icon" src="{{ d.iconPath }}" />
{% endif %}
</span>
<span class="temperature-container small">
<span class="high-temperature">{{ d.tempRange.high }}</span>
<span class="temperature-separator dimmed">/</span>
<span class="low-temperature">{{ d.tempRange.low }}</span>
</span>
{% if config.showPrecipitation %}
<span class="precipitation-container">
{% if (config.showInlineIcons and config.forecastLayout == "tiled" ) %}
<img class="inline-icon rain" src="{{ inlineIcons.rain }}" />
{% endif %}
<span class="pop">{{ d.precipitation.pop }}</span>
{% if d.precipitation.accumulation %}
<span class="pop">{{ d.precipitation.accumulation }}</span>
{% endif %}
</span>
{% endif %}
{% if config.showWind %}
<span class="wind-container">
{% if (config.showInlineIcons and config.forecastLayout == "tiled" ) %}
<img class="inline-icon wind-icon" src="{{ inlineIcons.wind }}" />
{% endif %}
<span class="wind-speed">{{ d.wind.windSpeed }}</span>
{% if d.wind.windGust %}
<span class="wind-gusts">{{ d.wind.windGust }}</span>
{% endif %}
</span>
{% endif %}
</div>
{% endfor %}
{% endif %}
</div>
{% endif %}
<div class="meta-timestamp" id="{{ moduleTimestampIdPrefix + identifier }}" data-timestamp="{{ timeStamp }}"></div>
<div class="attribution small dimmed">Powered by Dark Sky</div>
{% endif %}
</div>