JupitersGirthyHug commited on
Commit
b4b06e3
·
verified ·
1 Parent(s): 241556e

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +584 -376
index.html CHANGED
@@ -1,393 +1,601 @@
1
  <!DOCTYPE html>
2
  <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Weather App - Tuscaloosa, AL 35401</title>
7
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
- <style>
9
- * {
10
- margin: 0;
11
- padding: 0;
12
- box-sizing: border-box;
13
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
14
- }
15
-
16
- body {
17
- background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
18
- min-height: 100vh;
19
- display: flex;
20
- flex-direction: column;
21
- align-items: center;
22
- padding: 20px;
23
- color: #333;
24
- }
25
-
26
- .header {
27
- width: 100%;
28
- display: flex;
29
- justify-content: space-between;
30
- align-items: center;
31
- padding: 15px 0;
32
- max-width: 800px;
33
- }
34
-
35
- .header h1 {
36
- color: white;
37
- font-size: 2rem;
38
- font-weight: 600;
39
- text-shadow: 0 2px 4px rgba(0,0,0,0.2);
40
- }
41
-
42
- .built-with {
43
- color: white;
44
- text-decoration: none;
45
- font-size: 0.9rem;
46
- opacity: 0.8;
47
- transition: opacity 0.3s;
48
- }
49
-
50
- .built-with:hover {
51
- opacity: 1;
52
- }
53
-
54
- .weather-card {
55
- background: rgba(255, 255, 255, 0.95);
56
- backdrop-filter: blur(10px);
57
- border-radius: 20px;
58
- padding: 30px;
59
- box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
60
- width: 100%;
61
- max-width: 800px;
62
- margin-top: 20px;
63
- transition: transform 0.3s ease;
64
- }
65
-
66
- .weather-card:hover {
67
- transform: translateY(-5px);
68
- }
69
-
70
- .location {
71
- display: flex;
72
- align-items: center;
73
- margin-bottom: 20px;
74
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
75
- padding-bottom: 15px;
76
- }
77
-
78
- .location i {
79
- color: #74b9ff;
80
- font-size: 1.5rem;
81
- margin-right: 10px;
82
- }
83
-
84
- .location h2 {
85
- font-size: 1.8rem;
86
- font-weight: 600;
87
- color: #2d3436;
88
- }
89
-
90
- .current-weather {
91
- display: grid;
92
- grid-template-columns: 1fr 1fr;
93
- gap: 30px;
94
- margin-bottom: 30px;
95
- }
96
-
97
- .temperature {
98
- display: flex;
99
- align-items: center;
100
- }
101
-
102
- .temp-value {
103
- font-size: 4rem;
104
- font-weight: 700;
105
- color: #2d3436;
106
- line-height: 1;
107
- }
108
-
109
- .temp-unit {
110
- font-size: 2rem;
111
- color: #636e72;
112
- margin-left: 5px;
113
- }
114
-
115
- .weather-icon {
116
- display: flex;
117
- flex-direction: column;
118
- align-items: center;
119
- justify-content: center;
120
- }
121
-
122
- .weather-icon i {
123
- font-size: 5rem;
124
- color: #fdcb6e;
125
- margin-bottom: 10px;
126
- }
127
-
128
- .weather-description {
129
- font-size: 1.3rem;
130
- color: #636e72;
131
- text-align: center;
132
- }
133
-
134
- .weather-details {
135
- display: grid;
136
- grid-template-columns: repeat(2, 1fr);
137
- gap: 20px;
138
- margin-bottom: 30px;
139
- }
140
-
141
- .detail {
142
- display: flex;
143
- align-items: center;
144
- background: rgba(116, 185, 255, 0.1);
145
- padding: 15px;
146
- border-radius: 12px;
147
- }
148
-
149
- .detail i {
150
- font-size: 1.5rem;
151
- color: #74b9ff;
152
- margin-right: 15px;
153
- width: 30px;
154
- text-align: center;
155
- }
156
-
157
- .detail-info h3 {
158
- font-size: 0.9rem;
159
- color: #636e72;
160
- margin-bottom: 5px;
161
- }
162
-
163
- .detail-info p {
164
- font-size: 1.2rem;
165
- font-weight: 600;
166
- color: #2d3436;
167
- }
168
-
169
- .forecast {
170
- margin-top: 20px;
171
- }
172
-
173
- .forecast h3 {
174
- font-size: 1.3rem;
175
- margin-bottom: 15px;
176
- color: #2d3436;
177
- padding-bottom: 10px;
178
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
179
- }
180
-
181
- .forecast-days {
182
- display: grid;
183
- grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
184
- gap: 15px;
185
- }
186
-
187
- .forecast-day {
188
- background: rgba(116, 185, 255, 0.1);
189
- padding: 15px;
190
- border-radius: 12px;
191
- text-align: center;
192
- }
193
-
194
- .forecast-day p {
195
- margin-bottom: 10px;
196
- }
197
-
198
- .day-name {
199
- font-weight: 600;
200
- color: #2d3436;
201
- }
202
-
203
- .day-temp {
204
- font-size: 1.2rem;
205
- font-weight: 700;
206
- color: #2d3436;
207
- }
208
-
209
- .day-icon {
210
- color: #fdcb6e;
211
- font-size: 1.5rem;
212
- margin: 5px 0;
213
- }
214
-
215
- .loading {
216
- text-align: center;
217
- padding: 30px;
218
- font-size: 1.2rem;
219
- color: #636e72;
220
- }
221
-
222
- .error {
223
- text-align: center;
224
- padding: 30px;
225
- font-size: 1.2rem;
226
- color: #e74c3c;
227
- background: rgba(231, 76, 60, 0.1);
228
- border-radius: 12px;
229
- }
230
-
231
- @media (max-width: 768px) {
232
- .current-weather {
233
- grid-template-columns: 1fr;
234
- gap: 20px;
235
- }
236
-
237
- .weather-details {
238
- grid-template-columns: 1fr;
239
- }
240
-
241
- .forecast-days {
242
- grid-template-columns: repeat(2, 1fr);
243
- }
244
-
245
- .temp-value {
246
- font-size: 3rem;
247
- }
248
-
249
- .weather-icon i {
250
- font-size: 4rem;
251
- }
252
- }
253
 
