forked from MarcLandis/MMM-OpenWeatherMapForecast
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MMM-OpenWeatherMapForecast.njk
278 lines (220 loc) · 11 KB
/
MMM-OpenWeatherMapForecast.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<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>
{% if config.showFeelsLike %}
<span class="current feelslike dimmed light">{{ forecast.currently.feelslike }}</span>
{% endif %}
</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.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 %}
{% if config.showPrecipitation %}
<span class="precipitation-container">
{% if (config.showInlineIcons) %}
{% if forecast.currently.precipitation.accumulationtype == "snow" %}
<img class="inline-icon snow" src="{{ inlineIcons.snow }}" />
{% else %}
<img class="inline-icon rain" src="{{ inlineIcons.rain }}" />
{% endif %}
{% endif %}
{% if forecast.currently.precipitation.accumulation %}
<span class="pop">{{ forecast.currently.precipitation.pop }}</span>
{% else %}
<span class="pop">0%</span>
{% endif %}
{% if forecast.currently.precipitation.accumulation %}
<span class="pop">{{ forecast.currently.precipitation.accumulation }}</span>
{% endif %}
</span>
{% endif %}
{% if config.showSun %}
<br>
<span class="sunrise-container">
{% if (config.showInlineIcons) %}
<img class="inline-icon sunrise-icon" src="{{ inlineIcons.sunrise }}" />
{% endif %}
<span class="sunrise">{{ forecast.currently.sunrise }}</span>
</span>
<span class="sunset-container">
{% if (config.showInlineIcons) %}
<img class="inline-icon sunset-icon" src="{{ inlineIcons.sunset }}" />
{% endif %}
<span class="sunset">{{ forecast.currently.sunset }}</span>
</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.showWind %}
<span class="wind-header">
<img class="inline-icon wind" src="{{ inlineIcons.wind }}" />
</span>
{% endif %}
{% if config.showPrecipitation %}
<span class="precipitation-header">
<img class="inline-icon rain" src="{{ inlineIcons.rain }}" />
</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.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 %}
{% if config.showPrecipitation %}
<span class="precipitation-container">
{% if h.precipitation.accumulation %}
{% if (config.showInlineIcons) and config.forecastLayout == "tiled" %}
{% if h.precipitation.accumulationtype == "rain" %}
<img class="inline-icon rain" src="{{ inlineIcons.rain }}" />
{% endif %}
{% if h.precipitation.accumulationtype == "snow" %}
<img class="inline-icon snow" src="{{ inlineIcons.snow }}" />
{% endif %}
{% endif %}
<span class="pop">{{ h.precipitation.pop }}</span>
<br>
<span class="pop">{{ h.precipitation.accumulation }}</span>
{% else %}
{% if (config.showInlineIcons) and config.forecastLayout == "tiled" %}
<img class="inline-icon rain" src="{{ inlineIcons.rain }}" />
{% endif %}
<span class="pop">0%</span>
{% if config.forecastLayout == "tiled" %}
<br>
<span class="pop"> </span>
{% endif %}
{% 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.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 %}
{% if config.showPrecipitation %}
<span class="precipitation-container">
{% if d.precipitation.accumulation %}
{% if (config.showInlineIcons) and config.forecastLayout == "tiled" %}
{% if d.precipitation.accumulationtype == "rain" %}
<img class="inline-icon rain" src="{{ inlineIcons.rain }}" />
{% endif %}
{% if d.precipitation.accumulationtype == "snow" %}
<img class="inline-icon snow" src="{{ inlineIcons.snow }}" />
{% endif %}
{% endif %}
<span class="pop">{{ d.precipitation.pop }}</span>
<br>
<span class="pop">{{ d.precipitation.accumulation }}</span>
{% else %}
{% if (config.showInlineIcons) and config.forecastLayout == "tiled" %}
<img class="inline-icon rain" src="{{ inlineIcons.rain }}" />
{% endif %}
<span class="pop">0%</span>
{% if config.forecastLayout == "tiled" %}
<br>
<span class="pop"> </span>
{% endif %}
{% endif %}
</span>
{% endif %}
</div>
{% endfor %}
{% endif %}
</div>
{% endif %}
<div class="meta-timestamp" id="{{ moduleTimestampIdPrefix + identifier }}" data-timestamp="{{ timeStamp }}"></div>
{% endif %}
</div>