mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Check for undefined header data in weather modules
This commit is contained in:
parent
5aa7097a6e
commit
86fb1b938b
@ -37,6 +37,8 @@ Module.register("currentweather", {
|
|||||||
weatherEndpoint: "weather",
|
weatherEndpoint: "weather",
|
||||||
|
|
||||||
appendLocationNameToHeader: true,
|
appendLocationNameToHeader: true,
|
||||||
|
useLocationAsHeader: false,
|
||||||
|
|
||||||
calendarClass: "calendar",
|
calendarClass: "calendar",
|
||||||
tableClass: "large",
|
tableClass: "large",
|
||||||
|
|
||||||
@ -267,15 +269,16 @@ Module.register("currentweather", {
|
|||||||
|
|
||||||
// Override getHeader method.
|
// Override getHeader method.
|
||||||
getHeader: function () {
|
getHeader: function () {
|
||||||
if (this.config.appendLocationNameToHeader && this.data.header !== undefined) {
|
|
||||||
return this.data.header + " " + this.fetchedLocationName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.config.useLocationAsHeader && this.config.location !== false) {
|
if (this.config.useLocationAsHeader && this.config.location !== false) {
|
||||||
return this.config.location;
|
return this.config.location;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.data.header;
|
if (this.config.appendLocationNameToHeader) {
|
||||||
|
if (this.data.header) return this.data.header + " " + this.fetchedLocationName;
|
||||||
|
else return this.fetchedLocationName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.data.header ? this.data.header : "";
|
||||||
},
|
},
|
||||||
|
|
||||||
// Override notification handler.
|
// Override notification handler.
|
||||||
|
@ -73,11 +73,12 @@ Module.register("weather", {
|
|||||||
|
|
||||||
// Override getHeader method.
|
// Override getHeader method.
|
||||||
getHeader: function () {
|
getHeader: function () {
|
||||||
if (this.config.appendLocationNameToHeader && this.data.header !== undefined && this.weatherProvider) {
|
if (this.config.appendLocationNameToHeader && this.weatherProvider) {
|
||||||
return this.data.header + " " + this.weatherProvider.fetchedLocation();
|
if (this.data.header) return this.data.header + " " + this.weatherProvider.fetchedLocation();
|
||||||
|
else return this.weatherProvider.fetchedLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.data.header;
|
return this.data.header ? this.data.header : "";
|
||||||
},
|
},
|
||||||
|
|
||||||
// Start the weather module.
|
// Start the weather module.
|
||||||
|
@ -206,10 +206,11 @@ Module.register("weatherforecast", {
|
|||||||
// Override getHeader method.
|
// Override getHeader method.
|
||||||
getHeader: function () {
|
getHeader: function () {
|
||||||
if (this.config.appendLocationNameToHeader) {
|
if (this.config.appendLocationNameToHeader) {
|
||||||
return this.data.header + " " + this.fetchedLocationName;
|
if (this.data.header) return this.data.header + " " + this.fetchedLocationName;
|
||||||
|
else return this.fetchedLocationName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.data.header;
|
return this.data.header ? this.data.header : "";
|
||||||
},
|
},
|
||||||
|
|
||||||
// Override notification handler.
|
// Override notification handler.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user