@@ -42,7 +42,9 @@ Module.register("weather", {
4242 colored : false ,
4343 absoluteDates : false ,
4444 forecastDateFormat : "ddd" , // format for forecast date display, e.g., "ddd" = Mon, "dddd" = Monday, "D MMM" = 18 Oct
45- hourlyForecastIncrements : 1
45+ hourlyForecastIncrements : 1 ,
46+ themeDir : "./" ,
47+ themeCustomScripts : [ ]
4648 } ,
4749
4850 // Module properties (all providers run server-side)
@@ -57,14 +59,18 @@ Module.register("weather", {
5759
5860 // Define required scripts.
5961 getStyles ( ) {
60- return [ "font-awesome.css" , "weather-icons.css" , " weather.css" ] ;
62+ return [ "font-awesome.css" , "weather-icons.css" , ` ${ this . config . themeDir } weather.css` ] ;
6163 } ,
6264
6365 // Return the scripts that are necessary for the weather module.
6466 getScripts ( ) {
6567 // Only load client-side dependencies for rendering
6668 // All providers run server-side via node_helper
67- return [ "moment.js" , "weatherutils.js" , "weatherobject.js" , "suncalc.js" ] ;
69+ const resArr = [ "moment.js" , "weatherutils.js" , "weatherobject.js" , "suncalc.js" ] ;
70+ this . config . themeCustomScripts . forEach ( ( element ) => {
71+ resArr . push ( `${ this . config . themeDir } ${ element } ` ) ;
72+ } ) ;
73+ return resArr ;
6874 } ,
6975
7076 // Override getHeader method.
@@ -98,6 +104,8 @@ Module.register("weather", {
98104 // All providers run server-side: generate unique instance ID and initialize via node_helper
99105 this . instanceId = `${ this . identifier } _${ Date . now ( ) } ` ;
100106
107+ if ( window . initWeatherTheme ) window . initWeatherTheme ( ) ;
108+
101109 Log . log ( `[weather] Initializing server-side provider with instance ID: ${ this . instanceId } ` ) ;
102110
103111 this . sendSocketNotification ( "INIT_WEATHER" , {
@@ -211,15 +219,15 @@ Module.register("weather", {
211219 getTemplate ( ) {
212220 switch ( this . config . type . toLowerCase ( ) ) {
213221 case "current" :
214- return " current.njk" ;
222+ return ` ${ this . config . themeDir } current.njk` ;
215223 case "hourly" :
216- return " hourly.njk" ;
224+ return ` ${ this . config . themeDir } hourly.njk` ;
217225 case "daily" :
218226 case "forecast" :
219- return " forecast.njk" ;
227+ return ` ${ this . config . themeDir } forecast.njk` ;
220228 //Make the invalid values use the "Loading..." from forecast
221229 default :
222- return " forecast.njk" ;
230+ return ` ${ this . config . themeDir } forecast.njk` ;
223231 }
224232 } ,
225233
@@ -242,7 +250,11 @@ Module.register("weather", {
242250 // What to do when the weather provider has new information available?
243251 updateAvailable ( ) {
244252 Log . log ( "[weather] New weather information available." ) ;
245- this . updateDom ( 300 ) ;
253+ if ( window . updateWeatherTheme ) {
254+ window . updateWeatherTheme ( this ) ;
255+ } else {
256+ this . updateDom ( 300 ) ;
257+ } ;
246258
247259 const currentWeather = this . currentWeatherObject ;
248260
0 commit comments