254
- @media (max-width: 480px) {
255
- .header {
256
- flex-direction: column;
257
- gap: 10px;
258
- text-align: center;
259
- }
260
-
261
- .forecast-days {
262
- grid-template-columns: 1fr;
263
- }
264
-
265
- .weather-card {
266
- padding: 20px;
267
- }
268
- }
269
- </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  </head>
 
271
  <body>
272
- <div class="header">
273
- <h1>Weather Forecast</h1>
274
- <a href="https://huggingface.co/spaces/akhaliq/anycoder" class="built-with">Built with anycoder</a>
 
 
 
 
 
 
 
 
 
275
  </div>
276
 
277
- <div class="weather-card">
278
- <div class="location">
279
- <i class="fas fa-map-marker-alt"></i>
280
- <h2>Tuscaloosa, AL 35401, US</h2>
281
- </div>
282
 
283
- <div class="current-weather">
284
- <div class="temperature">
285
- <span class="temp-value" id="current-temp">78</span>
286
- <span class="temp-unit">°F</span>
287
- </div>
288
- <div class="weather-icon">
289
- <i class="fas fa-sun" id="weather-icon"></i>
290
- <div class="weather-description" id="weather-desc">Sunny</div>
291
- </div>
292
  </div>
293
-
294
- <div class="weather-details">
295
- <div class="detail">
296
- <i class="fas fa-wind"></i>
297
- <div class="detail-info">
298
- <h3>Wind Speed</h3>
299
- <p id="wind-speed">5 mph</p>
300
- </div>
301
- </div>
302
- <div class="detail">
303
- <i class="fas fa-tint"></i>
304
- <div class="detail-info">
305
- <h3>Humidity</h3>
306
- <p id="humidity">65%</p>
307
- </div>
308
- </div>
309
- <div class="detail">
310
- <i class="fas fa-temperature-low"></i>
311
- <div class="detail-info">
312
- <h3>Feels Like</h3>
313
- <p id="feels-like">80°F</p>
314
- </div>
315
- </div>
316
- <div class="detail">
317
- <i class="fas fa-compress-arrows-alt"></i>
318
- <div class="detail-info">
319
- <h3>Pressure</h3>
320
- <p id="pressure">1012 hPa</p>
321
- </div>
322
- </div>
323
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
 
