-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
186 lines (174 loc) · 6.55 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
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
<!DOCTYPE html>
<html class="wide wow-animation" lang="en">
<head>
<title>Report</title>
<script src='https://api.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.js'></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.css' rel='stylesheet' />
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Montserrat:400,700%7CRoboto:100,300,400,700,900">
<link rel="stylesheet" href="bootstrap.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="novi.css">
<!--[if lt IE 10]> <div style="background: #212121; padding: 10px 0; box-shadow: 3px 3px 5px 0 rgba(0,0,0,.3); clear: both; text-align:center; position: relative; z-index:1;"><a href="http://windows.microsoft.com/en-US/internet-explorer/"><img src="images/ie8-panel/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today."></a></div> <script src="js/html5shiv.min.js"> </script> <![endif]-->
</head>
<body>
<div class="page-loader">
<div class="page-loader-body banter-loader">
<div class="banter-loader__box"></div>
<div class="banter-loader__box"></div>
<div class="banter-loader__box"></div>
<div class="banter-loader__box"></div>
<div class="banter-loader__box"></div>
<div class="banter-loader__box"></div>
<div class="banter-loader__box"></div>
<div class="banter-loader__box"></div>
<div class="banter-loader__box"></div>
</div>
</div>
<div class="page text-center">
<section class="section section-md vide_bg bg-gray-dark " data-vide-bg="video/video-lg">
<div class="container">
<div class="row spacing-30">
<div class="col-12">
<div class="jumbotron-custom jumbotron-custom-variant-2 context-dark">
<div class="position-fixed">
<input type="button" value="X" id="del" onclick="deleteReports()">
</div>
<!-- <h1 data-caption-animate="fxRotateInRight" data-caption-delay="150">Report</h1> -->
<img id="logo" src="Logo.png"/>
<hr class="divider-sm divider-success" data-caption-animate="fxRotateInLeft" data-caption-delay="50">
<div class="table">
<table id="table2">
<tr class="first">
<th></th>
<th>#</th>
<th>Picture</th>
<th>Map</th>
<th>Address</th>
<th>Time Recorded</th>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<div class="footer">
<footer>
<p>© 2019, Recognaissance inc.</p>
</footer>
</div>
<script src="core.min.js"></script>
<script src="script.js"></script>
<script>
var count = 1;
function updateTable(response) {
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.mapbox.com/geocoding/v5/mapbox.places/" + response[count-1].long + "," + response[count-1].lat + ".json?types=address&access_token=pk.eyJ1IjoiZmFyemFuMTM3NyIsImEiOiJjanIzeXRybGgxZmh5NDNveDJsaDNmbTVrIn0.pGHo7Zu1FSM0E1doffdJIA",
"method": "GET",
"headers": {
"cache-control": "no-cache",
}
}
var table = document.getElementById('table2');
var row = table.insertRow(count);
row.className = 'rows';
var cell0 = row.insertCell(0);
var cell1 = row.insertCell(1);
var cell2 = row.insertCell(2);
var cell3 = row.insertCell(3);
var cell4 = row.insertCell(4);
var cell5 = row.insertCell(5);
cell0.innerHTML = "<input type=\"checkbox\" class=\"myCheck\">";
document.getElementsByClassName("myCheck")[count-1].addEventListener("change", make_visible);
$.ajax(settings).done(function (data) {
cell4.innerHTML = data["features"][0]["place_name"];
});
cell1.innerHTML = "" + count;
var pic = response[count-1].url;
mapboxgl.accessToken = 'pk.eyJ1IjoiZmFyemFuMTM3NyIsImEiOiJjanIzeXRybGgxZmh5NDNveDJsaDNmbTVrIn0.pGHo7Zu1FSM0E1doffdJIA';
cell2.innerHTML = "<img id=\"image1\" src=" + pic + ">";
mapUrl = "https://maps.googleapis.com/maps/api/staticmap?center=" + response[count-1].lat + "," + response[count-1].long + "&markers=" + response[count-1].lat + "," + response[count-1].long + "&zoom=15&size=400x400&key=AIzaSyCNDVniRY24jv2_zkXDm8s2irx2yovexm8";
mapDirectLink = "https://www.google.com/maps/@" + response[count-1].lat + "," + response[count-1].long + ",14z";
cell3.innerHTML = "<a href=" + mapDirectLink + " target=\"_blank\"> <img src=" + mapUrl + "> </a>";
cell5.innerHTML = "" + response[count-1].time;
}
var len = 0;
function make_visible() {
var checkBoxes = document.getElementsByClassName("myCheck");
var checked = 0;
for (i = 0; i < checkBoxes.length; i++){
if (checkBoxes[i].checked){
checked++;
}
}
var deleteButton = document.getElementById('del');
if (checked >= 1) {
deleteButton.style.visibility = "visible";
} else {
deleteButton.style.visibility = "hidden";
}
}
function pull() {
var settings = {
"async": true,
"crossDomain": true,
"url": "http://c3b16b4a.ngrok.io/info",
"method": "GET",
"headers": {
"cache-control": "no-cache",
}
}
$.ajax(settings).done(function (response) {
var parsed = JSON.parse(response);
if (count <= parsed.length) {
updateTable(parsed);
count++;
}
});
}
function deleteReports() {
var checkBoxes = document.getElementsByClassName("myCheck");
var checked = [];
for (i = 0; i < checkBoxes.length; i++){
if (checkBoxes[i].checked){
checked.push(i);
}
}
if (checked.length == 0){
return;
}
// var rows = document.getElementsByClassName("rows");
// for (i = 0; i < checked.length; i++){
// rows[checked[i]].parentNode.removeChild(rows[checked[i]]);
// }
count -= checked.length;
var settings = {
"async": true,
"crossDomain": true,
"url": "http://c3b16b4a.ngrok.io/delete",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"cache-control": "no-cache",
},
"processData": false,
"data": JSON.stringify(checked)
}
$.ajax(settings).done(function (response) {
console.log(response);
document.location.reload();
});
}
var timer = window.setInterval(pull, 100);
</script>
</body>
</html>