diff --git a/js/weather/weather.js b/js/weather/weather.js index 6db8ea96..8147be6f 100644 --- a/js/weather/weather.js +++ b/js/weather/weather.js @@ -31,7 +31,8 @@ var weather = { forecastEndpoint: 'forecast/daily', updateInterval: config.weather.interval || 6000, fadeInterval: config.weather.fadeInterval || 1000, - intervalId: null + intervalId: null, + orientation: config.weather.orientation || 'vertical', } /** @@ -89,14 +90,14 @@ weather.updateCurrentWeather = function () { _sunrise = moment(data.sys.sunrise*1000).format('HH:mm'), _sunset = moment(data.sys.sunset*1000).format('HH:mm'); - var _newWindHtml = ' ' + this.ms2Beaufort(_wind), - _newSunHtml = ' ' + _sunrise; + var _newWindHtml = ' ' + this.ms2Beaufort(_wind) + '', + _newSunHtml = ' ' + _sunrise + ''; if (_sunrise < _now && _sunset > _now) { - _newSunHtml = ' ' + _sunset; + _newSunHtml = ' ' + _sunset + ''; } - $(this.windSunLocation).updateWithText(_newWindHtml + ' ' + _newSunHtml, this.fadeInterval); + $(this.windSunLocation).updateWithText(_newWindHtml + ' ' + _newSunHtml,this.fadeInterval); }.bind(this), error: function () { @@ -118,28 +119,44 @@ weather.updateWeatherForecast = function () { success: function (data) { var _opacity = 1, - _forecastHtml = ''; + _forecastHtml = '
' + moment(_forecast.dt, 'X').format('ddd') + ' | '; - _forecastHtml += ''; - _forecastHtml += ' | ' + this.roundValue(_forecast.temp.max) + ' | '; - _forecastHtml += '' + this.roundValue(_forecast.temp.min) + ' | '; - - _forecastHtml += '' + moment(_forecast.dt, 'X').format('ddd') + ' | '; + _forecastHtml2 += ''; + _forecastHtml3 += ' | ' + this.roundValue(_forecast.temp.max) + ' | '; + _forecastHtml4 += '' + this.roundValue(_forecast.temp.min) + ' | '; _opacity -= 0.155; + if (this.orientation == 'vertical') { + _forecastHtml += _forecastHtml2 + _forecastHtml3 + _forecastHtml4 + ''; + } + } + _forecastHtml += '', + _forecastHtml2 += '', + _forecastHtml3 += '', + _forecastHtml4 += ''; + + if (this.orientation == 'vertical') { + _forecastHtml += '