mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Add flag that removes today entry in forecast
This commit is contained in:
parent
491f5aa776
commit
fc5a438cdc
@ -5,9 +5,9 @@
|
|||||||
{% set forecast = forecast.slice(0, numSteps) %}
|
{% set forecast = forecast.slice(0, numSteps) %}
|
||||||
{% for f in forecast %}
|
{% for f in forecast %}
|
||||||
<tr {% if config.colored %}class="colored"{% endif %} {% if config.fade %}style="opacity: {{ currentStep | opacity(numSteps) }};"{% endif %}>
|
<tr {% if config.colored %}class="colored"{% endif %} {% if config.fade %}style="opacity: {{ currentStep | opacity(numSteps) }};"{% endif %}>
|
||||||
{% if (currentStep == 0) %}
|
{% if (currentStep == 0) and config.ignoreToday == false %}
|
||||||
<td class="day">{{ "TODAY" | translate }}</td>
|
<td class="day">{{ "TODAY" | translate }}</td>
|
||||||
{% elif (currentStep == 1) %}
|
{% elif (currentStep == 1) and config.ignoreToday == false %}
|
||||||
<td class="day">{{ "TOMORROW" | translate }}</td>
|
<td class="day">{{ "TOMORROW" | translate }}</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td class="day">{{ f.date.format('ddd') }}</td>
|
<td class="day">{{ f.date.format('ddd') }}</td>
|
||||||
|
@ -33,6 +33,7 @@ Module.register("weather", {
|
|||||||
showIndoorHumidity: false,
|
showIndoorHumidity: false,
|
||||||
maxNumberOfDays: 5,
|
maxNumberOfDays: 5,
|
||||||
maxEntries: 5,
|
maxEntries: 5,
|
||||||
|
ignoreToday: false,
|
||||||
fade: true,
|
fade: true,
|
||||||
fadePoint: 0.25, // Start on 1/4th of the list.
|
fadePoint: 0.25, // Start on 1/4th of the list.
|
||||||
initialLoadDelay: 0, // 0 seconds delay
|
initialLoadDelay: 0, // 0 seconds delay
|
||||||
@ -128,10 +129,16 @@ Module.register("weather", {
|
|||||||
|
|
||||||
// Add all the data to the template.
|
// Add all the data to the template.
|
||||||
getTemplateData: function () {
|
getTemplateData: function () {
|
||||||
|
const forecast = this.weatherProvider.weatherForecast()
|
||||||
|
|
||||||
|
if (this.config.ignoreToday) {
|
||||||
|
forecast.splice(0, 1)
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
config: this.config,
|
config: this.config,
|
||||||
current: this.weatherProvider.currentWeather(),
|
current: this.weatherProvider.currentWeather(),
|
||||||
forecast: this.weatherProvider.weatherForecast(),
|
forecast: forecast,
|
||||||
hourly: this.weatherProvider.weatherHourly(),
|
hourly: this.weatherProvider.weatherHourly(),
|
||||||
indoor: {
|
indoor: {
|
||||||
humidity: this.indoorHumidity,
|
humidity: this.indoorHumidity,
|
||||||
@ -260,7 +267,7 @@ Module.register("weather", {
|
|||||||
|
|
||||||
this.nunjucksEnvironment().addFilter(
|
this.nunjucksEnvironment().addFilter(
|
||||||
"calcNumEntries",
|
"calcNumEntries",
|
||||||
function (dataArray) {
|
function (dataArray) {
|
||||||
return Math.min(dataArray.length, this.config.maxEntries);
|
return Math.min(dataArray.length, this.config.maxEntries);
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user