-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·58 lines (50 loc) · 4.11 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bike Rack Map</title>
<style>
body {
margin: 0; /* Reset default margin */
font-family: 'Arial', sans-serif
}
iframe {
display: block; /* iframes are inline by default */
background: #000;
border: none; /* Reset default border */
height: 100vh; /* Viewport-relative units */
width: 100vw;
}
</style>
</head>
<body>
<div style="position: absolute;top: 0px;right: 0px;text-align: end;background:#ffffffd1;padding: 1vw;">Red = Destination<br>Blue = Bike parking<br>Green = Bike lane</div>
</body>
<script>
document.addEventListener("DOMContentLoaded", function () {
// Get the URL parameters
const params = new URLSearchParams(window.location.search);
const customString = number => `36${'0'.repeat(8 - number.length)}${number}`;
// Get the 'src' parameter
const iframeSrc = params.get('rel');
// If 'src' parameter exists
if (iframeSrc) {
// Create the iframe element
const iframe = document.createElement('iframe');
// Set the src attribute of the iframe
src = "https://overpass-turbo.eu/map.html?Q=%5Bout%3Ajson%5D%3B%0Aarea%283600182130%29-%3E.a%3B%0A%28%0A++way%5Bhighway%5D%5Bcycleway%5D%28area.a%29%3B%0A++way%5Bhighway%5D%5B%22cycleway%3Aleft%22%5D%28area.a%29%3B%0A++way%5Bhighway%5D%5B%22cycleway%3Aright%22%5D%28area.a%29%3B%0A++node%5Bamenity%3Dbicycle_parking%5D%28area.a%29%3B%0A++node%5Bshop%5D%28area.a%29%3B%0A++node%5Bhealthcare%5D%28area.a%29%3B%0A++++way%5Bhealthcare%5D%28area.a%29%3B%0A++node%5Boffice%5D%28area.a%29%3B%0A++++%09way%5Bamenity%7E%22%5E%28library%7Crestaurant%7Ccafe%7Cpub%7Cbank%7Carts_centre%7Cfast_food%7Cbar%7Cdentist%7Cplace_of_worship%7Cice_cream%7Ccommunity_centre%7Cclinic%7Csocial_facility%7Cschool%7Cmusic_venue%7Ccourthouse%7Cprison%7Cpost_office%7Cpolice%7Cfuel%7Ctheatre%7Cbiergarten%7Ccar_rental%7Cevents_venue%7Ccinema%7Cveterinary%7Cnightclub%29%24%22%5D%28area.a%29%3B%0A++++++%09way%5Bbuilding%7E%22%5E%28school%7Cmixed_use%29%24%22%5D%28area.a%29%3B%0A++way%5Bshop%5D%28area.a%29%3B%0A++node%5Bamenity%7E%22%5E%28library%7Crestaurant%7Ccafe%7Cpub%7Cbank%7Carts_centre%7Cfast_food%7Cbar%7Cdentist%7Cplace_of_worship%7Cice_cream%7Ccommunity_centre%7Cclinic%7Csocial_facility%7Cschool%7Cmusic_venue%7Ccourthouse%7Cprison%7Cpost_office%7Cpolice%7Cfuel%7Ctheatre%7Cbiergarten%7Ccar_rental%7Cevents_venue%7Ccinema%7Cveterinary%7Cnightclub%29%24%22%5D%28area.a%29%3B%0A++++node%5Bleisure%7E%22%5E%28fitness_centre%7Cpark%7Cpitch%7Cplayground%7Cbowling_alley%29%24%22%5D%28area.a%29%3B%0A++%0A++node%5Btourism%7E%22%5E%28gallery%7Cmuseum%29%24%22%5D%28area.a%29%3B%0A++way%5Btourism%7E%22%5E%28gallery%7Cmuseum%29%24%22%5D%28area.a%29%3B%0A++++way%5Bleisure%7E%22%5E%28fitness_centre%7Cpark%7Cpitch%7Cplayground%7Cbowling_alley%29%24%22%5D%28area.a%29%3B%0A%29%3B%0Aout+body%3B%0A%3E%3B%0Aout+skel+qt%3B%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%7B%7Bstyle%3A++%2F*+this+is+the+MapCSS+stylesheet+*%2F%0Anode%2C+area%0A%7B+color%3Ared%3B+fill-color%3Ared%3B+z-index%3A0%3B%7D%0A%0Anode%5Bamenity%5D%2C%0Anode%5Bshop%5D%2C%0Anode%5Bhealthcare%5D%2C%0Anode%5Boffice%5D%2C%0Anode%5Bleisure%5D%2C%0Anode%5Btourism%5D%0A%7B+color%3Ared%3B+fill-color%3Ared%3B+%7D%0A%0Anode%5Bamenity%3Dbicycle_parking%5D%0A%7B+color%3Ablue%3B+fill-color%3Ablue%3Bz-index%3A1%3B+%7D%0A%0A%0Away%5Bhighway%5D%0A%7B+color%3Agreen%3B+fill-color%3Agreen%3Bz-index%3A-1%3B+%7D%0A+%7D%7D"
// replace the Cleveland default, with whatever is in the rel param
iframe.src = src.replace('3600182130',customString(iframeSrc))
// Optionally set other attributes like width and height
// Append the iframe to the body element
document.body.appendChild(iframe);
} else {
// Display message if no 'src' parameter is found
const message = document.createElement('p');
message.innerText = "No rel parameter found in the URL.";
document.body.appendChild(message);
}
});
</script>
</html>