notfall/notfall.tmpl
kekskurse 6de086824b
All checks were successful
continuous-integration/drone/push Build is passing
Stuff
2022-01-16 13:14:34 +01:00

43 lines
No EOL
1.6 KiB
Cheetah

<head>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
<style type="text/css">
#map { height: 80%; }
</style>
</head>
<body>
<div id="map"></div>
Last Update: <span id="update"></span>
<a href="/activate">Es gibt einen Notfall, zeige mir den Standort, eine SMS wird verschickt</a>
<script>
var map = L.map('map').setView([52.0, 13.0], 1);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
circle = L.circle([52.0, 13.0], {radius: 200000000}).addTo(map);
marker = L.marker([52.0, 13.0]).addTo(map)
function update() {
setTimeout("update()", 5000)
fetch('/json')
.then(response => response.json())
.then(data => {
map.setView([data["lat"], data["lon"]], 18);
circle.setLatLng([data["lat"], data["lon"]])
marker.setLatLng([data["lat"], data["lon"]])
document.getElementById("update").innerHTML = data["tst"]
circle.setRadius(data["acc"])
});
}
update()
</script>
</body>