PageSourceSearch

https://www.labastide-du-vert.fr/wp-content/plugins/ibtana-visual-editor/dist/js/map.js?ver=1.2.6.2

js labastide-du-vert.fr collected 2026-10-03 02:46:55 UTC 3,958 bytes, 93 lines download raw bytes

1jQuery(function ($) {
2
3    if (typeof loadScriptAsync === 'undefined') {
4        function loadScriptAsync(src) {
5            return new Promise((resolve, reject) => {
6                const tag = document.createElement('script');
7                tag.src = src;
8                tag.async = true;
9                tag.onload = () => {
10                    resolve();
11                };
12                const firstScriptTag = document.getElementsByTagName('script')[0];
13                firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
14            });
15        }
16    }
17
18    //GOOGLE MAP BLOCK
19    $('.ive-google-map:not(.ive-google-map-ready)').each(function () {
20        const $mapItem = $(this);
21        $mapItem.addClass('ive-google-maps-ready');
22        const apiKey = $mapItem.attr('data-apiKey');
23        const apiURL = 'https://maps.googleapis.com/maps/api/js?v=3&sensor=true&libraries=places&key=' + apiKey;
24
25        if (typeof google === 'object' && typeof google.maps === 'object') {
26            initIveGoogleMap($mapItem);
27        } else {
28            loadScriptAsync(apiURL).then(() => {
29                initIveGoogleMap($mapItem);
30            });
31        }
32    });
33
34    //INIT GOOGLE MAP
35    function initIveGoogleMap($mapItem) {
36        let styles = '';
37        try {
38            styles = JSON.parse($mapItem.attr('data-styles'));
39        } catch (e) { }
40        const mapOptions = {
41            zoom: parseInt($mapItem.attr('data-zoom'), 10),
42            zoomControl: 'true' === $mapItem.attr('data-show-zoom-buttons'),
43            zoomControlOpt: {
44                style: 'DEFAULT',
45                position: 'RIGHT_BOTTOM',
46            },
47            mapTypeControl: 'true' === $mapItem.attr('data-show-map-type-buttons'),
48            streetViewControl: 'true' === $mapItem.attr('data-show-street-view-button'),
49            fullscreenControl: 'true' === $mapItem.attr('data-show-fullscreen-button'),
50            draggable: 'true' === $mapItem.attr('data-option-draggable'),
51            styles: styles,
52        }
53        const map = new google.maps.Map($mapItem[0], mapOptions);
54        var request = {
55            placeId: $mapItem.attr('data-placeID'),
56            fields: ['place_id', 'geometry', 'name', 'formatted_address', 'adr_address', 'website']
57        };
58
59        const service = new google.maps.places.PlacesService(map);
60        service.getDetails(request, (place, status) => {
61            if (status === google.maps.places.PlacesServiceStatus.OK) {
62
63                if (place.geometry.viewport) {
64                    map.fitBounds(place.geometry.viewport);
65                } else {
66                    map.setCenter(place.geometry.location);
67                }
68                let markerOption = { map: map }
69                const iconPointer = $mapItem.attr('data-icon-pointer');
70                if (iconPointer) markerOption.icon = iconPointer;
71                const marker = new google.maps.Marker(markerOption);
72                // Set the position of the marker using the place ID and location.
73                marker.setPlace({
74                    placeId: place.place_id,
75                    location: place.geometry.location
76                });
77                ('true' === $mapItem.attr('data-show-marker')) ? marker.setVisible(true) : marker.setVisible(false);
78
79                const contentString = '<div class="ive-gmap-marker-window"><div class="ive-gmap-marker-place">' + place.name + '</div><div class="ive-gmap-marker-address">' +
80                    place.adr_address + '</div>' +
81                    '<div class="ive-gmap-marker-url"><a href="' + place.website + '" target="_blank">' + place.website + '</a></div></div>';
82
83                const infowindow = new google.maps.InfoWindow({
84                    content: contentString
85                });
86                marker.addListener('click', () => {
87                    infowindow.open(map, marker);
88                });
89            }
90        });
91    }
92
93});

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.