This repository has been archived by the owner on Apr 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
235 lines (197 loc) · 6.3 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<html>
<head>
<title>QueerCenters</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/MarkerCluster.css" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/MarkerCluster.Default.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.markercluster.js"></script>
<!-- <script src="https://thomasrosen.github.io/queer-centers/places.js"></script> -->
<style>
* {
margin: 0;
padding: 0;
}
.header {
position: absolute;
top: 0;
right: 0;
left: 0;
height 64px;
padding: 0 16px;
color: black;
background: white;
font-family: sans-serif;
font-weight: 900;
font-size: 32px;
line-height: 64px;
overflow: auto;
white-space: nowrap;
}
.header .infoLink {
display: inline-block;
margin-left: 16px;
color: blue;
font-size: 16px;
text-decoration: underline;
}
.header .infoLink:hover {
color: black;
}
.headerBorderBottom {
position: absolute;
top: 64px;
right: 0;
left: 0;
height: 6px;
}
/* popup styles: */
.leaflet-popup-content-wrapper{
border-radius: 0;
padding: 0;
}
.leaflet-popup-content{
margin: 0;
}
.popupBackground {
padding: 8px;
border: 4px solid white;
}
.popupContent {
background: white;
padding: 8px;
}
.popupContent h1{
margin-right: 38px;
}
.popupContent p{
margin: 18px 0 0 0;
}
.leaflet-container a.leaflet-popup-close-button {
padding: 27px 27px 0 0;
color: red;
font-size: 24px;
}
/* map style: */
#mainMapID {
position: absolute !important;
top: 70px;
right: 0;
bottom: 0;
left: 0;
}
/* other styles: */
.changingBackgroundColors {
background: linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3);
background-size: 1000% 1000%;
-webkit-animation: rainbow 60s ease infinite;
-z-animation: rainbow 60s ease infinite;
-o-animation: rainbow 60s ease infinite;
animation: rainbow 60s ease infinite;
}
@-webkit-keyframes rainbow {
0%{background-position:0% 82%}
50%{background-position:100% 19%}
100%{background-position:0% 82%}
}
@-moz-keyframes rainbow {
0%{background-position:0% 82%}
50%{background-position:100% 19%}
100%{background-position:0% 82%}
}
@-o-keyframes rainbow {
0%{background-position:0% 82%}
50%{background-position:100% 19%}
100%{background-position:0% 82%}
}
@keyframes rainbow {
0%{background-position:0% 82%}
50%{background-position:100% 19%}
100%{background-position:0% 82%}
}
</style>
</head>
<body>
<div class="header">
QueerCenters
<a class="infoLink" href="https://github.com/thomasrosen/queer-centers" target="_blank">Infos / Ort hinzufügen</a>
</div>
<div class="headerBorderBottom changingBackgroundColors"></div>
<div id="mainMapID"></div>
<script>
var mainMap = L.map('mainMapID').setView([51, 10], 6)
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(mainMap)
// add the markers function:
function addTheMarkers(){
var geojsonFeature = []
for (let place of places) {
geojsonFeature.push({
type: "Feature",
properties: {
name: (place.name ? place.name : ""),
lat: (place.lat ? place.lat : 0),
lng: (place.lng ? place.lng : 0),
address: (place.address ? place.address : ""),
min_age: (place.min_age ? place.min_age : 0),
max_age: (place.max_age ? place.max_age : 99999),
website: (place.website ? place.website : ""),
this_is_a_place_for: (place.this_is_a_place_for ? place.this_is_a_place_for : []),
tags: (place.tags ? place.tags : [])
},
geometry: {
type: "Point",
coordinates: [place.lng, place.lat]
}
})
}
var markerCluster = L.markerClusterGroup()
var markerLayer = L.geoJSON(geojsonFeature, {
onEachFeature: function(feature, layer) {
if (feature.properties) {
let popupContent = `
<div class="popupBackground changingBackgroundColors">
<div class="popupContent">
<h1>${feature.properties.name}</h1>
${(feature.properties.address != "" ? `<p class="address">${feature.properties.address}</p>` : "")}
${(feature.properties.website != "" ? `Webseite: <a href="${feature.properties.website}" target="_blank">${feature.properties.website}</a>` : "")}
<p><strong>${(
feature.properties.min_age == -1 && feature.properties.max_age == -1
? "Für Menschen jeden Alters."
: (feature.properties.min_age == -1 && feature.properties.max_age != -1
? "Für Menschen bis zirka "+feature.properties.max_age+" Jahre."
: (feature.properties.min_age != -1 && feature.properties.max_age == -1
? "Für Menschen ab zirka "+feature.properties.min_age+" Jahre."
: (feature.properties.min_age != -1 && feature.properties.max_age != -1
? "Für Menschen von zirka "+feature.properties.min_age+" bis zirka "+feature.properties.max_age+" Jahre."
: ""
))))}</strong></p>
</div>
</div>
`
//layer.bindPopup(popupContent)
console.log('feature:', feature);
let newMarker = L.marker([feature.properties.lat, feature.properties.lng], {})
newMarker.bindPopup(popupContent)
markerCluster.addLayer(newMarker)
}
}
}) // .addTo(mainMap)
// markerCluster.addLayer(markerLayer)
mainMap.addLayer(markerCluster)
}
// load the markers:
var script = document.createElement('script');
script.onload = function () {
addTheMarkers()
};
script.src = "https://thomasrosen.github.io/queer-centers/places.js?random="+(Math.floor(Math.random() * (99999 - 0 + 1)) + 0);
document.head.appendChild(script); //or something of the likes
</script>
</body>
</html>