325
- <div class="forecast">
326
- <h3>5-Day Forecast</h3>
327
- <div class="forecast-days" id="forecast-container">
328
- <!-- Forecast days will be populated by JavaScript -->
329
- </div>
330
  </div>
331
- </div>
332
 
333
- <script>
334
- document.addEventListener('DOMContentLoaded', function() {
335
- // Since we can't actually call a weather API without a key,
336
- // we'll simulate weather data for Tuscaloosa, AL 35401
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
 
338
- // Simulate a brief loading delay
339
- setTimeout(() => {
340
- // Current weather data
341
- const currentWeather = {
342
- temperature: 78,
343
- description: "Sunny",
344
- windSpeed: "5 mph",
345
- humidity: "65%",
346
- feelsLike: "80°F",
347
- pressure: "1012 hPa"
348
- };
349
-
350
- // Forecast data
351
- const forecastData = [
352
- { day: "Mon", temp: 82, icon: "fa-sun" },
353
- { day: "Tue", temp: 79, icon: "fa-cloud-sun" },
354
- { day: "Wed", temp: 75, icon: "fa-cloud" },
355
- { day: "Thu", temp: 77, icon: "fa-cloud-showers-heavy" },
356
- { day: "Fri", temp: 81, icon: "fa-sun" }
357
- ];
358
-
359
- // Update current weather
360
- document.getElementById('current-temp').textContent = currentWeather.temperature;
361
- document.getElementById('weather-desc').textContent = currentWeather.description;
362
- document.getElementById('wind-speed').textContent = currentWeather.windSpeed;
363
- document.getElementById('humidity').textContent = currentWeather.humidity;
364
- document.getElementById('feels-like').textContent = currentWeather.feelsLike;
365
- document.getElementById('pressure').textContent = currentWeather.pressure;
366
-
367
- // Update weather icon based on description
368
- const weatherIcon = document.getElementById('weather-icon');
369
- if (currentWeather.description.toLowerCase().includes("sunny")) {
370
- weatherIcon.className = "fas fa-sun";
371
- } else if (currentWeather.description.toLowerCase().includes("cloud")) {
372
- weatherIcon.className = "fas fa-cloud";
373
- } else if (currentWeather.description.toLowerCase().includes("rain")) {
374
- weatherIcon.className = "fas fa-cloud-rain";
375
- }
376
-
377
- // Populate forecast
378
- const forecastContainer = document.getElementById('forecast-container');
379
- forecastData.forEach(day => {
380
- const dayElement = document.createElement('div');
381
- dayElement.className = 'forecast-day';
382
- dayElement.innerHTML = `
383
- <p class="day-name">${day.day}</p>
384
- <i class="fas ${day.icon} day-icon"></i>
385
- <p class="day-temp">${day.temp}°F</p>
386
- `;
387
- forecastContainer.appendChild(dayElement);
388
- });
389
- }, 800); // Simulate API call delay
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
390
  });
391
- </script>
 
 
 
 
 
 
 
 
 
 
 
392
  </body>
 
393
  </html>
 
1
  <!DOCTYPE html>
