-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.js
31 lines (24 loc) · 1.44 KB
/
ui.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class UI {
displayData(response) {
$('#changeModal').modal('hide');
const weatherLocation = document.getElementById("w-location");
const weatherStatus = document.getElementById("w-status");
const weatherString = document.getElementById("w-string");
const weatherIcon = document.getElementById("w-icon");
const weatherHumidity = document.getElementById("w-humidity");
const weatherVisibility = document.getElementById("w-visibility");
const weatherFeelslike = document.getElementById("w-feels-like");
const weatherWind = document.getElementById("w-wind");
weatherLocation.innerText = response.name + ' , ' + response.sys.country;
weatherStatus.innerText = `${response.weather[0].description}`;
weatherString.innerHTML = `${response.main.temp}° C <br> <span class="lead">(Max: ${response.main.temp_max}° C, Min: ${response.main.temp_min}° C)</span>`;
weatherIcon.src = `http://openweathermap.org/img/wn/${response.weather[0].icon}@2x.png`;
weatherHumidity.innerText = `Relative Humidity: ${response.main.humidity} %`
weatherVisibility.innerText = `Visibility : ${response.visibility} m `
weatherFeelslike.innerHTML = `Feels Like: ${response.main.feels_like}° C`
weatherWind.innerHTML = `Wind Info: ${response.wind.deg}° , ${response.wind.speed} m/s`
}
showError(error) {
alert(error);
}
}