fix(been): escape popup content, vendor Leaflet marker images locally

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
svemagie
2026-03-20 21:42:41 +01:00
parent e90ad852bb
commit 92277df060
4 changed files with 10 additions and 4 deletions

View File

@@ -29,16 +29,22 @@ leafletMap: true
</script>
<script>
(function() {
L.Icon.Default.imagePath = 'https://unpkg.com/leaflet@1.9.4/dist/images/';
L.Icon.Default.mergeOptions({
iconUrl: '/css/images/marker-icon.png',
iconRetinaUrl: '/css/images/marker-icon-2x.png',
shadowUrl: '/css/images/marker-shadow.png'
});
var map = L.map('checkin-map');
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
maxZoom: 19
}).addTo(map);
var markers = checkinPoints.map(function(p) {
var popup = p.url
? '<a href="' + p.url + '" target="_blank" rel="noopener">' + p.name + '</a>'
: p.name;
var safeName = L.Util.escape(p.name);
var safeUrl = (p.url && p.url.indexOf('https://') === 0) ? p.url : '';
var popup = safeUrl
? '<a href="' + safeUrl + '" target="_blank" rel="noopener">' + safeName + '</a>'
: safeName;
return L.marker([p.lat, p.lng]).bindPopup(popup);
});
markers.forEach(function(m) { m.addTo(map); });

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
css/images/marker-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B