notfall/notfall.tmpl

43 lines
1.6 KiB
Cheetah
Raw Normal View History

2022-01-16 11:27:54 +00:00
<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">
2022-01-16 12:00:26 +00:00
#map { height: 80%; }
2022-01-16 11:27:54 +00:00
</style>
</head>
<body>
<div id="map"></div>
2022-01-16 12:00:26 +00:00
Last Update: <span id="update"></span>
2022-01-16 11:27:54 +00:00
2022-01-16 12:14:34 +00:00
<a href="/activate">Es gibt einen Notfall, zeige mir den Standort, eine SMS wird verschickt</a>
2022-01-16 12:12:21 +00:00
2022-01-16 11:27:54 +00:00
<script>
2022-01-16 12:12:21 +00:00
var map = L.map('map').setView([52.0, 13.0], 1);
2022-01-16 11:27:54 +00:00
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);
2022-01-16 11:39:26 +00:00
2022-01-16 12:12:21 +00:00
circle = L.circle([52.0, 13.0], {radius: 200000000}).addTo(map);
marker = L.marker([52.0, 13.0]).addTo(map)
2022-01-16 11:46:43 +00:00
2022-01-16 11:39:26 +00:00
function update() {
2022-01-16 12:14:34 +00:00
setTimeout("update()", 5000)
2022-01-16 11:39:26 +00:00
fetch('/json')
2022-01-16 12:14:34 +00:00
.then(response => response.json())
2022-01-16 11:42:39 +00:00
.then(data => {
2022-01-16 11:52:37 +00:00
map.setView([data["lat"], data["lon"]], 18);
2022-01-16 11:46:43 +00:00
circle.setLatLng([data["lat"], data["lon"]])
2022-01-16 11:56:28 +00:00
marker.setLatLng([data["lat"], data["lon"]])
2022-01-16 12:00:26 +00:00
document.getElementById("update").innerHTML = data["tst"]
2022-01-16 11:46:43 +00:00
circle.setRadius(data["acc"])
2022-01-16 11:42:39 +00:00
});
2022-01-16 11:39:26 +00:00
}
update()
2022-01-16 11:27:54 +00:00
</script>
</body>