-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
129 lines (119 loc) · 4.65 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
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Freifunk Leaflet Map</title>
<link rel="stylesheet" href="/libs/leaflet.css" />
<link rel="stylesheet" href="/libs/L.Control.Locate.min.css" />
<style>
body {
margin: 0;
padding: 0;
}
#overlay_header_wrapper {
position: absolute;
top: 0;
left: 0;
right: 0;
text-align: center;
margin: auto 0;
overflow: hidden;
z-index: 1000;
}
#overlay_header {
position: relative;
background-color: white;
color: #333;
padding: 0 20px;
text-align: center;
border-radius: 0 0 10px 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
border-bottom: 1px solid #333;
border-right: 1px solid #333;
border-left: 1px solid #333;
font-family: RobotoDraft,Roboto,'Helvetica Neue',sans-serif;
overflow: hidden;
display: inline-block;
}
#overlay_header img {
float: left;
width: 55px;
height: auto;
margin: 5px 10px 5px 0px;
}
#overlay_header h1 {
float: left;
margin: 0;
padding: 10px 0;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
@media (max-width: 600px ) {
#overlay_header {
font-size: 2.7vw;
}
#overlay_header img {
width: 9vw;
height: auto;
}
}
</style>
</head>
<body>
<div id="overlay_header_wrapper">
<div id="overlay_header">
<img src="logo.png" alt="Freifunk Logo" />
<h1>Freifunk Domänina</h1>
</div>
</div>
<div id="map"></div>
<script src="/libs/leaflet.js"></script>
<script src="/libs/L.Control.Locate.min.js" charset="utf-8"></script>
<script src="config.js"></script> <!-- Hier wird die config.js eingebunden -->
<script>
// Karte initialisieren
var map = L.map('map').setView([51.93, 7.4], 10);
// OpenStreetMap Layer hinzufügen
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributor | <a href="https://freifunk-muensterland.de/datenschutzerklaerung/">Datenschutzerklärung</a> | <a href="https://freifunk-muensterland.de/impressum/">Impressum</a>'
}).addTo(map);
// Farben definieren
var bcolors = ['#FFFF33', '#FF3300', '#3366CC', '#660033', '#FF3333', '#0000FF', '#00FF99', '#CC3333', '#996666', '#333300', '#FF9900', '#330066', '#CC6666', '#FF0099', '#006600', '#009966', '#CC3399', '#0000CC', '#FF6600', '#FFCC00', '#6666FF', '#993366', '#330000', '#CC9933', '#FF6633', '#CC6699', '#CC0033', '#FF99FF', '#CC00CC', '#FFCC99', '#663366', '#0066CC', '#6699FF', '#00CCCC', '#33CCCC', '#33FF99', '#00FF33', '#CCFF33', '#999966', '#FF9933'];
function getColor() {
var color = bcolors.shift();
bcolors.push(color);
return color;
}
function getStyle(color) {
return {
fillColor: color,
weight: 2,
opacity: 1,
color: 'white',
dashArray: '3',
fillOpacity: 0.5
};
}
// Domains aus der config.js laden
Object.keys(domains).forEach(function(domainKey) {
var domain = domains[domainKey];
var geojsonPath = "/shapes/" + domain.id + ".geojson";
// GeoJSON laden und der Karte hinzufügen
fetch(geojsonPath)
.then(response => response.json())
.then(data => {
L.geoJSON(data, {
style: getStyle(getColor())
}).addTo(map).bindPopup('<strong>' + domain.id.replace('domaene', 'Domäne ') + '</strong><br>Name: ' + domain.name + '<br><br><a href="https://karte.freifunk-muensterland.de/' + domain.id.replace('domaene', 'map') + '/">Karte</a> | <a href="https://firmware.freifunk-muensterland.de/' + domain.id + '/">Firmware</a>');
})
.catch(error => console.error("Fehler beim Laden von GeoJSON:", error));
});
L.control.locate({drawCircle: false, locateOptions:{enableHighAccuracy: true, maxZoom: 16}}).addTo(map);
</script>
</body>
</html>