|
3 | 3 |
|
4 | 4 | <head> |
5 | 5 | <%- include('./../partials/head'); %> |
| 6 | + <%- include ('./../../public/utils'); %> |
6 | 7 | </head> |
7 | 8 |
|
8 | 9 | <body class="container"> |
9 | 10 | <header> |
10 | 11 | <%- include('./../partials/header'); %> |
11 | 12 | </header> |
12 | | - <main> |
| 13 | + <main onload=""> |
13 | 14 | <br /> |
14 | 15 | <div> |
15 | 16 | <fieldset> |
|
27 | 28 | <div class="row"> |
28 | 29 | <div class="col-sm-6"> |
29 | 30 | <h5>Current Conditions</h5> |
30 | | - <div class="jumbotron jumbotron-fluid"> |
| 31 | + <div class="jumbotron jumbotron-fluid" style="padding:10px 5px 15px 20px;"> |
31 | 32 | <% if( typeof(error)==="undefined" || curStatus===400 ){ %> |
32 | 33 | <p style="color:gray"> Waiting for data.</p> |
33 | 34 | <% } else { %> |
|
62 | 63 | <%= curData.app_temp %> |
63 | 64 | </td> |
64 | 65 | </tr> |
65 | | - <th>Relative humidity (%): </th> |
| 66 | + <th>Relative humidity(%): </th> |
66 | 67 | <td> |
67 | 68 | <%= curData.rh %> |
68 | 69 | </td> |
|
84 | 85 | </tr> |
85 | 86 | <th>Wind Speed(m/s): </th> |
86 | 87 | <td> |
87 | | - <%= curData.wind_spd %> |
88 | | - </td> |
89 | | - </tr> |
90 | | - <th>Wind Direction: </th> |
91 | | - <td> |
92 | | - <%= curData.wind_cdir_full %> |
| 88 | + <%= curData.wind_spd %> <%= curData.wind_cdir_full %> |
93 | 89 | </td> |
94 | 90 | </tr> |
95 | 91 | <th>Snowfall(mm/hr): </th> |
|
121 | 117 |
|
122 | 118 | <% } %> |
123 | 119 | </div> |
| 120 | + <br /> |
124 | 121 | </div> |
125 | 122 |
|
126 | 123 |
|
127 | 124 |
|
128 | 125 | <div class="col-sm-6"> |
129 | 126 | <h5>Current Air Quality</h5> |
130 | | - <div class="jumbotron jumbotron-fluid"> |
| 127 | + <div class="jumbotron jumbotron-fluid" style="padding:10px 5px 15px 20px;"> |
131 | 128 | <% if( typeof(error)==="undefined" || airqStatus===400 ) { %> |
132 | 129 | <p style="color:gray"> Waiting for data.</p> |
133 | 130 | <% } else { %> |
134 | 131 | <p style="color:gray"><strong>Local hourly</strong>: <%= airqData.timestamp_local.split('T')[1] %> |
135 | | - <br /> |
| 132 | +
|
136 | 133 | |
137 | 134 | </p> |
138 | 135 | <hr /> |
139 | 136 | <table class="styled-table"> |
140 | 137 | <tr> |
141 | 138 | <th>Air Quality Index: </th> |
142 | | - <td> |
143 | | - <%= airqData.aqi %> |
144 | | - </td> |
| 139 | + <% if (airqData.aqi <= 50) { %> |
| 140 | + <td style="color:green;"> <%= airqData.aqi %> (Good)</td> |
| 141 | + <% } else if (airqData.api >= 51 && airqData.api <= 100) { %> |
| 142 | + <td style="color:yellow;"> <%= airqData.aqi %> (Moderate)</td> |
| 143 | + <% } else if (airqData.api >= 101 && airqData.api <= 150) { %> |
| 144 | + <td style="color:brown;"> <%= airqData.aqi %> (Sensitive to Alergy)</td> |
| 145 | + <% } else if (airqData.api >= 151 && airqData.api <= 200) { %> |
| 146 | + <td style="color:red;"> <%= airqData.aqi %> (Unhealthy)</td> |
| 147 | + <% } else if (airqData.api >= 201 && airqData.api <= 300) { %> |
| 148 | + <td style="color:purple;"> <%= airqData.aqi %> (Very unhealthy)</td> |
| 149 | + <% } else if (airqData.api >= 301) { %> |
| 150 | + <td style="color:rgb(50, 6, 6);"> <%= airqData.aqi %> (Hazardous)</td> |
| 151 | + <% } %> |
145 | 152 | </tr> |
146 | 153 | <tr> |
147 | 154 | <th>O3 Concentration(µg/m³): </th> |
|
190 | 197 | <div class="row"> |
191 | 198 | <div class="col-sm-12"> |
192 | 199 | <h5>Extended Forecast</h5> |
193 | | - <div class="jumbotron jumbotron-fluid"> |
| 200 | + <div class="jumbotron jumbotron-fluid" style="padding:10px 5px 15px 20px;"> |
194 | 201 | <% if( typeof(error)==="undefined" || foreStatus===400 ){ %> |
195 | 202 | <p style="color:gray"> Waiting for data.</p> |
196 | 203 | <% } else { %> |
197 | 204 | <table class="styled-table"> |
198 | 205 | <thead> |
199 | 206 | <tr class="w-35"> |
200 | | - <th>Date</th> |
201 | | - <th>Condition</th> |
202 | | - <th>Max/Min Temperature</th> |
203 | | - <th>Temperature(F)</th> |
204 | | - <th>Pressure</th> |
205 | | - <th>Humidity</th> |
206 | | - <th>Wind Gust</th> |
207 | | - <th>Wind Speed</th> |
208 | | - <th>Wind Direction</th> |
209 | | - <th>Cloud Cover</th> |
210 | | - <th>Visibility</th> |
211 | | - <th>UV Index</th> |
212 | | - <th>Sunrise/Sunset</th> |
213 | | - <th>Moonphase</th> |
| 207 | + <th style="color:black;"> Date</th> |
| 208 | + <th style="color:rgb(27, 142, 191);"> Condition</th> |
| 209 | + <th style="color:rgb(41, 27, 191);"> Max/Min Temperature(°F)</th> |
| 210 | + <th style="color:rgb(27, 119, 223);"> Temperature(°F) </th> |
| 211 | + <th style="color:rgba(20, 15, 177, 0.474);"> Pressure(㎧)</th> |
| 212 | + <th style="color:green;"> Humidity</th> |
| 213 | + <th style="color:rgb(198, 73, 15);"> Wind Speed</th> |
| 214 | + <th style="color:rgb(198, 15, 195);"> Wind Gust</th> |
| 215 | + <th style="color:rgb(15, 22, 207);"> Cloud Cover(%)</th> |
| 216 | + <th style="color:rgb(30, 140, 224);"> Visibility</th> |
| 217 | + <th style="color:rgb(78, 122, 80);"> UV Index</th> |
| 218 | + <th style="color:rgb(165, 58, 58);"> Sunrise/Sunset</th> |
| 219 | + <th style="color:rgb(32, 24, 24);"> Moonphase</th> |
214 | 220 | </tr> |
215 | 221 | </thead> |
| 222 | + |
216 | 223 | <% let forecast=foreData.data; %> |
217 | 224 | <% for (let i=0; i < forecast.length; i++) { %> |
218 | 225 | <tbody> |
219 | 226 | <tr class="active-row"> |
220 | | - <td> |
| 227 | + <td style="color:black;"> |
221 | 228 | <%= forecast[i].datetime %> |
222 | 229 | </td> |
223 | | - <td> |
| 230 | + <td style="color:rgb(27, 142, 191);"> |
224 | 231 | <%= forecast[i].weather.description %> |
225 | 232 | </td> |
226 | | - <td> |
227 | | - <%= forecast[i].app_max_temp %> , <%= forecast[i].app_min_temp %> |
| 233 | + <td style="color:rgb(41, 27, 191);"> |
| 234 | + <%= forecast[i].app_max_temp %>/<%= forecast[i].app_min_temp %> |
228 | 235 | </td> |
229 | | - <td> |
| 236 | + <td style="color:rgb(27, 119, 223);"> |
230 | 237 | <%= forecast[i].temp %> |
231 | 238 | </td> |
232 | | - <td> |
233 | | - <%= forecast[i].slp %> |
| 239 | + <td style="color:rgb(15, 22, 207);"> |
| 240 | + <%= forecast[i].pres %> |
234 | 241 | </td> |
235 | | - <td> |
| 242 | + <td style="color:green;"> |
236 | 243 | <%= forecast[i].rh %> |
237 | 244 | </td> |
238 | | - <td> |
239 | | - <%= forecast[i].windgust %> |
240 | | - </td> |
241 | | - <td> |
242 | | - <%= forecast[i].wind_spd %> |
243 | | - </td> |
244 | | - <td> |
| 245 | + <td style="color:rgb(198, 73, 15);"> |
245 | 246 | <%= forecast[i].wind_gust_spd %> |
246 | 247 | </td> |
247 | | - <td> |
248 | | - <%= forecast[i].wind_cdir_full %> |
| 248 | + <td style="color:rgb(198, 15, 195);"> |
| 249 | + <%= forecast[i].wind_gust_spd %> <%= forecast[i].wind_cdir %> |
249 | 250 | </td> |
250 | | - <td> |
| 251 | + <td style="color:rgb(15, 22, 207);"> |
251 | 252 | <%= forecast[i].clouds %> |
252 | 253 | </td> |
253 | | - <td> |
| 254 | + <td style="color:rgb(30, 140, 224);"> |
254 | 255 | <%= forecast[i].vis %> |
255 | 256 | </td> |
256 | | - <td> |
| 257 | + <td style="color:rgb(78, 122, 80);"> |
257 | 258 | <%= forecast[i].uv %> |
258 | 259 | </td> |
259 | | - <td> |
260 | | - <%= forecast[i].sunrise_ts %> , <%= forecast[i].sunset_ts %> |
| 260 | + <td style="color:rgb(165, 58, 58);"> |
| 261 | + <%= unixTsToLocalTime(forecast[i].sunrise_ts) %> / <%= unixTsToLocalTime(forecast[i].sunset_ts) %> |
261 | 262 | </td> |
262 | | - <td> |
| 263 | + <td style="color:rgb(32, 24, 24);"> |
263 | 264 | <%= forecast[i].moon_phase_lunation %> |
264 | 265 | </td> |
265 | 266 | </tr> |
|
274 | 275 | <% let longi, lati = "" %> |
275 | 276 | <script> |
276 | 277 | let longi, lati = ""; |
| 278 | +
|
| 279 | +
|
| 280 | +
|
277 | 281 | function getGeoLocation() { |
278 | 282 | |
279 | 283 | // Store the element where the page displays the result |
|
0 commit comments