-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
107 lines (85 loc) · 3.8 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<title>International Caribbeans</title>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0">
<link rel="shortcut icon" href="./assets/icons/favicon-32.png">
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre.min.css">
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-exp.min.css">
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-icons.min.css">
<link href='https://api.mapbox.com/mapbox-gl-js/v0.53.0/mapbox-gl.css' rel='stylesheet' />
<link rel="stylesheet" href="./assets/styles/main.css">
</head>
<body>
<div class="toast toast-success" id="successMessage">
<button class="btn btn-clear float-right" id="successClose" onclick="closeAlert()" ></button>
Information received.
</div>
<header class="navbar">
<section class="navbar-section">
<button class="btn search-btn" id="search-btn"><i class="icon icon-search"></i></button>
</section>
<section class="navbar-center">
<!-- centered logo or brand -->
<img class="logo" src="./assets/icons/globe.svg" alt="logo">
</section>
<section class="navbar-section">
<button class="btn add-btn" onclick="location.href = './add-entry/'">+</button>
</section>
</header>
<div id='map' style="width:100%; height: 300px;"></div>
Vector Design by <a href="https://www.vecteezy.com">www.vecteezy.com</a>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="./assets/scripts/arrive.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="./assets/scripts/config.js"></script>
<script src='https://api.mapbox.com/mapbox-gl-js/v0.53.0/mapbox-gl.js'></script>
<script>
// FUNCTION TO RUN WHEN THE ALERT IS CLOSED BY USER
let closeAlert = () => {
let el = document.getElementById('successMessage');
el.classList.add("animated");
el.classList.add("fadeOut");
}
let map;
// SET MAP CENTER AS THE USER GEOLOCATION
let getLocation = () => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition((position) => {
// DRAW MAP
mapboxgl.accessToken = 'pk.eyJ1IjoiY2FuZGFjZWo5NyIsImEiOiJjanNrbXQ5NDkwMDY4NDRsM2xmeWxlY2NuIn0.zIlYbo2MWxb2JxIsbG6wKA';
map = new mapboxgl.Map({
container: 'map',
center: [ position.coords.longitude, position.coords.latitude ],
style: 'mapbox://styles/mapbox/streets-v11',
zoom: 13
});
// Add zoom and rotation controls to the map.
map.addControl(new mapboxgl.NavigationControl());
});
} else {
console.log("Geolocation is not supported by this browser.");
}
}
getLocation();
// WATCH FOR CREATION OF AN ELEMENT WHICH SATISFIES THE SELECTOR
$(document).arrive("#search-input", function() {
// 'this' refers to the newly created element
let placesAutocomplete = places({
container: this
});
placesAutocomplete.on('change', (e) => {
// SET CENTER
map.setCenter(e.suggestion.latlng);
// SET ZOOM 15-17
map.setZoom(15)
console.log(e.suggestion);
});
});
</script>
<script src="https://www.gstatic.com/firebasejs/3.0.2/firebase.js"></script>
<script src="./assets/scripts/markers.js"></script>
<script src="./assets/scripts/search.js"></script>
</body>
</html>