PageSourceSearch

https://www.idylcar.fr/wp-content/themes/idylcar/assets/scripts/custom-libs/list_gmaps.js?ver=1.2.5

js idylcar.fr collected 2026-10-06 15:22:54 UTC 15,696 bytes, 311 lines download raw bytes

1let map;
2
3function initMap() {
4    // Custom styles Map
5    let styles = [
6        {
7        "featureType": "landscape",
8        "stylers": [
9            { "color": "#53a3f6" }
10        ]
11    },{
12        "featureType": "road.local",
13        "elementType": "geometry.fill",
14        "stylers": [
15            { "color": "#3b73af" },
16            { "visibility": "on" }
17        ]
18    },{
19        "featureType": "road.arterial",
20        "elementType": "geometry.fill",
21        "stylers": [
22            { "color": "#3b73af" }
23        ]
24    },{
25        "featureType": "road",
26        "elementType": "labels.text.fill",
27        "stylers": [
28            { "color": "#000000" }
29        ]
30    },{
31        "featureType": "road.local",
32        "stylers": [
33            { "weight": 1.3 },
34            { "visibility": "on" }
35        ]
36    },{
37        "featureType": "road.local",
38        "elementType": "labels",
39        "stylers": [
40            { "visibility": "on" }
41        ]
42    },{
43        "featureType": "road.highway",
44        "elementType": "geometry.fill",
45        "stylers": [
46            { "color": "#3b73b0" }
47        ]
48    },{
49        "featureType": "administrative.locality",
50        "elementType": "labels.text.fill",
51        "stylers": [
52            { "color": "#000000" }
53        ]
54    },{
55        "featureType": "administrative.locality",
56        "stylers": [
57            { "visibility": "on" }
58        ]
59    },{
60        "featureType": "water",
61        "elementType": "labels",
62        "stylers": [
63            { "visibility": "off" }
64        ]
65    },{
66        "featureType": "water",
67        "elementType": "geometry",
68        "stylers": [
69            { "color": "#c4def6" }
70        ]
71    },{
72        "elementType": "geometry.stroke",
73        "stylers": [
74            { "visibility": "off" }
75        ]
76    },{
77        "elementType": "labels.text.stroke",
78        "stylers": [
79            { "visibility": "on" }
80        ]
81    },{
82        "featureType": "road",
83        "elementType": "labels",
84        "stylers": [
85            { "visibility": "off" }
86        ]
87    },{
88        "featureType": "administrative.country",
89        "stylers": [
90            { "visibility": "on" }
91        ]
92    },{
93        "featureType": "administrative",
94        "elementType": "labels.text.fill",
95        "stylers": [
96            { "color": "#000" }
97        ]
98    }];
99
100    //on centre la map
101    var centermap = new google.maps.LatLng(46.1106885,2.5911028);
102
103    //options de la map
104    var options = {
105        zoom: 5,
106        scrollwheel: true,
107        zoomControl: true,
108        mapTypeControl: false,
109        scaleControl: false,
110        streetViewControl: false,
111        rotateControl: false,
112        fullscreenControl: false,
113        center: centermap,
114        styles: styles,
115        disableDefaultUI: true,
116    };
117
118    map = new google.maps.Map(document.getElementById("map"), options);
119
120    function getRandomCoordinate() {
121        // Coordonnées approximatives du rectangle délimitant la France continentale
122        var minLat = 41.3;
123        var maxLat = 51.1;
124        var minLng = -5.1;
125        var maxLng = 9.6;
126
127        // Génération de coordonnées aléatoires dans le rectangle délimitant la France
128        var lat = Math.random() * (maxLat - minLat) + minLat;
129        var lng = Math.random() * (maxLng - minLng) + minLng;
130
131        return { lat: lat, lng: lng };
132    }
133
134    let markers = [];
135
136    // Boucle pour ajouter les marqueurs
137    list_concessions.forEach(function(concessionInfo) {
138        if(concessionInfo.next == true){
139            let marker = new google.maps.Marker({
140                // position: getRandomCoordinate(),
141                position: {lat: parseFloat(concessionInfo.metadatas.latitude), lng: parseFloat(concessionInfo.metadatas.longitude)},
142                map: map,
143                title: concessionInfo.details.blogname,
144                icon: {
145                    url: object_name.templateUrl + '/assets/images/pin_concession.svg', // Chemin vers votre icône personnalisée
146                    scaledSize: new google.maps.Size(20, 20) // Taille de l'icône
147                },
148                metadatas: concessionInfo.metadatas,
149                details : concessionInfo.details
150            });
151
152            // Afficher l'infobulle lorsque le marqueur est cliqué
153            marker.addListener('click', function() {
154                markers.forEach(function(m) {
155                    m.setIcon({
156                        url: object_name.templateUrl + '/assets/images/pin_concession.svg',
157                        scaledSize: new google.maps.Size(20, 20)
158                    });
159                });
160                marker.setIcon({
161                    url: object_name.templateUrl + '/assets/images/pin_concession_focus.svg', // Nouvelle image
162                    scaledSize: new google.maps.Size(25, 25) // Nouvelle taille
163                });
164
165                function getDate() {
166                    let dayOfWeekEN = new Date().getDay();
167                    let dayofWeek = dayOfWeekEN - 1;
168                    if (dayofWeek < 0) {
169                        dayofWeek = 6; // Dimanche devient 6
170                    }
171                    if('schedule' in concessionInfo.metadatas) {
172                        let todaySchedule = JSON.parse(concessionInfo.metadatas?.schedule);
173                        let jours = {
174                            0: "lundi",
175                            1: "mardi",
176                            2: "mercredi",
177                            3: "jeudi",
178                            4: "vendredi",
179                            5: "samedi",
180                            6: "dimanche"
181                        };
182
183                        // Obtenir l'heure actuelle
184                        let now = new Date();
185                        let currentHour = now.getHours();
186                        let currentMinute = now.getMinutes();
187                        let currentTime = `${currentHour}:${currentMinute < 10 ? '0' + currentMinute : currentMinute}`;
188
189                        // Convertir l'heure en minutes depuis minuit pour une comparaison plus facile
190                        let timeToMinutes = time => {
191                            let [hours, minutes] = time.split(':').map(Number);
192                            return hours * 60 + minutes;
193                        };
194                        let currentTimeMinutes = timeToMinutes(currentTime);
195
196                        if(todaySchedule[dayofWeek].isOpen) {
197                            if (currentTimeMinutes >= timeToMinutes(todaySchedule[dayofWeek].schedule[0]) && currentTimeMinutes <= timeToMinutes(todaySchedule[dayofWeek].schedule[1])) {
198                                if(todaySchedule[dayofWeek].schedule.length > 2) {
199                                    return `
200                                <p class="title_horaire ouvert d-flex align-items-center">Ouvert</p>
201                                <p class="jours_horaire">
202                                    > ${todaySchedule[dayofWeek].schedule[0]} - ${todaySchedule[dayofWeek].schedule[1]} / ${todaySchedule[dayofWeek].schedule[2]} - ${todaySchedule[dayofWeek].schedule[3]}
203                                </p>
204                                `;
205                                } else {
206                                    return `
207                                <p class="title_horaire ouvert d-flex align-items-center">Ouvert</p>
208                                <p class="jours_horaire">
209                                    > ${todaySchedule[dayofWeek].schedule[0]} - ${todaySchedule[dayofWeek].schedule[1]}
210                                </p>
211                                `;
212                                }
213                            } else if (todaySchedule[dayofWeek].schedule.length > 2 && currentTimeMinutes >= timeToMinutes(todaySchedule[dayofWeek].schedule[2]) && currentTimeMinutes <= timeToMinutes(todaySchedule[dayofWeek].schedule[3])) {
214                                if(todaySchedule[dayofWeek].schedule.length > 2) {
215                                    return `
216                                <p class="title_horaire ouvert d-flex align-items-center">Ouvert</p>
217                                <p class="jours_horaire">
218                                    > ${todaySchedule[dayofWeek].schedule[0]} - ${todaySchedule[dayofWeek].schedule[1]} / ${todaySchedule[dayofWeek].schedule[2]} - ${todaySchedule[dayofWeek].schedule[3]}
219                                </p>
220                                `;
221                                } else {
222                                    return `
223                                <p class="title_horaire ouvert d-flex align-items-center">Ouvert</p>
224                                <p class="jours_horaire">
225                                    > ${todaySchedule[dayofWeek].schedule[0]} - ${todaySchedule[dayofWeek].schedule[1]}
226                                </p>
227                                `;
228                                }
229                            } else {
230                                if(todaySchedule[dayofWeek].schedule.length > 2) {
231                                    return `
232                                <p class="title_horaire fermee d-flex align-items-center">Fermé</p>
233                                <p class="jours_horaire">
234                                    > ${todaySchedule[dayofWeek].schedule[0]} - ${todaySchedule[dayofWeek].schedule[1]} / ${todaySchedule[dayofWeek].schedule[2]} - ${todaySchedule[dayofWeek].schedule[3]}
235                                </p>
236                                `;
237                                } else {
238                                    return `
239                                <p class="title_horaire ouvert d-flex align-items-center">Ouvert</p>
240                                <p class="jours_horaire">
241                                    > ${todaySchedule[dayofWeek].schedule[0]} - ${todaySchedule[dayofWeek].schedule[1]}
242                                </p>
243                                `;
244                                }
245                            }
246
247                        } else {
248                            let nextSchedule = dayofWeek + 1;
249                            nextSchedule %= 7; // Assurer que le jour suivant reste dans la plage 0-6
250                            while (!todaySchedule[nextSchedule].isOpen) {
251                                nextSchedule++;
252                                nextSchedule %= 7;
253                            }
254                            return `
255                            <p class="title_horaire fermee d-flex align-items-center">Fermé</p>
256                            <p class="jours_horaire">
257                                > Ouvre ${jours[nextSchedule]} à ${todaySchedule[nextSchedule].schedule[0]}
258                            </p>
259                        `;
260                        }
261                    }
262                    return `
263                        <p class="title_horaire d-flex align-items-center">Aucun horaire renseigné</p>
264                    `
265                }
266
267                document.getElementById('detail_map').innerHTML = `
268                <div class="card_detail_concession d-flex flex-row">
269                    <div class="left_detail col-6 d-flex flex-column">
270                        <h2 class="title_concession">${concessionInfo.details.blogname}</h2>
271                        <div class="horaires_concession d-flex flex-column justify-content-between align-items-start">
272                                ${getDate()}
273                        </div>
274                        <div class="adresse_concession d-flex flex-row align-items-center">
275                            <img class="adresse_concession_img" loading="lazy" src="${object_name.templateUrl}/assets/images/icons/location.svg" alt="pin adresse" />
276                            <p class="adresse_concession_text">${('address' in concessionInfo.metadatas) ? concessionInfo.metadatas.address + ', ' : ''} ${('zip_code' in concessionInfo.metadatas) ? concessionInfo.metadatas.zip_code : ''} ${('city' in concessionInfo.metadatas) ? concessionInfo.metadatas.city : ''}</p>
277                        </div>
278                    </div>
279                    <div class="right_detail col-6 d-flex flex-column justify-content-around align-items-center">
280                        <a href="${concessionInfo.details.idylcar_page_url}" class="btn-result btn btn-primary d-flex align-items-center">
281                        <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
282                                                                    <path d="M16.3243 13.6004C16.3243 13.8579 16.267 14.1226 16.1454 14.38C16.0239 14.6375 15.8665 14.8807 15.6591 15.1096C15.3086 15.4958 14.9224 15.7747 14.4861 15.9536C14.057 16.1324 13.5921 16.2253 13.0914 16.2253C12.3619 16.2253 11.5822 16.0537 10.7597 15.7032C9.93721 15.3528 9.11469 14.8807 8.29932 14.2871C7.4768 13.6863 6.69719 13.0211 5.95335 12.2844C5.21666 11.5406 4.55149 10.761 3.95784 9.94559C3.37135 9.13022 2.8993 8.31485 2.55598 7.50664C2.21267 6.69127 2.04102 5.91166 2.04102 5.16782C2.04102 4.68146 2.12684 4.21656 2.2985 3.78742C2.47016 3.35112 2.74195 2.95059 3.12102 2.59297C3.57877 2.14238 4.07943 1.92065 4.60871 1.92065C4.80897 1.92065 5.00924 1.96357 5.18805 2.0494C5.37401 2.13522 5.53851 2.26397 5.66726 2.44993L7.3266 4.78875C7.45534 4.96755 7.54832 5.13206 7.61269 5.28941C7.67707 5.43961 7.71283 5.58981 7.71283 5.7257C7.71283 5.89736 7.66276 6.06901 7.56263 6.23352C7.46965 6.39802 7.33375 6.56968 7.1621 6.74134L6.61852 7.30637C6.53984 7.38505 6.50408 7.47803 6.50408 7.59247C6.50408 7.64968 6.51123 7.69975 6.52554 7.75697C6.54699 7.81419 
2826.56845 7.8571 6.58276 7.90002C6.7115 8.13604 6.93322 8.44359 7.24792 8.81552C7.56978 9.18744 7.91309 9.56651 8.28501 9.94559C8.67124 10.3247 9.04316 10.6751 9.42224 10.997C9.79416 11.3117 10.1017 11.5263 10.3449 11.655C10.3807 11.6693 10.4236 11.6908 10.4736 11.7122C10.5309 11.7337 10.5881 11.7408 10.6524 11.7408C10.774 11.7408 10.867 11.6979 10.9457 11.6192L11.4893 11.0828C11.6681 10.904 11.8397 10.7681 12.0042 10.6823C12.1687 10.5821 12.3332 10.5321 12.5121 10.5321C12.6479 10.5321 12.791 10.5607 12.9483 10.6251C13.1057 10.6894 13.2702 10.7824 13.449 10.904L15.8164 12.5848C16.0024 12.7135 16.1311 12.8637 16.2098 13.0426C16.2813 13.2214 16.3243 13.4002 16.3243 13.6004Z" stroke="white" stroke-width="1.07285" stroke-miterlimit="10"></path>
283                                                                </svg>
284                                                                <span class="ps-2">Contacter</span></a>
285                        <a href="${concessionInfo.details.siteurl}" target="_blank" class="link-result fs-11px fw-700">Découvrir le site</a>
286                    </div>
287                </div>
288                `;
289
290                if(document.getElementsByClassName("search-dealer-form").length > 0){
291                    document.querySelectorAll('.search-dealer-item').forEach(function(element) {
292                        element.style.display = 'none';
293                    });
294                    document.querySelectorAll('.search-dealer-list .no-results').forEach(function(element) {
295                        element.style.display = 'none';
296                    });
297                    document.querySelectorAll('.select-region').forEach(function(element) {
298                        element.value = '';
299                    });
300                    document.querySelectorAll('.select-dept').forEach(function(element) {
301                        element.value = '';
302                    });
303                }
304            });
305            markers.push(marker);
306        }
307    });
308
309}
310
311window.initMap = initMap;

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.