@@ -72,22 +72,50 @@ var nowweather =
7272 let nowUT = new Date ( ) ;
7373 let nowEH = Math . floor ( nowUT . valueOf ( ) / ( 1000 * 60 * 60 ) ) ;
7474 let bestT = - 1 ;
75+ let report = "" ;
7576 for ( t in nowweather_shared . current_weather )
7677 {
7778 if ( Math . abs ( t - nowEH ) < Math . abs ( bestT - nowEH ) )
7879 bestT = t ;
7980 }
8081 if ( bestT > - 1 )
8182 {
82- if ( nowweather_shared . current_weather [ bestT ] . hasOwnProperty ( 'temp' ) )
83- document . getElementById ( 'nowWeather-temp' ) . innerHTML = nowweather_shared . current_weather [ bestT ] . temp ;
84- else
85- document . getElementById ( 'nowWeather-temp' ) . innerHTML = '. . .' ;
83+ report += nowweather_shared . current_weather [ bestT ] . temp . toString ( ) + " Now" ;
8684 if ( nowweather_shared . current_weather [ bestT ] . hasOwnProperty ( 'icon' ) )
8785 document . getElementById ( 'nowWeather-icon' ) . setAttribute ( 'src' , nowweather_shared . current_weather [ bestT ] . icon ) ;
8886 else
8987 document . getElementById ( 'nowWeather-icon' ) . setAttribute ( 'src' , 'chrome://nowweather/skin/na.jpg' ) ;
9088 }
89+
90+ let tempDate = new Date ( ) ;
91+ tempDate . setHours ( 0 , 0 , 0 , 0 ) ;
92+ const days = [ "Sun" , "Mon" , "Tue" , "Wed" , "Thu" , "Fri" , "Sat" ] ;
93+ let currentDay = tempDate . getDay ( ) ;
94+ let currentStart = tempDate . getTime ( ) / ( 1000 * 60 * 60 ) ;
95+ for ( let i = 0 ; i < 8 ; i ++ ) {
96+ let currentEnd = currentStart + 24 ;
97+ let low = 200 ;
98+ let high = - 200 ;
99+ for ( t in nowweather_shared . current_weather )
100+ {
101+ let degrees = parseInt ( nowweather_shared . current_weather [ t ] . temp . toString ( ) . split ( '°' ) [ 0 ] ) ;
102+ if ( t >= currentStart && t <= currentEnd )
103+ {
104+ if ( degrees < low )
105+ low = degrees ;
106+ if ( degrees > high )
107+ high = degrees ;
108+ }
109+ }
110+
111+ report += " / " + high + ' ' + days [ currentDay ] + ' Hi' ;
112+ report += " / " + low + ' ' + days [ currentDay ] + ' Lo' ;
113+ currentDay ++ ;
114+ currentDay %= 7 ;
115+ currentStart = currentEnd ;
116+ }
117+
118+ document . getElementById ( 'nowWeather-temp' ) . innerHTML = report ;
91119 return true ;
92120 } ,
93121 openWebsite : async function ( )
0 commit comments