-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
393 lines (362 loc) · 17 KB
/
Copy pathindex.html
File metadata and controls
393 lines (362 loc) · 17 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="Tracker">
<meta name="theme-color" content="#0d1117">
<title>Tracker</title>
<link rel="manifest" href="manifest.json">
<link rel="apple-touch-icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 192 192'%3E%3Crect width='192' height='192' fill='%230d1117' rx='24'/%3E%3Ccircle cx='96' cy='96' r='30' fill='none' stroke='%2339d353' stroke-width='10'/%3E%3Ccircle cx='96' cy='96' r='10' fill='%2339d353'/%3E%3Cline x1='96' y1='20' x2='96' y2='55' stroke='%2339d353' stroke-width='8' stroke-linecap='round'/%3E%3Cline x1='96' y1='137' x2='96' y2='172' stroke='%2339d353' stroke-width='8' stroke-linecap='round'/%3E%3Cline x1='20' y1='96' x2='55' y2='96' stroke='%2339d353' stroke-width='8' stroke-linecap='round'/%3E%3Cline x1='137' y1='96' x2='172' y2='96' stroke='%2339d353' stroke-width='8' stroke-linecap='round'/%3E%3C/svg%3E">
<link rel="stylesheet" href="lib/leaflet.min.css">
<link rel="stylesheet" href="lib/fonts.css">
<link rel="stylesheet" href="app.css">
</head>
<body>
<div id="app">
<!-- HEADER -->
<header id="header">
<div id="app-title"><span class="dot"></span>TRACKER</div>
<div id="wakelock-indicator" title="Screen wake lock active — screen will stay on while recording">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="5" y="11" width="14" height="11" rx="2"/>
<path d="M7 11V7a5 5 0 0 1 10 0v4"/>
</svg>
</div>
<button id="menu-btn" aria-label="Menu">
<span></span><span></span><span></span>
</button>
</header>
<!-- DROPDOWN MENU -->
<div id="dropdown">
<div class="menu-item" id="theme-toggle">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="5"/>
<line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
<line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
</svg>
Switch to Light Theme
</div>
<div class="menu-divider"></div>
<div class="menu-item" id="settings-btn">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="3"/>
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/>
</svg>
Settings
</div>
<div class="menu-divider"></div>
<div class="menu-item" id="download-btn">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<polyline points="7 10 12 15 17 10"/>
<line x1="12" y1="15" x2="12" y2="3"/>
</svg>
Download Area
</div>
<div class="menu-divider"></div>
<div class="menu-item" id="about-btn">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<line x1="12" y1="8" x2="12" y2="12"/>
<line x1="12" y1="16" x2="12.01" y2="16"/>
</svg>
About
</div>
</div>
<!-- MAP -->
<div id="map-container">
<div id="map"></div>
<div id="gps-pill">
<span class="pill-dot"></span>
<span id="gps-status">ACQUIRING GPS</span>
</div>
<div id="rec-indicator">
<span class="rec-dot"></span>
<span id="rec-label">REC</span>
</div>
<button id="recenter-btn" aria-label="Re-center map">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="3"/>
<line x1="12" y1="2" x2="12" y2="6"/>
<line x1="12" y1="18" x2="12" y2="22"/>
<line x1="2" y1="12" x2="6" y2="12"/>
<line x1="18" y1="12" x2="22" y2="12"/>
</svg>
Re-center
</button>
</div>
<!-- TOOLBAR -->
<div id="toolbar">
<button class="tb-btn start" id="btn-start">
<svg class="icon-play" width="13" height="13" viewBox="0 0 24 24" fill="currentColor"><polygon points="5,3 19,12 5,21"/></svg>
<svg class="icon-pause" width="13" height="13" viewBox="0 0 24 24" fill="currentColor" style="display:none"><rect x="6" y="4" width="4" height="16"/><rect x="14" y="4" width="4" height="16"/></svg>
<span class="btn-start-label">Start</span>
</button>
<button class="tb-btn stop" id="btn-stop" disabled>
<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor">
<rect x="3" y="3" width="18" height="18" rx="2"/>
</svg>
Stop
</button>
<button class="tb-btn history" id="btn-history">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
<polyline points="12 8 12 12 14 14"/>
<path d="M3.05 11a9 9 0 1 1 .5 4M3 16V11H8"/>
</svg>
History
</button>
</div>
<!-- INFO PANEL -->
<div id="info-panel">
<div class="info-card">
<div class="info-label">Date</div>
<div class="info-value" id="val-date">—</div>
</div>
<div class="info-card">
<div class="info-label">Time</div>
<div class="info-value accent" id="val-time">—</div>
</div>
<div class="info-card">
<div class="info-label">Latitude</div>
<div class="info-value" id="val-lat">—</div>
</div>
<div class="info-card">
<div class="info-label">Longitude</div>
<div class="info-value" id="val-lon">—</div>
</div>
<div class="info-card">
<div class="info-label">Speed</div>
<div class="info-value" id="val-speed">—</div>
</div>
<div class="info-card">
<div class="info-label">Accuracy</div>
<div class="info-value" id="val-acc">—</div>
</div>
<div class="info-card">
<div class="info-label">Distance</div>
<div class="info-value accent" id="val-dist">0.00 km</div>
</div>
<div class="info-card">
<div class="info-label">Altitude</div>
<div class="info-value" id="val-alt">—</div>
</div>
<div class="info-card">
<div class="info-label">Heading</div>
<div class="info-value" id="val-heading">—</div>
</div>
<div class="info-card">
<div class="info-label">Map Zoom</div>
<div class="info-value" id="val-zoom">—</div>
</div>
</div>
</div>
<!-- NAME MODAL -->
<div class="modal-overlay" id="name-modal">
<div class="modal-box" style="max-width:340px">
<div class="modal-header">
<span class="modal-title">Save Activity</span>
<button class="modal-close" id="name-modal-close">✕</button>
</div>
<div class="modal-body">
<div class="modal-prompt">Enter a name for this activity:</div>
<div id="name-modal-summary" class="name-modal-summary"></div>
<input type="text" id="activity-name-input" placeholder="e.g. Morning Hike" maxlength="60">
<div class="modal-actions">
<button class="btn-secondary" id="name-discard">Discard</button>
<button class="btn-primary" id="name-save">Save</button>
</div>
</div>
</div>
</div>
<!-- HISTORY MODAL -->
<div class="modal-overlay" id="history-modal">
<div class="modal-box" style="max-width:600px;max-height:80dvh;">
<div class="modal-header">
<span class="modal-title">Activity History</span>
<button class="modal-close" id="history-modal-close">✕</button>
</div>
<div class="modal-body">
<div id="history-list"></div>
<div id="history-detail">
<div class="detail-empty">Select an activity</div>
</div>
</div>
</div>
</div>
<!-- ABOUT MODAL -->
<div class="modal-overlay" id="about-modal">
<div class="modal-box" style="max-width:340px">
<div class="modal-header">
<span class="modal-title">About</span>
<button class="modal-close" id="about-modal-close">✕</button>
</div>
<div class="modal-body">
<div class="about-logo">TRACKER</div>
<div class="about-version">v1.0.0 · GPS Activity Tracker</div>
<div class="about-cache" id="about-cache"></div>
<div class="about-desc">
A progressive web app for recording hiking and outdoor activities with real-time GPS
tracking, route visualization, and activity history.<br><br>
Works offline after first load. Install to home screen for the full native experience
on iOS and Android.<br><br>
Built with Leaflet.js + OpenStreetMap.
</div>
<a class="about-link" href="https://github.com/psiborg/Tracker" target="_blank" rel="noopener">
<svg width="15" height="15" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"/>
</svg>
github.com/psiborg/Tracker
</a>
</div>
</div>
</div>
<!-- DOWNLOAD AREA MODAL -->
<div class="modal-overlay" id="download-modal">
<div class="modal-box" style="max-width:420px">
<div class="modal-header">
<span class="modal-title">Offline Maps</span>
<button class="modal-close" id="download-modal-close">✕</button>
</div>
<!-- Tab bar -->
<div class="dl-tabs">
<button class="dl-tab active" id="dl-tab-download" data-tab="dl-pane-download">Download</button>
<button class="dl-tab" id="dl-tab-saved" data-tab="dl-pane-saved">Saved Areas</button>
</div>
<div class="modal-body">
<!-- -- Download pane -- -->
<div class="dl-pane settings-body" id="dl-pane-download">
<div class="settings-row" style="padding-top:4px">
<div class="settings-info">
<div class="settings-row-label">Area Name</div>
<div class="settings-row-desc">Label to identify this download</div>
</div>
<input type="text" id="dl-area-name" class="settings-select"
placeholder="e.g. Bruce Trail" maxlength="40"
style="min-width:130px;text-align:left;padding:5px 8px">
</div>
<div class="settings-section-label" style="margin-top:4px">Map Layers</div>
<div class="dl-layer-checks">
<label class="dl-check"><input type="checkbox" id="dl-osm" checked> 🗺 OpenStreetMap</label>
<label class="dl-check"><input type="checkbox" id="dl-topo"> 🏔 OpenTopoMap</label>
</div>
<div class="settings-section-label" style="margin-top:14px">Zoom Range</div>
<div class="settings-row">
<div class="settings-info">
<div class="settings-row-label">Min Zoom <span id="dl-min-label">10</span></div>
<div class="settings-row-desc">Overview tiles — small files, wide area</div>
</div>
<input type="range" id="dl-zoom-min" class="settings-slider" min="8" max="14" step="1" value="10">
</div>
<div class="settings-row">
<div class="settings-info">
<div class="settings-row-label">Max Zoom <span id="dl-max-label">16</span></div>
<div class="settings-row-desc">Detail tiles — larger files, more storage</div>
</div>
<input type="range" id="dl-zoom-max" class="settings-slider" min="12" max="18" step="1" value="16">
</div>
<div class="dl-estimate-row">
<span id="dl-estimate">Estimated: calculating…</span>
</div>
<div class="dl-progress-wrap" id="dl-progress-wrap" style="display:none">
<div class="dl-progress-bar-track">
<div class="dl-progress-bar-fill" id="dl-progress-fill"></div>
</div>
<div class="dl-progress-label" id="dl-progress-label">0 / 0</div>
</div>
<div class="modal-actions" style="margin-top:14px">
<button class="btn-secondary" id="dl-cancel-btn">Cancel</button>
<button class="btn-primary" id="dl-start-btn">Download</button>
</div>
</div>
<!-- -- Saved Areas pane -- -->
<div class="dl-pane" id="dl-pane-saved" style="display:none">
<div id="dl-areas-list" class="dl-areas-list"></div>
</div>
</div>
</div>
</div>
<!-- SETTINGS MODAL -->
<div class="modal-overlay" id="settings-modal">
<div class="modal-box" style="max-width:360px">
<div class="modal-header">
<span class="modal-title">Settings</span>
<button class="modal-close" id="settings-modal-close">✕</button>
</div>
<div class="modal-body">
<div class="settings-body">
<div class="settings-section-label">Recording</div>
<div class="settings-row">
<div class="settings-info">
<div class="settings-row-label">Smooth Route Lines</div>
<div class="settings-row-desc">Apply EMA filter to reduce GPS jitter on the drawn path</div>
</div>
<label class="toggle-switch">
<input type="checkbox" id="setting-smooth" checked>
<span class="toggle-track"><span class="toggle-thumb"></span></span>
</label>
</div>
<div class="settings-row" id="jitter-row">
<div class="settings-info">
<div class="settings-row-label">Jitter Filter <span id="jitter-value-label">3 m</span></div>
<div class="settings-row-desc">Minimum movement distance before a point is recorded</div>
</div>
<input type="range" id="setting-jitter" class="settings-slider"
min="0" max="20" step="1" value="3">
</div>
<div class="settings-section-label" style="margin-top:16px">Data Points</div>
<div class="settings-row">
<div class="settings-info">
<div class="settings-row-label">Record Interval</div>
<div class="settings-row-desc">How often a point is saved. Lower = more detail, more storage</div>
</div>
<select id="setting-point-interval" class="settings-select">
<option value="1000">1 s</option>
<option value="2000">2 s</option>
<option value="5000" selected>5 s</option>
<option value="10000">10 s</option>
<option value="30000">30 s</option>
</select>
</div>
<div class="settings-row">
<div class="settings-info">
<div class="settings-row-label">GPS Poll Rate</div>
<div class="settings-row-desc">How often the GPS hardware is queried</div>
</div>
<select id="setting-gps-interval" class="settings-select">
<option value="500">0.5 s</option>
<option value="1000" selected>1 s</option>
<option value="2000">2 s</option>
<option value="5000">5 s</option>
</select>
</div>
<div class="settings-row">
<div class="settings-info">
<div class="settings-row-label">Accuracy Filter</div>
<div class="settings-row-desc">Discard points worse than this accuracy (metres)</div>
</div>
<select id="setting-acc-filter" class="settings-select">
<option value="20">20 m</option>
<option value="50" selected>50 m</option>
<option value="100">100 m</option>
<option value="9999">Off</option>
</select>
</div>
</div>
</div>
</div>
</div>
<script src="lib/leaflet.min.js"></script>
<script src="app.js"></script>
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./sw.js').catch(() => {});
}
</script>
</body>
</html>