-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
182 lines (170 loc) · 6.39 KB
/
index.html
File metadata and controls
182 lines (170 loc) · 6.39 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ISS Location Tracker</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/>
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
#map {
height: 100vh;
width: 100%;
}
.info-panel {
position: absolute;
top: 10px;
right: 10px;
z-index: 1000;
background: rgba(255, 255, 255, 0.9);
padding: 15px;
border-radius: 5px;
box-shadow: 0 0 15px rgba(0,0,0,0.2);
max-width: 250px;
}
.dark-mode .info-panel {
background: rgba(30, 30, 30, 0.9);
color: #ffffff;
}
.iss-icon {
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="%23ff0000" d="M256 0c-5.3 0-10.6 1.7-15 5.1C112.1 100.3 0 240.4 0 400c0 61.9 50.1 112 112 112s112-50.1 112-112c0-17.5-4.1-34.1-11.3-49.1l45.8-72.5c2.6-4.1 7-6.6 11.6-6.6s9 2.5 11.6 6.6l45.8 72.5C292.1 365.9 288 382.5 288 400c0 61.9 50.1 112 112 112s112-50.1 112-112c0-159.6-112.1-299.7-241-394.9-4.4-3.4-9.7-5.1-15-5.1zM112 448c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48zm288 0c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48z"/></svg>');
background-size: contain;
background-repeat: no-repeat;
width: 40px;
height: 40px;
}
h1 {
margin-top: 0;
color: #2c3e50;
}
.dark-mode h1 {
color: #ffffff;
}
.note {
font-size: 0.9em;
color: #7f8c8d;
margin-top: 15px;
border-top: 1px solid #eee;
padding-top: 10px;
}
.dark-mode .note {
color: #aaaaaa;
border-top: 1px solid #444;
}
.toggle-container {
position: absolute;
top: calc(100% + 20px);
right: 10px;
z-index: 1000;
}
.toggle-btn {
background: rgba(255, 255, 255, 0.9);
border: none;
padding: 8px 12px;
border-radius: 5px;
cursor: pointer;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
font-weight: bold;
}
.dark-mode .toggle-btn {
background: rgba(30, 30, 30, 0.9);
color: white;
}
</style>
</head>
<body>
<div id="map"></div>
<div class="info-panel">
<h1>ISS Tracker</h1>
<p><strong>Position:</strong><br>
51.5100°N, -0.1300°E</p>
<p><strong>Crew:</strong> 7 astronauts</p>
<p><strong>Updated:</strong><br>
2025-04-05 11:10:25 UTC</p>
<p><strong>Crew Members:</strong><br>
Astronaut 1, Astronaut 2, Astronaut 3</p>
<div class="note">
Note: This is a static snapshot. Data was current at time of generation. Visualization created by Pablo Ferros.
</div>
<div class="toggle-container">
<button class="toggle-btn" onclick="toggleDarkMode()">Dark Mode</button>
</div>
</div>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script>
// Initialize map
const map = L.map('map').setView([51.51, -0.13], 3);
// Light mode tiles (default)
const lightTiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
// Dark mode tiles - we'll just modify the water color
const darkTiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
className: 'dark-tiles' // Special class for our CSS override
});
// Add default (light) tiles
lightTiles.addTo(map);
// Create custom ISS icon
const issIcon = L.divIcon({
className: 'iss-icon',
iconSize: [40, 40],
iconAnchor: [20, 20]
});
// Add ISS marker
const iss = L.marker([51.51, -0.13], {
icon: issIcon
}).addTo(map);
// Add popup with info
iss.bindPopup(`
<b>International Space Station</b><br>
Position: 51.5100°N, -0.1300°E<br>
Updated: 2025-04-05 11:10:25 UTC
`);
// Add orbit circle
L.circle([51.51, -0.13], {
color: 'red',
fillColor: 'transparent',
radius: 500000,
weight: 1,
opacity: 0.5,
dashArray: '10, 10'
}).addTo(map);
// Dark mode toggle function
function toggleDarkMode() {
const body = document.body;
const btn = document.querySelector('.toggle-btn');
if (body.classList.contains('dark-mode')) {
body.classList.remove('dark-mode');
btn.textContent = 'Dark Mode';
lightTiles.addTo(map);
darkTiles.remove();
// Remove our water color override
const style = document.getElementById('dark-water-style');
if (style) style.remove();
} else {
body.classList.add('dark-mode');
btn.textContent = 'Light Mode';
darkTiles.addTo(map);
lightTiles.remove();
// Add CSS to override water color
const style = document.createElement('style');
style.id = 'dark-water-style';
style.textContent = `
.dark-tiles {
filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7);
}
.dark-tiles .leaflet-tile-container img {
background-color: #1a1a1a !important;
}
`;
document.head.appendChild(style);
}
}
</script>
</body>
</html>