2
  <html lang="en">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Weather App - Tuscaloosa, AL 35401</title>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ * {
11
+ margin: 0;
12
+ padding: 0;
13
+ box-sizing: border-box;
14
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
15
+ }
16
+
17
+ body {
18
+ background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
19
+ min-height: 100vh;
20
+ display: flex;
21
+ flex-direction: column;
22
+ align-items: center;
23
+ padding: 20px;
24
+ color: #333;
25
+ }
26
+
27
+ .header {
28
+ width: 100%;
29
+ display: flex;
30
+ justify-content: space-between;
31
+ align-items: center;
32
+ padding: 15px 0;
33
+ max-width: 800px;
34
+ }
35
+
36
+ .header h1 {
37
+ color: white;
38
+ font-size: 2rem;
39
+ font-weight: 600;
40
+ text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
41
+ }
42
+
43
+ .built-with {
44
+ color: white;
45
+ text-decoration: none;
46
+ font-size: 0.9rem;
47
+ opacity: 0.8;
48
+ transition: opacity 0.3s;
49
+ }
50
+
51
+ .built-with:hover {
52
+ opacity: 1;
53
+ }
54
+
55
+ .weather-card {
56
+ background: rgba(255, 255, 255, 0.95);
57
+ backdrop-filter: blur(10px);
58
+ border-radius: 20px;
59
+ padding: 30px;
60
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
61
+ width: 100%;
62
+ max-width: 800px;
63
+ margin-top: 20px;
64
+ transition: transform 0.3s ease;
65
+ }
66
+
67
+ .weather-card:hover {
68
+ transform: translateY(-5px);
69
+ }
70
+
71
+ .location {
72
+ display: flex;
73
+ align-items: center;
74
+ margin-bottom: 20px;
75
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
76
+ padding-bottom: 15px;
77
+ }
78
+
79
+ .location i {
80
+ color: #74b9ff;
81
+ font-size: 1.5rem;
82
+ margin-right: 10px;
83
+ }
84
+
85
+ .location h2 {
86
+ font-size: 1.8rem;
87
+ font-weight: 600;
88
+ color: #2d3436;
89
+ }
90
+
91
+ .last-updated {
92
+ font-size: 0.8rem;
93
+ color: #636e72;
94
+ margin-top: 5px;
95
+ margin-left: 35px;
96
+ }
97
+
98
+ .current-weather {
99
+ display: grid;
100
+ grid-template-columns: 1fr 1fr;
101
+ gap: 30px;
102
+ margin-bottom: 30px;
103
+ }
104
+
105
+ .temperature {
106
+ display: flex;
107
+ align-items: center;
108
+ }
109
+
110
+ .temp-value {
111
+ font-size: 4rem;
112
+ font-weight: 700;
113
+ color: #2d3436;
114
+ line-height: 1;
115
+ }
116
+
117
+ .temp-unit {
118
+ font-size: 2rem;
119
+ color: #636e72;
120
+ margin-left: 5px;
121
+ }
122
+
123
+ .weather-icon {
124
+ display: flex;
125
+ flex-direction: column;
126
+ align-items: center;
127
+ justify-content: center;
128
+ }
129
+
130
+ .weather-icon i {
131
+ font-size: 5rem;
132
+ color: #fdcb6e;
133
+ margin-bottom: 10px;
134
+ }
135
+
136
+ .weather-description {
137
+ font-size: 1.3rem;
138
+ color: #636e72;
139
+ text-align: center;
140
+ text-transform: capitalize;
141
+ }
142
+
143
+ .weather-details {
144
+ display: grid;
145
+ grid-template-columns: repeat(2, 1fr);
146
+ gap: 20px;
147
+ margin-bottom: 30px;
148
+ }
149
+
150
+ .detail {
151
+ display: flex;
152
+ align-items: center;
153
+ background: rgba(116, 185, 255, 0.1);
154
+ padding: 15px;
155
+ border-radius: 12px;
156
+ }
157
+
158
+ .detail i {
159
+ font-size: 1.5rem;
160
+ color: #74b9ff;
161
+ margin-right: 15px;
162
+ width: 30px;
163
+ text-align: center;
164
+ }
165
+
166
+ .detail-info h3 {
167
+ font-size: 0.9rem;
168
+ color: #636e72;
169
+ margin-bottom: 5px;
170
+ }
171
+
172
+ .detail-info p {
173
+ font-size: 1.2rem;
174
+ font-weight: 600;
175
+ color: #2d3436;
176
+ }
177
+
178
+ .forecast {
179
+ margin-top: 20px;
180
+ }
181
+
182
+ .forecast h3 {
183
+ font-size: 1.3rem;
184
+ margin-bottom: 15px;
185
+ color: #2d3436;
186
+ padding-bottom: 10px;
187
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
188
+ }
189
+
190
+ .forecast-days {
191
+ display: grid;
192
+ grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
193
+ gap: 15px;
194
+ }
195
+
196
+ .forecast-day {
197
+ background: rgba(116, 185, 255, 0.1);
198
+ padding: 15px;
199
+ border-radius: 12px;
200
+ text-align: center;
201
+ }
202
+
203
+ .forecast-day p {
204
+ margin-bottom: 10px;
205
+ }
206
+
207
+ .day-name {
208
+ font-weight: 600;
209
+ color: #2d3436;
210
+ }
211
+
212
+ .day-temp {
213
+ font-size: 1.2rem;
214
+ font-weight: 700;
215
+ color: #2d3436;
216
+ }
217
+
218
+ .day-icon {
219
+ color: #fdcb6e;
220
+ font-size: 1.5rem;
221
+ margin: 5px 0;
222
+ }
223
+
224
+ .loading {
225
+ text-align: center;
226
+ padding: 30px;
227
+ font-size: 1.2rem;
228
+ color: #636e72;
229
+ }
230
+
231
+ .error {
232
+ text-align: center;
233
+ padding: 30px;
234
+ font-size: 1.2rem;
235
+ color: #e74c3c;
236
+ background: rgba(231, 76, 60, 0.1);
237
+ border-radius: 12px;
238
+ }
239
+
240
+ .refresh-btn {
241
+ background: #74b9ff;
242
+ color: white;
243
+ border: none;
244
+ padding: 10px 20px;
245
+ border-radius: 50px;
246
+ font-weight: 600;
247
+ cursor: pointer;
248
+ transition: all 0.3s ease;
249
+ display: flex;
250
+ align-items: center;
251
+ gap: 8px;
252
+ margin-top: 15px;
253
+ }
254
+
255
+ .refresh-btn:hover {
256
+ background: #0984e3;
257
+ transform: translateY(-2px);
258
+ }
259
+
260
+ @media (max-width: 768px) {
261
+ .current-weather {
262
+ grid-template-columns: 1fr;
263
+ gap: 20px;
264
+ }
265
+
266
+ .weather-details {
267
+ grid-template-columns: 1fr;
268
+ }
269
+
270
+ .forecast-days {
271
+ grid-template-columns: repeat(2, 1fr);
272
+ }
273
+
274
+ .temp-value {
275
+ font-size: 3rem;
276
+ }
277
+
278
+ .weather-icon i {
279
+ font-size: 4rem;
280
+ }
281
+ }
282
+
283
+ @media (max-width: 480px) {
284
+ .header {
285
+ flex-direction: column;
286
+ gap: 10px;
287
+ text-align: center;
288
+ }
289
+
290
+ .forecast-days {
291
+ grid-template-columns: 1fr;
292
+ }
293
+
294
+ .weather-card {
295
+ padding: 20px;
296
+ }
297
+ }
298
+ </style>
299
  </head>
