-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_frontend.js
118 lines (78 loc) · 3 KB
/
index_frontend.js
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
// all javascript related to front end will be written here other one is for mapping and server talking
let active = (activebtn) => {
let circular_buttons = document.querySelectorAll(".circular_button");
circular_buttons.forEach(btn => {
btn.classList.remove('active');
});
activebtn.classList.add('active');
}
let addEventListenertobutton = () => {
let circular_buttons = document.querySelectorAll(".circular_button");
circular_buttons.forEach(btn => {
btn.addEventListener("click", () => { active(btn); });
});
}
addEventListenertobutton();
document.getElementById('go').addEventListener('click', () => { calculate_antpath(); });
let down = false;
document.getElementById('foldup').addEventListener('click', () => {
let bottombar = document.getElementsByClassName('bottom-bar')[0];
let icon = document.getElementById('foldup-icon');
if (down == false) {
down = true;
icon.setAttribute('class', 'bi bi-caret-up-fill h3');
bottombar.classList.add('bottom-bar-down');
} else {
down = false;
icon.setAttribute('class', 'bi bi-caret-down-fill h3');
bottombar.classList.remove('bottom-bar-down');
}
});
// below function was for realtime path tracking but it is not feaseable so off right now
// let change = 1;
// let marker;
// const getLocation = () => {
// if (navigator.geolocation) {
// navigator.geolocation.watchPosition((position) => {
// change++;
// const latitude = position.coords.latitude;
// const longitude = position.coords.longitude;
// const latlng = [latitude, longitude];
// let changea;
// // Update the content of the 'demo' element
// document.getElementById('demo').innerHTML = `${latitude}, ${longitude} x ${change}`;
// // marker = L.marker(latlng).addTo(map);
// if (marker) {
// map.removeLayer(marker)
// }
// marker = L.marker(latlng).addTo(map);
// map.setView(latlng, 18);
// }, console.error, { maximumAge: 1000, timeout: 1000, enableHighAccuracy: true });
// } else {
// console.log("Geolocation is not supported by this browser");
// }
// };
// getLocation();
// var myIcon = L.icon({
// iconUrl: 'media/logo.png',
// iconSize: [30]
// });
// var ladi = () => {
// let lats = [
// [30.27282360000,77.99994990000],
// [30.27275250000,77.99994590000],
// [30.27269090000,77.99996430000],
// [30.27263770000,78.00000690000],
// [30.27259260000,78.00009140000],
// [30.27254470000,78.00017210000],
// [30.27252370000,78.00024700000],
// [30.27251660000,78.00030210000],
// [30.27253060000,78.00037580000],
// [30.27255340000,78.00043640000],
// [30.27260800000,78.00054340000],
// [30.27265290000,78.00061440000]];
// lats.forEach(element => {
// L.marker(element, { icon: myIcon }).addTo(map);
// });
// }
// ladi()