@@ -43,7 +43,7 @@ Module.register("weather", {
4343 absoluteDates : false ,
4444 forecastDateFormat : "ddd" , // format for forecast date display, e.g., "ddd" = Mon, "dddd" = Monday, "D MMM" = 18 Oct
4545 hourlyForecastIncrements : 1 ,
46- themeDir : "./ " ,
46+ themeDir : "" ,
4747 themeCustomScripts : [ ]
4848 } ,
4949
@@ -57,9 +57,18 @@ Module.register("weather", {
5757 // Can be used by the provider to display location of event if nothing else is specified
5858 firstEvent : null ,
5959
60+ getThemeDir ( ) {
61+ const td = this . config . themeDir . replace ( / \/ + $ / , "" ) ;
62+ if ( td . length > 0 ) {
63+ return `${ td } /` ;
64+ } else {
65+ return "" ;
66+ }
67+ } ,
68+
6069 // Define required scripts.
6170 getStyles ( ) {
62- return [ "font-awesome.css" , "weather-icons.css" , `${ this . config . themeDir } weather.css` ] ;
71+ return [ "font-awesome.css" , "weather-icons.css" , `${ this . getThemeDir ( ) } weather.css` ] ;
6372 } ,
6473
6574 // Return the scripts that are necessary for the weather module.
@@ -68,7 +77,7 @@ Module.register("weather", {
6877 // All providers run server-side via node_helper
6978 const resArr = [ "moment.js" , "weatherutils.js" , "weatherobject.js" , "suncalc.js" ] ;
7079 this . config . themeCustomScripts . forEach ( ( element ) => {
71- resArr . push ( `${ this . config . themeDir } ${ element } ` ) ;
80+ resArr . push ( `${ this . getThemeDir ( ) } ${ element } ` ) ;
7281 } ) ;
7382 return resArr ;
7483 } ,
@@ -219,15 +228,15 @@ Module.register("weather", {
219228 getTemplate ( ) {
220229 switch ( this . config . type . toLowerCase ( ) ) {
221230 case "current" :
222- return `${ this . config . themeDir } current.njk` ;
231+ return `${ this . getThemeDir ( ) } current.njk` ;
223232 case "hourly" :
224- return `${ this . config . themeDir } hourly.njk` ;
233+ return `${ this . getThemeDir ( ) } hourly.njk` ;
225234 case "daily" :
226235 case "forecast" :
227- return `${ this . config . themeDir } forecast.njk` ;
236+ return `${ this . getThemeDir ( ) } forecast.njk` ;
228237 //Make the invalid values use the "Loading..." from forecast
229238 default :
230- return `${ this . config . themeDir } forecast.njk` ;
239+ return `${ this . getThemeDir ( ) } forecast.njk` ;
231240 }
232241 } ,
233242
0 commit comments