-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex-gov.html
More file actions
88 lines (85 loc) · 5.14 KB
/
Copy pathindex-gov.html
File metadata and controls
88 lines (85 loc) · 5.14 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>National Weather Service (.gov) Widget Demo</title>
<style>
/* Modern Reset & Basic Styling */
body { margin: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f4f9; color: #333; display: flex; flex-direction: column; min-height: 100vh; }
/* Navbar Styles */
nav { background-color: #2c3e50; color: white; padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
nav h1 { margin: 0; font-size: 1.5rem; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: #ecf0f1; text-decoration: none; }
/* Main Content */
main { flex-grow: 1; padding: 2rem; max-width: 800px; margin: 0 auto; }
/* Footer Styles */
footer { background-color: #34495e; color: white; padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
/* Weather Widget CSS */
.weather-widget-container { display: flex; align-items: center; background: rgba(255, 255, 255, 0.1); padding: 0.5rem 1rem; border-radius: 8px; font-size: 0.9rem; position: relative; }
.weather-widget-container:hover { background: rgba(255, 255, 255, 0.2); }
.weather-icon { font-size: 1.2rem; margin-right: 0.5rem; display: flex; align-items: center; }
.weather-temp { font-weight: bold; }
/* Hover forecast styling */
.hidden-forecast { position: absolute; background: white; color: #333; padding: 1rem; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); display: none; z-index: 1000; width: max-content; cursor: default; }
.forecast-location { font-weight: bold; text-align: center; margin-bottom: 0.5rem; border-bottom: 1px solid #eee; padding-bottom: 0.5rem; }
.forecast-days { display: flex; gap: 1rem; }
.forecast-block { text-align: center; padding: 0.5rem; border-right: 1px solid #eee; }
.forecast-block:last-child { border-right: none; }
.fc-name { font-size: 0.8rem; color: #666; margin-bottom: 0.3rem; }
.fc-icon { font-size: 1.5rem; margin-bottom: 0.3rem; display: flex; justify-content: center; align-items: center;}
.fc-temp { font-weight: bold; }
</style>
</head>
<body>
<nav>
<h1>Gov Data Demo</h1>
<div class="nav-links">
<a href="index-open-meteo.html">Switch to Open-Meteo Version</a>
<!-- ==== COPY THIS SECTION FOR NAVBAR ==== -->
<div id="nav-weather" class="weather-widget-container">Loading...</div>
<!-- ====================================== -->
</div>
</nav>
<main>
<div style="display: flex; align-items: center; gap: 15px; margin-bottom: 1rem;">
<img src="https://avatars.githubusercontent.com/u/134870304?v=4&size=64" alt="TalviFox Logo" style="border-radius: 8px;">
<h2 style="margin: 0;">TalviFox's Weather Widget</h2>
</div>
<p>This is a custom, lightweight, and dynamic weather widget built by <strong>TalviFox</strong>.</p>
<h3>Acknowledgments & Data Sources</h3>
<p>A huge shout out to the projects and services making this possible:</p>
<ul>
<li><strong><a href="https://www.weather.gov/" target="_blank" style="color: #3498db; text-decoration: none;">National Weather Service (NWS)</a>:</strong> Providing the core forecasting data and grid points.</li>
<li><strong><a href="https://svs.gsfc.nasa.gov/5187" target="_blank" style="color: #3498db; text-decoration: none;">NASA</a>:</strong> Providing beautiful astronomical imagery for our accurate moon phases!</li>
</ul>
<h3>Developer Notes</h3>
<p><strong>Important:</strong> When integrating this widget into your own applications, remember to set a descriptive <code>User-Agent</code> header in your requests. The NWS requires a unique User-Agent (like your app name and contact email) to prevent rate limiting and ensure stable access to their API.</p>
<!--
Usage Instructions:
1. Include weather-gov.js in your project.
2. Create a container element: <div id="my-weather">Loading...</div>
3. Initialize the widget in your Javascript:
new WeatherWidget('my-weather', {
lat: 38.8951,
lon: -77.0364
});
Note: NWS only supports US coordinates.
-->
</main>
<footer>
<div>© 2026 Talvi Fox Project</div>
<!-- ==== COPY THIS SECTION FOR FOOTER ==== -->
<div id="footer-weather" class="weather-widget-container">Loading...</div>
<!-- ====================================== -->
</footer>
<script src="weather-gov.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
new WeatherWidget('nav-weather', { lat: 38.8951, lon: -77.0364 }); // DC
new WeatherWidget('footer-weather', { lat: 38.8951, lon: -77.0364 }); // DC
});
</script>
</body>
</html>