|
|
|
|
@ -116,6 +116,7 @@ fetch(weatherUrl)
|
|
|
|
|
document.getElementById('todayTemperature').innerText = Math.round(json.main.temp) + '°C';
|
|
|
|
|
document.getElementById('todayFahrenheit').innerText = Math.round(convertToF(json.main.temp)) + '℉';
|
|
|
|
|
document.getElementById('todayIcon').src = 'https://data.chinahighlights.com/image/weather/icon-weather/' + json.weather[0].icon + '.png';
|
|
|
|
|
document.getElementById('todayIcon').setAttribute('originalsrc', 'https://data.chinahighlights.com/image/weather/icon-weather/' + json.weather[0].icon + '.png');
|
|
|
|
|
document.getElementById('todayCondition').innerText = json.weather[0].main;
|
|
|
|
|
document.getElementById('todayHumidity').innerText = 'Humidity: ' + json.main.humidity + '%';
|
|
|
|
|
document.getElementById('todayWind').innerText = 'Wind: ' + Math.round(json.wind.speed * 3.6) + 'km/h';
|
|
|
|
|
@ -169,6 +170,7 @@ fetch(forecastUrl)
|
|
|
|
|
document.getElementById('forecastFahrenheit' + number).innerText =
|
|
|
|
|
Math.round(convertToF(firstDay.main.temp)) + ' ~ ' + Math.round(convertToF(lastDay.main.temp)) + '℉';
|
|
|
|
|
document.getElementById('forecastIcon' + number).src = 'https://data.chinahighlights.com/image/weather/icon-weather/' + firstDay.weather[0].icon + '.png';
|
|
|
|
|
document.getElementById('forecastIcon' + number).setAttribute('originalsrc', 'https://data.chinahighlights.com/image/weather/icon-weather/' + firstDay.weather[0].icon + '.png');
|
|
|
|
|
document.getElementById('forecastCondition' + number).innerText = firstDay.weather[0].main;
|
|
|
|
|
document.getElementById('forecastHumidity' + number).innerText = 'Humidity: ' + firstDay.main.humidity + '%';
|
|
|
|
|
document.getElementById('forecastWind' + number).innerText = 'Wind: ' + Math.round(firstDay.wind.speed * 3.6) + 'km/h';
|
|
|
|
|
|