-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathui.js
More file actions
24 lines (23 loc) · 1.03 KB
/
ui.js
File metadata and controls
24 lines (23 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class UI {
constructor() {
this.location = document.getElementById('w-location');
this.desc = document.getElementById('w-desc');
this.string = document.getElementById('w-string');
this.details = document.getElementById('w-details');
this.icon = document.getElementById('w-icon');
this.humidity = document.getElementById('w-humidity');
this.feelsLike = document.getElementById('w-feels-like');
this.wind = document.getElementById('w-wind');
}
paint(weather) {
this.location.textContent = weather.name;
this.desc.textContent = weather.weather[0].main;
this.string.textContent = `${weather.main.temp} °C`;
this.weathericon = weather.weather[0].icon;
let address = "https://openweathermap.org/img/wn/" + this.weathericon + ".png";
this.icon.setAttribute('src', address);
this.humidity.textContent = `Relative Humidity: ${weather.main.humidity} %`;
this.feelsLike.textContent = `Feels Like: ${weather.main.feels_like} °C`;
this.wind.textContent = `Wind: ${weather.wind.speed} m/s`;
}
}