@ -447,6 +447,11 @@ WeatherMenuButton.prototype = {
return days [ this . parse _day ( abr ) ] ;
} ,
get _compass _direction : function ( deg ) {
let directions = [ 'N' , 'NE' , 'E' , 'SE' , 'S' , 'SW' , 'W' , 'NW' ] ;
return _ ( directions [ Math . round ( deg / 45 ) ] ) ;
} ,
load _json _async : function ( url , fun ) {
let here = this ;
let session = new Soup . SessionAsync ( ) ;
@ -506,7 +511,7 @@ WeatherMenuButton.prototype = {
let humidity = weather . get _object _member ( 'atmosphere' ) . get _string _member ( 'humidity' ) + ' %' ;
let pressure = weather . get _object _member ( 'atmosphere' ) . get _string _member ( 'pressure' ) ;
let pressure _unit = weather . get _object _member ( 'units' ) . get _string _member ( 'pressure' ) ;
let wind _direction = weather . get _object _member ( 'wind' ) . get _string _member ( 'direction' ) ;
let wind _direction = this . get _compass _direction ( weather . get _object _member ( 'wind' ) . get _string _member ( 'direction' ) ) ;
let wind = weather . get _object _member ( 'wind' ) . get _string _member ( 'speed' ) ;
let wind _unit = weather . get _object _member ( 'units' ) . get _string _member ( 'speed' ) ;
let iconname = this . get _weather _icon _safely ( weather _c . get _string _member ( 'code' ) ) ;
@ -523,7 +528,7 @@ WeatherMenuButton.prototype = {
this . _currentWeatherTemperature . text = temperature + ' ' + this . unit _to _unicode ( ) ;
this . _currentWeatherHumidity . text = humidity ;
this . _currentWeatherPressure . text = pressure + ' ' + pressure _unit ;
this . _currentWeatherWind . text = ( wind _direction ? wind _direction + ' ' : '' ) + wind + ' ' + wind _unit ;
this . _currentWeatherWind . text = ( wind _direction && wind > 0 ? wind _direction + ' ' : '' ) + wind + ' ' + wind _unit ;
// Refresh forecast
let date _string = [ _ ( 'Today' ) , _ ( 'Tomorrow' ) ] ;