Spaces:
Running
Running
Update index.html
Browse files- index.html +23 -24
index.html
CHANGED
|
@@ -597,34 +597,33 @@
|
|
| 597 |
}));
|
| 598 |
const t = map.getCenter();
|
| 599 |
const n = map.getZoom();
|
| 600 |
-
let o =
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
}).addTo(map);
|
| 609 |
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
|
| 624 |
-
|
| 625 |
-
|
| 626 |
`).join("\n")}
|
| 627 |
-
|
| 628 |
`;
|
| 629 |
o = o.replace(/iconUrl: 'marker-icon\.png'/g, `iconUrl: '${location.origin}/marker-icon.png'`);
|
| 630 |
document.getElementById("output-html").value = o;
|
|
|
|
| 597 |
}));
|
| 598 |
const t = map.getCenter();
|
| 599 |
const n = map.getZoom();
|
| 600 |
+
let o = `<div id="map" style="height: 600px; width: 100%;">
|
| 601 |
+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" />
|
| 602 |
+
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"><\/script>
|
| 603 |
+
<script>
|
| 604 |
+
var map = L.map('map').setView([${t.lat}, ${t.lng}], ${n});
|
| 605 |
+
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
| 606 |
+
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors'
|
| 607 |
+
}).addTo(map);
|
|
|
|
| 608 |
|
| 609 |
+
${e.map(e => `
|
| 610 |
+
var icon = L.icon({
|
| 611 |
+
iconUrl: '${e.iconUrl}',
|
| 612 |
+
iconSize: [${e.iconWidth}, ${e.iconHeight}],
|
| 613 |
+
iconAnchor: [${e.iconWidth} / 2, ${e.iconHeight}],
|
| 614 |
+
popupAnchor: [0, -${e.iconHeight}],
|
| 615 |
+
tooltipAnchor: [${e.iconWidth} / 2, -${e.iconHeight} / 2]
|
| 616 |
+
});
|
| 617 |
|
| 618 |
+
var marker = L.marker([${e.lat}, ${e.lng}], {
|
| 619 |
+
icon: icon,
|
| 620 |
+
zIndexOffset: 1000
|
| 621 |
+
}).addTo(map);
|
| 622 |
|
| 623 |
+
${e.popupContent ? `marker.bindPopup('${e.popupContent.replace(/'/g, "\\'").replace(/<\/script>/g, "<\\/script>")}');` : ""}
|
| 624 |
+
${e.tooltipContent ? `marker.bindTooltip('${e.tooltipContent.replace(/'/g, "\\'").replace(/<\/script>/g, "<\\/script>")}');` : ""}
|
| 625 |
`).join("\n")}
|
| 626 |
+
<\/script>
|
| 627 |
`;
|
| 628 |
o = o.replace(/iconUrl: 'marker-icon\.png'/g, `iconUrl: '${location.origin}/marker-icon.png'`);
|
| 629 |
document.getElementById("output-html").value = o;
|