PageSourceSearch

https://www.ipgp.fr/wp-content/themes/nc_theme/assets/js/map-home.js?ver=7.1

js ipgp.fr collected 2026-10-01 10:24:16 UTC 3,853 bytes, 106 lines download raw bytes

1jQuery(document).ready(function($) {
2    const xhrPool = [];
3
4    let carte = $('#map');
5
6    let map = L.map('map', {
7        dragging: !L.Browser.mobile,
8        scrollWheelZoom: !L.Browser.mobile,
9    }).setView([0, 0], 2);
10
11    function nc_carte() {
12        map.scrollWheelZoom.disable();
13
14        L.tileLayer("https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}{r}.png?key=cb1_2pvf_1_9dc54bfe5504cbe2e2256251", {
15            attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',
16            subdomains: 'abcd',
17            minZoom: 2,
18            maxZoom: 18,
19        }).addTo(map);
20
21        let markers = L.markerClusterGroup({
22            maxClusterRadius: 25
23        });
24
25        if ( carte.data('markers').length ) {
26            $.each(carte.data('markers'), function (i, e) {
27                if ( parseFloat(e.latitude) < 100 && parseFloat(e.longitude) < 200 ) {
28                    let marker = L.marker([e.latitude, e.longitude], {
29                        icon: new L.DivIcon({
30                            className: 'point-carte',
31                            html:
32                                '<img src="/wp-content/themes/nc_theme/assets/img/leaflet/' + e.couleur + '.png" alt="' + e.titre + '">' +
33                                '<span class="' + e.couleur + '"><b>' + e.titre + '</b><br>' + e.ville + ', ' + e.pays + '</span>',
34                        }),
35                    });
36
37                    let popup = '<div class="elementor mt-0">';
38                    popup += '<h5>' + e.titre + '</h5>';
39                    popup += '<p><u>' + e.type + '</u></p>';
40                    popup += '<p>' + e.pays + ', '+ e.ville +'</p>';
41
42                    if ( e.image !== null ) {
43                        popup += '<img class="img-fluid" src="' + e.image + '" alt="' + e.titre + '">';
44                    }
45
46                    if ( e.resume !== null ) {
47                        popup += '<p><small>' + e.resume + '</small></p>';
48                    }
49
50                    if ( e.lien !== null ) {
51                        popup += '<a href="' + e.lien + '" class="btn btn-danger placement-bouton" title="En savoir plus" target="' + (e.lien.includes(window.location.hostname) ? '_self' : '_blank') + '">En savoir plus</a>';
52                    }
53
54                    popup += '</div>';
55
56                    marker.bindPopup(popup);
57                    markers.addLayer(marker);
58                }
59            });
60
61            map.addLayer(markers).fitBounds(markers.getBounds());
62        }
63    }
64
65    nc_carte();
66
67    // Carte
68
69    $(".observatoires form input[name='observatoire']").change(function() {
70        let observatoires = [];
71
72        $(".observatoires form input[name='observatoire']:checked").each(function() {
73            observatoires.push($(this).val());
74        });
75
76        $("#map").addClass('loading').html('<i class="fas fa-circle-notch fa-spin"></i>');
77
78        $.each(xhrPool, function(idx, jqXHR) {
79            jqXHR.abort();
80        });
81
82        $.ajax({
83            type: "POST",
84            url: '/ajax/carte.php',
85            data: {
86                'observatoires': observatoires,
87            },
88            beforeSend: function(jqXHR) {
89                xhrPool.push(jqXHR);
90            },
91        }).done(function(response) {
92            map.off().remove();
93
94            $(".observatoires #map").replaceWith(response);
95
96            carte = $('#map');
97
98            map = L.map('map', {
99                dragging: !L.Browser.mobile,
100                scrollWheelZoom: !L.Browser.mobile,
101            }).setView([0, 0], 2);
102
103            nc_carte();
104        });
105    });
106});

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.