From 037589c43dfaa70ef97a2886c9480bb25a5a1ac0 Mon Sep 17 00:00:00 2001 From: Simon Claessens Date: Tue, 24 May 2011 15:07:48 +0200 Subject: [PATCH 1/2] add weather code for icon --- weather@venemo.net/extension.js | 87 +++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 4 deletions(-) diff --git a/weather@venemo.net/extension.js b/weather@venemo.net/extension.js index 293dc5b..7136cf0 100644 --- a/weather@venemo.net/extension.js +++ b/weather@venemo.net/extension.js @@ -117,27 +117,106 @@ WeatherMenuButton.prototype = { get_weather_icon: function(code) { switch (parseInt(code, 10)){ + case 0: + return 'weather-severe-alert'; + case 1: + return 'weather-severe-alert'; + case 2: + return 'weather-severe-alert'; + case 3: + return 'weather-severe-alert'; case 4: return 'weather-storm'; case 5: + return 'weather-snow-rain'; + case 6: + return 'weather-snow-rain'; + case 7: + return 'weather-snow'; + case 8: + return 'weather-freezing-rain'; + case 9: + return 'weather-fog'; case 10: + return 'weather-freezing-rain'; case 11: + return 'weather-showers'; case 12: - case 39: - case 40: return 'weather-showers'; + case 13: + return 'weather-snow'; + case 14: + return 'weather-snow'; + case 15: + return 'weather-snow'; + case 16: + return 'weather-snow'; + case 17: + return 'weather-snow'; + case 18: + return 'weather-snow'; + case 19: + return 'weather-fog'; + case 20: + return 'weather-fog'; + case 21: + return 'weather-fog'; + case 22: + return 'weather-fog'; + case 23: + return 'weather-few-clouds'; + case 24: + return 'weather-few-clouds'; + case 25: + return 'weather-few-clouds'; case 26: return 'weather-overcast'; + case 27: + return 'weather-clouds-night'; case 28: + return 'weather-few-clouds'; + case 29: + return 'weather-few-clouds-night'; case 30: - case 44: return 'weather-few-clouds'; + case 31: + return 'weather-clear-night'; case 32: + return 'weather-clear'; + case 33: + return 'weather-clear'; case 34: + return 'weather-clear-night'; + case 35: + return 'weather-snow-rain'; case 36: return 'weather-clear'; - default: + case 37: + return 'weather-storm'; + case 38: + return 'weather-storm'; + case 39: + return 'weather-storm'; + case 40: + return 'weather-showers-scattered'; + case 41: + return 'weather-snow'; + case 42: return 'weather-snow'; + case 43: + return 'weather-snow'; + case 44: + return 'weather-few-clouds'; + case 45: + return 'weather-storm'; + case 46: + return 'weather-snow'; + case 47: + return 'weather-storm'; + case 3200: + return 'weather-severe-alert'; + default: + return 'weather-severe-alert'; } }, From dad4128d24ae9970199f5d93fe3e4e8ded3ae218 Mon Sep 17 00:00:00 2001 From: Simon Claessens Date: Tue, 24 May 2011 15:28:28 +0200 Subject: [PATCH 2/2] full comment and weather codes --- weather@venemo.net/extension.js | 99 +++++++++++++++++---------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/weather@venemo.net/extension.js b/weather@venemo.net/extension.js index 7136cf0..787f896 100644 --- a/weather@venemo.net/extension.js +++ b/weather@venemo.net/extension.js @@ -117,103 +117,104 @@ WeatherMenuButton.prototype = { get_weather_icon: function(code) { switch (parseInt(code, 10)){ - case 0: + /* see http://developer.yahoo.com/weather/#codetable */ + case 0:/* tornado */ return 'weather-severe-alert'; - case 1: + case 1:/* tropical storm */ return 'weather-severe-alert'; - case 2: + case 2:/* hurricane */ return 'weather-severe-alert'; - case 3: + case 3:/* severe thunderstorms */ return 'weather-severe-alert'; - case 4: + case 4:/* thunderstorms */ return 'weather-storm'; - case 5: + case 5:/* mixed rain and snow */ return 'weather-snow-rain'; - case 6: + case 6:/* mixed rain and sleet */ return 'weather-snow-rain'; - case 7: + case 7:/* mixed snow and sleet */ return 'weather-snow'; - case 8: + case 8:/* freezing drizzle */ return 'weather-freezing-rain'; - case 9: + case 9:/* drizzle */ return 'weather-fog'; - case 10: + case 10:/* freezing rain */ return 'weather-freezing-rain'; - case 11: + case 11:/* showers */ return 'weather-showers'; - case 12: + case 12:/* showers */ return 'weather-showers'; - case 13: + case 13:/* snow flurries */ return 'weather-snow'; - case 14: + case 14:/* light snow showers */ return 'weather-snow'; - case 15: + case 15:/* blowing snow */ return 'weather-snow'; - case 16: + case 16:/* snow */ return 'weather-snow'; - case 17: + case 17:/* hail */ return 'weather-snow'; - case 18: + case 18:/* sleet */ return 'weather-snow'; - case 19: + case 19:/* dust */ return 'weather-fog'; - case 20: + case 20:/* foggy */ return 'weather-fog'; - case 21: + case 21:/* haze */ return 'weather-fog'; - case 22: + case 22:/* smoky */ return 'weather-fog'; - case 23: + case 23:/* blustery */ return 'weather-few-clouds'; - case 24: + case 24:/* windy */ return 'weather-few-clouds'; - case 25: + case 25:/* cold */ return 'weather-few-clouds'; - case 26: + case 26:/* cloudy */ return 'weather-overcast'; - case 27: + case 27:/* mostly cloudy (night) */ return 'weather-clouds-night'; - case 28: + case 28:/* mostly cloudy (day) */ return 'weather-few-clouds'; - case 29: + case 29:/* partly cloudy (night) */ return 'weather-few-clouds-night'; - case 30: + case 30:/* partly cloudy (day) */ return 'weather-few-clouds'; - case 31: + case 31:/* clear (night) */ return 'weather-clear-night'; - case 32: + case 32:/* sunny */ return 'weather-clear'; - case 33: + case 33:/* fair (night) */ return 'weather-clear'; - case 34: + case 34:/* fair (day) */ return 'weather-clear-night'; - case 35: + case 35:/* mixed rain and hail */ return 'weather-snow-rain'; - case 36: + case 36:/* hot */ return 'weather-clear'; - case 37: + case 37:/* isolated thunderstorms */ return 'weather-storm'; - case 38: + case 38:/* scattered thunderstorms */ return 'weather-storm'; - case 39: + case 39:/* scattered thunderstorms */ return 'weather-storm'; - case 40: + case 40:/* scattered showers */ return 'weather-showers-scattered'; - case 41: + case 41:/* heavy snow */ return 'weather-snow'; - case 42: + case 42:/* scattered snow showers */ return 'weather-snow'; - case 43: + case 43:/* heavy snow */ return 'weather-snow'; - case 44: + case 44:/* partly cloudy */ return 'weather-few-clouds'; - case 45: + case 45:/* thundershowers */ return 'weather-storm'; - case 46: + case 46:/* snow showers */ return 'weather-snow'; - case 47: + case 47:/* isolated thundershowers */ return 'weather-storm'; - case 3200: + case 3200:/* not available */ return 'weather-severe-alert'; default: return 'weather-severe-alert';