300
+
301
  <body>
302
+ <div class="header">
303
+ <h1>Weather Forecast</h1>
304
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" class="built-with">Built with anycoder</a>
305
+ </div>
306
+
307
+ <div class="weather-card">
308
+ <div class="location">
309
+ <i class="fas fa-map-marker-alt"></i>
310
+ <div>
311
+ <h2 id="location-name">Tuscaloosa, AL 35401, US</h2>
312
+ <div class="last-updated" id="last-updated"></div>
313
+ </div>
314
  </div>
315
 
316
+ <div id="loading" class="loading">
317
+ <i class="fas fa-spinner fa-spin"></i> Loading weather data...
318
+ </div>
 
 
319
 
320
+ <div id="weather-content" style="display: none;">
321
+ <div class="current-weather">
322
+ <div class="temperature">
323
+ <span class="temp-value" id="current-temp">--</span>
324
+ <span class="temp-unit">°F</span>
 
 
 
 
325
  </div>
326
+ <div class="weather-icon">
327
+ <i class="fas fa-sun" id="weather-icon"></i>
328
+ <div class="weather-description" id="weather-desc">--</div>
329
+ </div>
330
+ </div>
331
+
332
+ <div class="weather-details">
333
+ <div class="detail">
334
+ <i class="fas fa-wind"></i>
335
+ <div class="detail-info">
336
+ <h3>Wind Speed</h3>
337
+ <p id="wind-speed">-- mph</p>
338
+ </div>
339
+ </div>
340
+ <div class="detail">
341
+ <i class="fas fa-tint"></i>
342
+ <div class="detail-info">
343
+ <h3>Humidity</h3>
344
+ <p id="humidity">--%</p>
345
+ </div>
 
 
 
 
 
 
 
 
 
 
346
  </div>
