-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
63 lines (62 loc) · 2.43 KB
/
index.html
File metadata and controls
63 lines (62 loc) · 2.43 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Distance Tracker</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
<link rel="stylesheet" href="styles.css">
<!-- Load configuration first -->
<script src="config.js"></script>
<script>
function initMap() {
if (typeof google === "undefined") {
document.getElementById("errorMessage").textContent =
"Error: Google Maps API failed to load. Please check your API key and enabled services.";
document.getElementById("errorMessage").classList.remove("hidden");
return;
}
// Initialize app only after Maps API is loaded
window.initApp();
}
// Dynamically load Google Maps API with configuration
function loadGoogleMapsAPI() {
const script = document.createElement('script');
const libraries = window.appConfig.googleMaps.libraries.join(',');
script.src = `https://maps.googleapis.com/maps/api/js?key=${window.appConfig.googleMaps.apiKey}&libraries=${libraries}&callback=initMap`;
script.async = true;
script.defer = true;
document.head.appendChild(script);
}
</script>
<script src="app.js"></script>
</head>
<body onload="loadGoogleMapsAPI()">
<div class="section">
<div class="app-wrapper">
<div id="app-container">
<div class="title-bar">
<div class="title is-4 has-text-centered">🔥 / ❄️ Nav</div>
</div>
<div class="field">
<label class="label" for="destination">Destination</label>
<div class="control">
<input class="input" type="text" id="destination" placeholder="Type a location..."/>
</div>
</div>
<div class="field">
<div class="control" style="width: 100%;">
<button class="button is-primary is-fullwidth" id="startTracking">Start Tracking</button>
</div>
</div>
<div id="distanceDisplay" class="has-text-weight-bold hidden">
Current Distance:
<span id="distance">0</span>
<span class="unit">m</span>
</div>
<div id="errorMessage" class="notification is-danger is-light hidden"></div>
</div>
</div>
</div>
</body>
</html>