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:
@@ -29,16 +29,22 @@ leafletMap: true
|
|||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(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');
|
var map = L.map('checkin-map');
|
||||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||||
maxZoom: 19
|
maxZoom: 19
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
var markers = checkinPoints.map(function(p) {
|
var markers = checkinPoints.map(function(p) {
|
||||||
var popup = p.url
|
var safeName = L.Util.escape(p.name);
|
||||||
? '<a href="' + p.url + '" target="_blank" rel="noopener">' + p.name + '</a>'
|
var safeUrl = (p.url && p.url.indexOf('https://') === 0) ? p.url : '';
|
||||||
: p.name;
|
var popup = safeUrl
|
||||||
|
? '<a href="' + safeUrl + '" target="_blank" rel="noopener">' + safeName + '</a>'
|
||||||
|
: safeName;
|
||||||
return L.marker([p.lat, p.lng]).bindPopup(popup);
|
return L.marker([p.lat, p.lng]).bindPopup(popup);
|
||||||
});
|
});
|
||||||
markers.forEach(function(m) { m.addTo(map); });
|
markers.forEach(function(m) { m.addTo(map); });
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 618 B |
Reference in New Issue
Block a user