PageSourceSearch

https://www.zi.de/_assets/e6e9ab44fbf612493f3dc98c95754dbf/JavaScript/Frontend/Leaflet.js?1779118021

js zi.de collected 2026-09-25 18:38:34 UTC 2,451 bytes, 68 lines download raw bytes

1function ttAddressLeaflet() {
2    var obj = {};
3
4    obj.map = null;
5    obj.markers = [];
6
7    obj.run = function () {
8        obj.map = L.map('ttaddress__map').setView([51.505, -0.09], 13);
9        obj.map.scrollWheelZoom.disable();
10        var mapBounds = L.latLngBounds();
11        L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
12            maxZoom: 18,
13            attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
14                '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
15                'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
16            id: 'mapbox.streets'
17        }).addTo(obj.map);
18
19        var records = document.getElementById("ttaddress__records").children;
20        for (var i = 0; i < records.length; i++) {
21            var item = records[i];
22
23            var marker = L.marker([item.getAttribute('data-lat'), item.getAttribute('data-lng')]).addTo(obj.map)
24                .bindPopup(document.getElementById('ttaddress__record-' + item.getAttribute('data-id')).innerHTML);
25            obj.markers.push(marker);
26        }
27        var group = new L.featureGroup(obj.markers);
28        obj.map.fitBounds(group.getBounds());
29
30        // Zoom out if zoom level is too high
31        // var zoomLevel = obj.map.getZoom();
32        // if (zoomLevel >= 10) {
33        //     obj.map.setZoom(8);
34        // }
35    };
36
37    obj.openMarker = function (markerId) {
38        obj.markers[markerId].openPopup();
39    };
40
41    return obj;
42}
43
44function ttAddressOnload() {
45    var ttAddressMapInstance = ttAddressLeaflet();
46    ttAddressMapInstance.run();
47
48    document.addEventListener('click', function (event) {
49        if (!event.target.matches('.ttaddress__markerlink')) {
50            return;
51        }
52        event.preventDefault();
53        var element = event.target;
54        ttAddressMapInstance.openMarker(parseInt(element.getAttribute('data-iteration-id')));
55    }, false);
56}
57
58/** event listener on DOMContentLoaded does not work with scripts which are loaded async.
59  * With TYPO3 this could e.g. happen with EXT:scriptmerger
60  * Thus we listen only if document.readyState is loading, otherwise we can already fire as DOM is loaded already.
61 **/
62if (document.readyState === 'loading') {
63    document.addEventListener("DOMContentLoaded", function () {
64        ttAddressOnload();
65    });
66} else {
67    ttAddressOnload();
68}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.