347
+ <div class="detail">
348
+ <i class="fas fa-temperature-low"></i>
349
+ <div class="detail-info">
350
+ <h3>Feels Like</h3>
351
+ <p id="feels-like">--°F</p>
352
+ </div>
353
+ </div>
354
+ <div class="detail">
355
+ <i class="fas fa-compress-arrows-alt"></i>
356
+ <div class="detail-info">
357
+ <h3>Pressure</h3>
358
+ <p id="pressure">-- hPa</p>
359
+ </div>
360
+ </div>
361
+ </div>
362
 
363
+ <div class="forecast">
364
+ <h3>5-Day Forecast</h3>
365
+ <div class="forecast-days" id="forecast-container">
366
+ <!-- Forecast days will be populated by JavaScript -->
 
367
  </div>
368
+ </div>
369
 
370
+ <button class="refresh-btn" id="refresh-btn">
371
+ <i class="fas fa-sync-alt"></i> Refresh Data
372
+ </button>
373
+ </div>
374
+ </div>
375
+
376
+ <script>
377
+ document.addEventListener('DOMContentLoaded', function() {
378
+ const apiKey = '8a7d3e6f2b9d4c5a8e1f0a3b4c5d6e7f'; // Example API key (you'll need to replace with a real one)
379
+ const zipCode = '35401';
380
+ const countryCode = 'US';
381
+
382
+ const loadingElement = document.getElementById('loading');
383
+ const weatherContent = document.getElementById('weather-content');
384
+ const refreshBtn = document.getElementById('refresh-btn');
385
+
386
+ // Function to fetch weather data
387
+ async function fetchWeatherData() {
388
+ try {
389
+ loadingElement.style.display = 'block';
390
+ weatherContent.style.display = 'none';
391
+
392
+ // Using OpenWeatherMap API with ZIP code
393
+ const response = await fetch(`https://api.openweathermap.org/data/2.5/weather?zip=${zipCode},${countryCode}&appid=${apiKey}&units=imperial`);
394
+
395
+ if (!response.ok) {
396
+ throw new Error('Failed to fetch weather data');
397
+ }
398
+
399
+ const data = await response.json();
400
+
401
+ // Update current weather
402
+ document.getElementById('current-temp').textContent = Math.round(data.main.temp);
403
+ document.getElementById('weather-desc').textContent = data.weather[0].description;
404
+ document.getElementById('wind-speed').textContent = `${Math.round(data.wind.speed)} mph`;
405
+ document.getElementById('humidity').textContent = `${data.main.humidity}%`;
406
+ document.getElementById('feels-like').textContent = `${Math.round(data.main.feels_like)}°F`;
407
+ document.getElementById('pressure').textContent = `${data.main.pressure} hPa`;
408
+
409
+ // Update location name
410
+ document.getElementById('location-name').textContent = `${data.name}, ${data.sys.country}`;
411
+
412
+ // Update weather icon based on weather condition
413
+ const weatherIcon = document.getElementById('weather-icon');
414
+ const weatherId = data.weather[0].id;
415
+
416
+ if (weatherId >= 200 && weatherId < 300) {
417
+ // Thunderstorm
418
+ weatherIcon.className = "fas fa-bolt";
419
+ weatherIcon.style.color = "#fdcb6e";
420
+ } else if (weatherId >= 300 && weatherId < 500) {
421
+ // Drizzle
422
+ weatherIcon.className = "fas fa-cloud-rain";
423
+ weatherIcon.style.color = "#74b9ff";
424
+ } else if (weatherId >= 500 && weatherId < 600) {
425
+ // Rain
426
+ weatherIcon.className = "fas fa-cloud-showers-heavy";
427
+ weatherIcon.style.color = "#74b9ff";
428
+ } else if (weatherId >= 600 && weatherId < 700) {
429
+ // Snow
430
+ weatherIcon.className = "fas fa-snowflake";
431
+ weatherIcon.style.color = "#dfe6e9";
432
+ } else if (weatherId >= 700 && weatherId < 800) {
433
+ // Atmosphere (fog, mist, etc.)
434
+ weatherIcon.className = "fas fa-smog";
435
+ weatherIcon.style.color = "#b2bec3";
436
+ } else if (weatherId === 800) {
437
+ // Clear
438
+ weatherIcon.className = "fas fa-sun";
439
+ weatherIcon.style.color = "#fdcb6e";
440
+ } else if (weatherId > 800) {
441
+ // Clouds
442
+ weatherIcon.className = "fas fa-cloud";
443
+ weatherIcon.style.color = "#b2bec3";
444
+ }
445
+
446
+ // Fetch 5-day forecast
447
+ await fetchForecastData(data.coord.lat, data.coord.lon);
448
+
449
+ // Update last updated time
450
+ const now = new Date();
451
+ document.getElementById('last-updated').textContent = `Last updated: ${now.toLocaleTimeString()}`;
452
+
453
+ // Show content and hide loading
454
+ loadingElement.style.display = 'none';
455
+ weatherContent.style.display = 'block';
456
+
457
+ } catch (error) {
458
+ console.error('Error fetching weather data:', error);
459
+ loadingElement.innerHTML = `<div class="error"><i class="fas fa-exclamation-triangle"></i> Failed to load weather data. Please try again later.</div>`;
460
+
461
+ // Show error message and retry button
462
+ const retryBtn = document.createElement('button');
463
+ retryBtn.className = 'refresh-btn';
464
+ retryBtn.innerHTML = '<i class="fas fa-redo"></i> Try Again';
465
+ retryBtn.addEventListener('click', fetchWeatherData);
466
+ loadingElement.appendChild(retryBtn);
467
+ }
468
+ }
469
+
470
+ // Function to fetch forecast data
471
+ async function fetchForecastData(lat, lon) {
472
+ try {
473
+ const response = await fetch(`https://api.openweathermap.org/data/2.5/forecast?lat=${lat}&lon=${lon}&appid=${apiKey}&units=imperial`);
474
+
475
+ if (!response.ok) {
476
+ throw new Error('Failed to fetch forecast data');
477
+ }
478
+
479
+ const data = await response.json();
480
+
481
+ // Process forecast data to get daily values
482
+ const dailyForecasts = [];
483
+ const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
484
+
485
+ // Group forecast by day and find min/max temps
486
+ const dailyData = {};
487
+
488
+ data.list.forEach(item => {
489
+ const date = new Date(item.dt * 1000);
490
+ const dayKey = date.toDateString();
491
+
492
+ if (!dailyData[dayKey]) {
493
+ dailyData[dayKey] = {
494
+ minTemp: item.main.temp,
495
+ maxTemp: item.main.temp,
496
+ description: item.weather[0].description,
497
+ icon: item.weather[0].id
498
+ };
499
+ } else {
500
+ dailyData[dayKey].minTemp = Math.min(dailyData[dayKey].minTemp, item.main.temp);
501
+ dailyData[dayKey].maxTemp = Math.max(dailyData[dayKey].maxTemp, item.main.temp);
502
+ }
503
+ });
504
+
505
+ // Convert to array and limit to 5 days
506
+ let dayCount = 0;
507
+ for (const dayKey in dailyData) {
508
+ if (dayCount >= 5) break;
509
 
510
+ const date = new Date(dayKey);
511
+ const dayName = daysOfWeek[date.getDay()];
512
+
513
+ // Get appropriate icon based on weather condition
514
+ let iconClass = "fas fa-sun";
515
+ const weatherId = dailyData[dayKey].icon;
516
+
517
+ if (weatherId >= 200 && weatherId < 300) {
518
+ iconClass = "fas fa-bolt";
519
+ } else if (weatherId >= 300 && weatherId < 500) {
520
+ iconClass = "fas fa-cloud-rain";
521
+ } else if (weatherId >= 500 && weatherId < 600) {
522
+ iconClass = "fas fa-cloud-showers-heavy";
523
+ } else if (weatherId >= 600 && weatherId < 700) {
524
+ iconClass = "fas fa-snowflake";
525
+ } else if (weatherId >= 700 && weatherId < 800) {
526
+ iconClass = "fas fa-smog";
527
+ } else if (weatherId === 800) {
528
+ iconClass = "fas fa-sun";
529
+ } else if (weatherId > 800) {
530
+ iconClass = "fas fa-cloud";
531
+ }
532
+
533
+ dailyForecasts.push({
534
+ day: dayName,
535
+ temp: Math.round(dailyData[dayKey].maxTemp),
536
+ icon: iconClass
537
+ });
538
+
539
+ dayCount++;
540
+ }
541
+
542
+ // Populate forecast
543
+ const forecastContainer = document.getElementById('forecast-container');
544
+ forecastContainer.innerHTML = '';
545
+
546
+ dailyForecasts.forEach(day => {
547
+ const dayElement = document.createElement('div');
548
+ dayElement.className = 'forecast-day';
549
+ dayElement.innerHTML = `
550
+ <p class="day-name">${day.day}</p>
551
+ <i class="${day.icon} day-icon"></i>
552
+ <p class="day-temp">${day.temp}°F</p>
553
+ `;
554
+ forecastContainer.appendChild(dayElement);
555
+ });
556
+
557
+ } catch (error) {
558
+ console.error('Error fetching forecast data:', error);
559
+ // If forecast fails, show static forecast
560
+ showStaticForecast();
561
+ }
562
+ }
563
+
564
+ // Function to show static forecast as fallback
565
+ function showStaticForecast() {
566
+ const forecastData = [
567
+ { day: "Mon", temp: 82, icon: "fas fa-sun" },
568
+ { day: "Tue", temp: 79, icon: "fas fa-cloud-sun" },
569
+ { day: "Wed", temp: 75, icon: "fas fa-cloud" },
570
+ { day: "Thu", temp: 77, icon: "fas fa-cloud-showers-heavy" },
571
+ { day: "Fri", temp: 81, icon: "fas fa-sun" }
572
+ ];
573
+
574
+ const forecastContainer = document.getElementById('forecast-container');
575
+ forecastContainer.innerHTML = '';
576
+
577
+ forecastData.forEach(day => {
578
+ const dayElement = document.createElement('div');
579
+ dayElement.className = 'forecast-day';
580
+ dayElement.innerHTML = `
581
+ <p class="day-name">${day.day}</p>
582
+ <i class="${day.icon} day-icon"></i>
583
+ <p class="day-temp">${day.temp}°F</p>
584
+ `;
585
+ forecastContainer.appendChild(dayElement);
586
  });
587
+ }
588
+
589
+ // Add event listener to refresh button
590
+ refreshBtn.addEventListener('click', fetchWeatherData);
591
+
592
+ // Fetch weather data on page load
593
+ fetchWeatherData();
594
+
595
+ // Auto-refresh every 10 minutes
596
+ setInterval(fetchWeatherData, 10 * 60 * 1000);
597
+ });
598
+ </script>
599
  </body>
600
+
601
  </html>