From 3cfbba547e7ad33a45d007dd9b5c4137cf27a28c Mon Sep 17 00:00:00 2001 From: Neroth Date: Fri, 27 Apr 2012 15:39:47 +0200 Subject: [PATCH] Add pressure state (by Odysseus86) --- src/extension.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/extension.js b/src/extension.js index 26896e5..8254b5e 100644 --- a/src/extension.js +++ b/src/extension.js @@ -664,6 +664,17 @@ WeatherMenuButton.prototype = { return directions[Math.round(deg / 45) % directions.length]; }, + get_pressure_state: function(state) { + switch (parseInt(state, 3)) { + case 0: + return '\u2192'; + case 1: + return '\u2197'; + case 2: + return '\u2198'; + } + }, + load_json_async: function(url, fun) { let here = this; @@ -731,6 +742,7 @@ WeatherMenuButton.prototype = { let humidity = weather.atmosphere.humidity + ' %'; let pressure = weather.atmosphere.pressure; let pressure_unit = weather.units.pressure; + let pressure_state = weather.atmosphere.rising; let wind_direction = this.get_compass_direction(weather.wind.direction); let wind = weather.wind.speed; let wind_unit = weather.units.speed; @@ -763,7 +775,7 @@ WeatherMenuButton.prototype = { this._currentWeatherLocation.text = location; this._currentWeatherTemperature.text = temperature + ' ' + this.unit_to_unicode(); this._currentWeatherHumidity.text = humidity; - this._currentWeatherPressure.text = pressure + ' ' + pressure_unit; + this._currentWeatherPressure.text = pressure + ' ' + pressure_unit + ' ' + this.get_pressure_state(pressure_state); this._currentWeatherSunrise.text = sunrise; this._currentWeatherSunset.text = sunset;