-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
208 lines (187 loc) · 6.2 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ArchiveTeam Warrior HQ</title>
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
<style type="text/css">
#map { position: fixed; left: 0; top: 0; width: 100%; height: 100%; }
.my-div-icon {
animation-duration: 0.8s;
animation-name: pulse;
animation-iteration-count: infinite;
animation-direction: alternate;
-webkit-animation-duration: 0.8s;
-webkit-animation-name: pulse;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: alternate;
-moz-animation-duration: 0.8s;
-moz-animation-name: pulse;
-moz-animation-iteration-count: infinite;
-moz-animation-direction: alternate;
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
background: #a00;
}
@keyframes pulse {
from {
box-shadow: 0 0 1px 1px rgba(170,0,0,1);
}
to {
box-shadow: 0 0 1px 1px rgba(170,0,0,0.01);
}
}
@-webkit-keyframes pulse {
from {
-webkit-box-shadow: 0 0 1px 1px rgba(170,0,0,1);
box-shadow: 0 0 1px 1px rgba(170,0,0,1);
}
to {
-webkit-box-shadow: 0 0 1px 1px rgba(170,0,0,0.01);
box-shadow: 0 0 1px 1px rgba(170,0,0,0.01);
}
}
@-moz-keyframes pulse {
from {
-moz-box-shadow: 0 0 1px 1px rgba(170,0,0,1);
box-shadow: 0 0 1px 1px rgba(170,0,0,1);
}
to {
-moz-box-shadow: 0 0 1px 1px rgba(170,0,0,0.01);
box-shadow: 0 0 1px 1px rgba(170,0,0,0.01);
}
}
h1 {
position: absolute;
left: 50px;
top: 10px;
margin: 0;
padding: 5px 10px 5px 10px;
background: #fff;
background: rgba(255, 255, 255, 0.7);
font-family: Arial,Helvetica,sans-serif;
font-size: 18px;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
}
#stats {
position: absolute;
left: 50px;
top: 50px;
background: #fff;
background: rgba(255, 255, 255, 0.7);
font-family: Arial,Helvetica,sans-serif;
font-size: 18px;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
}
#stats table {
padding: 5px 0 4px 0;
margin: 0 3px 0 3px;
}
#stats table th {
padding: 3px 10px 3px 7px;
text-align: left;
font-weight: normal;
}
#stats table td {
padding: 3px 10px 3px 15px;
text-align: right;
}
#stats tfoot th, #stats tfoot td {
border-top: 1px solid rgba(0,0,0,0.1);
}
</style>
</head>
<body>
<div id="map"></div>
<h1>ArchiveTeam Warrior HQ</h1>
<div id="stats"><table cellspacing="0">
<tr><th>Loading...</th></tr>
</table>
</div>
<script type="text/javascript">
(function() {
var layer = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 8,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
var map = L.map('map').setView([30, 0], 3);
map.addLayer(layer);
map.fitWorld();
map.panTo([30, 0]);
var myIcon = L.divIcon({className: 'my-div-icon', iconSize:[12,12]});
function updateMarkers(map, markers, d) {
for (var i=0; i<markers.length; i++) {
map.removeLayer(markers[i]);
}
markers = [];
for (var i=0; i<d.length; i++) {
var marker = L.marker(d[i], {icon: myIcon, opacity: 0.8});
map.addLayer(marker);
markers.push(marker);
}
return markers;
}
map.theMarkers = [];
function handleMarkers(responseJSON) {
map.theMarkers = updateMarkers(map, map.theMarkers, responseJSON.coords);
var table = new Element('table', { cellspacing: 0 }),
tbody = new Element('tbody'),
tfoot = new Element('tfoot');
table.grab(tbody);
table.grab(tfoot);
var sum = 0;
var projects = responseJSON.projects;
for (var i=0; i<projects.length; i++) {
var tr = new Element('tr');
tr.grab(new Element('th', { html: projects[i][0] }));
tr.grab(new Element('td', { html: projects[i][1] }));
tbody.grab(tr);
sum += projects[i][1];
}
var tr = new Element('tr');
tr.grab(new Element('th', { html: 'total' }));
tr.grab(new Element('td', { html: sum }));
tfoot.grab(tr);
table.replaces($$('#stats table')[0]);
}
function loadMarkers() {
new Request.JSON({
url: '/stats.json',
onSuccess: handleMarkers,
method: 'GET'
}).send();
}
function handleProjects(responseJSON) {
if (responseJSON.projects) {
for (var i=responseJSON.projects.length-1; i>=0; i--) {
var project = responseJSON.projects[i];
if (project.lat_lng) {
var marker = L.marker(project.lat_lng).addTo(map);
marker.bindPopup(project.marker_html);
marker.openPopup();
}
}
}
}
function loadProjects() {
new Request.JSON({
url: '/projects.json',
onSuccess: handleProjects,
method: 'GET'
}).send();
}
loadMarkers();
loadProjects();
window.setInterval(loadMarkers, 60000);
})();
</script>
</body>
</html>