PageSourceSearch

https://www.twodudes-brasserie.com/js/DEV/FUNCS/_two_contact.js?vers=341768

js twodudes-brasserie.com collected 2026-10-04 23:25:49 UTC 17,296 bytes, 590 lines download raw bytes

1var contact = new Object();
2
3contact.initAPI = false;
4
5contact.loadAPI = function () {
6
7    $("._btn_callback").addClass("_hide");
8
9    if (typeof google === 'object' && typeof google.maps === 'object') {
10        contact.map();
11    } else {
12        if (contact.initAPI === false) {
13            contact.initAPI = true;
14            $.when(
15                $.getScript("https://maps.googleapis.com/maps/api/js?key=AIzaSyCTtf61-B-ATkBpHLXOqJ_p5asD6DPg76o"),
16                $.Deferred(function (deferred) {
17                    $(deferred.resolve);
18                })
19            ).done(function () {
20                contact.map();
21            });
22        }
23    }
24
25};
26
27contact.detailSwipe;
28contact.swiper = function () {
29
30    contact.detailSwipe = new Swiper('.__swipe_copains', {
31        spaceBetween: 20,
32        slidesPerView: 3.6,
33        autoheight: true,
34        breakpoints: {
35            // when window width is >= 320px
36            320: {
37                slidesPerView: 1.2,
38                spaceBetween: 10
39            },
40            // when window width is >= 480px
41            480: {
42                slidesPerView: 1.6,
43                spaceBetween: 20
44            },
45            // when window width is >= 640px
46            700: {
47                slidesPerView: 2.1,
48                spaceBetween: 30
49            },
50            1200: {
51                slidesPerView: 2.6,
52            }
53        }
54    });
55}
56
57
58contact.init = function () {
59
60    if ($("input[name=_open_agence]").length > 0) {
61        var _agence_id = $("input[name=_open_agence]").val();
62        //alert(_agence_id);
63        //[data-id="+_agence_id+"]
64        //var _target = document.querySelector('[data-item="' + _agence_id + '"]');
65        //scroll.locomotiveScroll.scrollTo(_target, {offset: -100});
66
67        var _target = $("[data-item=" + _agence_id + "]");
68
69        //_target.addClass("__bg-blue_flash");
70
71        //console.log(_target);
72
73        if (_target.length > 0) {
74            //alert("-->");
75            _target.addClass("__bg-blue_flash");
76            _target.prev().addClass("_hide_line");
77            _target.find("._detail_item").slideDown(600, items.moveTo(_agence_id));
78            items.actual_item = _agence_id;
79        }
80
81    }
82
83    //contact.map();
84
85    $(document).on("click", "button[name=_submit_contact]", function (evt) {
86        evt.preventDefault();
87        evt.stopPropagation();
88        contact.submit(evt);
89    });
90
91};
92
93contact.submit = function (e) {
94
95    e.preventDefault();
96
97    var v = contact.check();
98    if (v === true) {
99        grecaptcha.ready(function () {
100            grecaptcha.execute('6LdW4wsbAAAAAE-95S30i7VNkFDdq_8WsITndTPs', {action: 'submit'}).then(function (token) {
101                //alert(token);
102                contact.send(token);
103            });
104        });
105    } else {
106        var msg_s = "<span>Votre formulaire est incomplet.<br> Merci de contrôler tous les champs obligatoires avant de valider.</span>";
107        $("._msg").html(msg_s);
108        $("._msg").addClass("_error");
109        $("._contact_msg").addClass("_show");
110    }
111
112};
113
114contact.check = function () {
115
116
117    $("input,textarea,select").removeClass("_error_field");
118    $(".__error_form").hide();
119    var _valid = true;
120    if ($("input[name=contact_nom]").val() == "") {
121        $("input[name=contact_nom]").addClass("_error_field");
122        _valid = false;
123    }
124
125    if ($("input[name=contact_prenom]").val() == "") {
126        $("input[name=contact_prenom]").addClass("_error_field");
127        _valid = false;
128    }
129
130    if ($("input[name=contact_phone]").val() == "") {
131        $("input[name=contact_phone]").addClass("_error_field");
132        _valid = false;
133    }
134
135    if ($("input[name=contact_mail]").val() == "") {
136        $("input[name=contact_mail]").addClass("_error_field");
137        _valid = false;
138    }
139
140    if ($("input[name=contact_raison]").val() == "") {
141        $("input[name=contact_raison]").addClass("_error_field");
142        _valid = false;
143    }
144
145    if ($("input[name=contact_pays]").val() == "") {
146        $("input[name=contact_pays]").addClass("_error_field");
147        _valid = false;
148    }
149
150    if ($("textarea[name=contact_msg]").val() == "") {
151        $("textarea[name=contact_msg]").addClass("_error_field");
152        _valid = false;
153    }
154
155
156    return _valid;
157
158};
159
160
161contact.send = function (token) {
162
163    var _raison = $("input[name=contact_raison]").val();
164    var _nom = $("input[name=contact_nom]").val();
165    var _prenom = $("input[name=contact_prenom]").val();
166    var _email = $("input[name=contact_mail]").val();
167    var _msg = $("textarea[name=contact_msg]").val();
168    var _phone = $("input[name=contact_phone]").val();
169    var _fax = $("input[name=contact_fax]").val();
170    var _adress = $("textarea[name=contact_adress]").val();
171    var _cp = $("input[name=contact_cp]").val();
172    var _ville = $("input[name=contact_ville]").val();
173    var _pays = $("input[name=contact_pays]").val();
174
175
176    var _datas = {
177        _token: token,
178        _raison: _raison,
179        _nom: _nom,
180        _prenom: _prenom,
181        _adress: _adress,
182        _cp: _cp,
183        _pays: _pays,
184        _ville: _ville,
185        _email: _email,
186        _msg: _msg,
187        _fax: _fax,
188        _phone: _phone
189    };
190
191    $.ajax({
192        type: "POST",
193        url: _SITE_URL + "send-contact",
194        data: _datas
195    })
196        .done(function (msg) {
197
198            //alert(msg);
199
200            // console.log(msg);
201            //
202            //return false;
203
204            if (msg != "success") {
205                var msg_s = "Votre message est incomplet <br> Merci de contrôler tous les champs obligatoires avant de valider";
206                $("._msg_contact").html(msg_s);
207                $("._msg_contact").addClass("_error _show");
208                $("._contact_msg").addClass("_show");
209                $("._contact_msg").css("display", "flex");
210                //contact.check();
211            } else {
212
213                $("input,textarea").val("");
214                // $("input[name=contact_nom]").val("");
215                // $("input[name=contact_prenom]").val("");
216                // $("input[name=contact_mail]").val("");
217                // $("input[name=contact_phone]").val("");
218                // $("textarea[name=contact_msg]").val("");
219
220
221                var msg_s = '<span class="_red">Merci.</span>\n' +
222                    '            <span>Le formulaire a bien été envoyé.</span>\n' +
223                    '            <span>Nous vous répondrons dans les plus brefs délais.</span>';
224                //$("._msg_contact").html(msg_s).removeClass("_error");
225
226                $("._contact_msg").find("._msg").html(msg_s).removeClass("_error").show();
227
228                $("._contact_msg").addClass("_show");
229                // setTimeout(function () {
230                //     $("._contact_msg").fadeOut();
231                //     common.scrollTop();
232                // }, 4500);
233            }
234        });
235
236};
237
238contact.map = function () {
239
240    var _w = $("._map").width();
241    $("._map").height(_w);
242
243    contact.initMAP = true;
244
245    var _lat = "46.244710";
246    var _lng = "4.776890";
247
248    var offsetX = 0.25; // move center one quarter map width left
249    var offsetY = 0.25; // move center one quarter map height down
250
251    // var span = map.getBounds().toSpan(); // a latLng - # of deg map spans
252    //
253    // var newCenter = {
254    //     lat: center.lat() + span.lat()*offsetY,
255    //     lng: center.lng() + span.lng()*offsetX
256    // };
257
258
259    var options = {
260        center: new google.maps.LatLng(_lat, _lng),
261        zoom: 14,
262        disableDefaultUI: true,
263        zoomControl: false,
264        scrollwheel: false,
265        styles: [
266            {
267                "featureType": "all",
268                "elementType": "geometry",
269                "stylers": [
270                    {
271                        "color": "#ffffff"
272                    }
273                ]
274            },
275            {
276                "featureType": "all",
277                "elementType": "labels.text",
278                "stylers": [
279                    {
280                        "visibility": "simplified"
281                    }
282                ]
283            },
284            {
285                "featureType": "all",
286                "elementType": "labels.text.fill",
287                "stylers": [
288                    {
289                        "gamma": 0.01
290                    },
291                    {
292                        "lightness": 20
293                    }
294                ]
295            },
296            {
297                "featureType": "all",
298                "elementType": "labels.text.stroke",
299                "stylers": [
300                    {
301                        "saturation": -31
302                    },
303                    {
304                        "lightness": -33
305                    },
306                    {
307                        "weight": 2
308                    },
309                    {
310                        "gamma": 0.8
311                    }
312                ]
313            },
314            {
315                "featureType": "all",
316                "elementType": "labels.icon",
317                "stylers": [
318                    {
319                        "visibility": "off"
320                    }
321                ]
322            },
323            {
324                "featureType": "administrative",
325                "elementType": "labels.text",
326                "stylers": [
327                    {
328                        "visibility": "simplified"
329                    }
330                ]
331            },
332            {
333                "featureType": "landscape",
334                "elementType": "geometry",
335                "stylers": [
336                    {
337                        "lightness": 30
338                    },
339                    {
340                        "saturation": 30
341                    }
342                ]
343            },
344            {
345                "featureType": "landscape",
346                "elementType": "labels.text",
347                "stylers": [
348                    {
349                        "visibility": "simplified"
350                    }
351                ]
352            },
353            {
354                "featureType": "landscape.man_made",
355                "elementType": "all",
356                "stylers": [
357                    {
358                        "visibility": "off"
359                    }
360                ]
361            },
362            {
363                "featureType": "landscape.man_made",
364                "elementType": "labels.text",
365                "stylers": [
366                    {
367                        "visibility": "simplified"
368                    }
369                ]
370            },
371            {
372                "featureType": "landscape.natural",
373                "elementType": "labels.text",
374                "stylers": [
375                    {
376                        "visibility": "simplified"
377                    }
378                ]
379            },
380            {
381                "featureType": "poi",
382                "elementType": "geometry",
383                "stylers": [
384                    {
385                        "saturation": 20
386                    }
387                ]
388            },
389            {
390                "featureType": "poi",
391                "elementType": "labels.text",
392                "stylers": [
393                    {
394                        "visibility": "simplified"
395                    }
396                ]
397            },
398            {
399                "featureType": "poi.park",
400                "elementType": "geometry",
401                "stylers": [
402                    {
403                        "lightness": 20
404                    },
405                    {
406                        "saturation": -20
407                    },
408                    {
409                        "visibility": "on"
410                    },
411                    {
412                        "color": "#f0f0f0"
413                    }
414                ]
415            },
416            {
417                "featureType": "road",
418                "elementType": "all",
419                "stylers": [
420                    {
421                        "visibility": "on"
422                    }
423                ]
424            },
425            {
426                "featureType": "road",
427                "elementType": "geometry",
428                "stylers": [
429                    {
430                        "lightness": 10
431                    },
432                    {
433                        "saturation": -30
434                    }
435                ]
436            },
437            {
438                "featureType": "road",
439                "elementType": "geometry.stroke",
440                "stylers": [
441                    {
442                        "saturation": 25
443                    },
444                    {
445                        "lightness": 25
446                    }
447                ]
448            },
449            {
450                "featureType": "road",
451                "elementType": "labels.text",
452                "stylers": [
453                    {
454                        "visibility": "simplified"
455                    }
456                ]
457            },
458            {
459                "featureType": "road",
460                "elementType": "labels.icon",
461                "stylers": [
462                    {
463                        "visibility": "off"
464                    }
465                ]
466            },
467            {
468                "featureType": "road.highway",
469                "elementType": "geometry.stroke",
470                "stylers": [
471                    {
472                        "visibility": "on"
473                    },
474                    {
475                        "color": "#000000"
476                    }
477                ]
478            },
479            {
480                "featureType": "road.highway",
481                "elementType": "labels.icon",
482                "stylers": [
483                    {
484                        "visibility": "off"
485                    },
486                    {
487                        "hue": "#ff6000"
488                    }
489                ]
490            },
491            {
492                "featureType": "road.arterial",
493                "elementType": "geometry.stroke",
494                "stylers": [
495                    {
496                        "color": "#000000"
497                    }
498                ]
499            },
500            {
501                "featureType": "road.local",
502                "elementType": "all",
503                "stylers": [
504                    {
505                        "visibility": "on"
506                    }
507                ]
508            },
509            {
510                "featureType": "road.local",
511                "elementType": "geometry.stroke",
512                "stylers": [
513                    {
514                        "color": "#000000"
515                    }
516                ]
517            },
518            {
519                "featureType": "road.local",
520                "elementType": "labels.text",
521                "stylers": [
522                    {
523                        "visibility": "simplified"
524                    }
525                ]
526            },
527            {
528                "featureType": "water",
529                "elementType": "all",
530                "stylers": [
531                    {
532                        "lightness": -20
533                    }
534                ]
535            },
536            {
537                "featureType": "water",
538                "elementType": "geometry",
539                "stylers": [
540                    {
541                        "color": "#dddddd"
542                    }
543                ]
544            }
545        ]
546
547    };
548
549    var map = new google.maps.Map(document.getElementById("__map"), options);
550
551
552    var __icon = _SITE_URL + 'img/SITE/CONTACT/_marker.png?v=5';
553
554    console.log(__icon);
555
556
557    var icon = {
558        url: __icon,
559        scaledSize: new google.maps.Size(80, 107), // scaled size
560        origin: new google.maps.Point(0, 0), // origin
561        anchor: new google.maps.Point(40, 100) // anchor
562    };
563
564    var marker = new google.maps.Marker({
565        position: new google.maps.LatLng(_lat, _lng),
566        icon: icon,
567        map: map
568    });
569
570    marker.addListener('click', function () {
571        window.open('https://www.google.com/maps/place/Two+Dudes+Brasserie/@46.2444527,4.7742471,17z/data=!3m1!4b1!4m6!3m5!1s0x47f37b0034526043:0xab34c581109f12a0!8m2!3d46.244449!4d4.776822!16s%2Fg%2F11vr7xljn9?entry=ttu', '_blank');
572    });
573
574
575    ///////////////////////////////////////////////////////////////////
576
577    // $(document).on("click", "button[name=_submit_contact]", function (evt) {
578    //   evt.preventDefault();
579    //   evt.stopPropagation();
580    //   contact.submit(evt);
581    // });
582
583
584};
585
586contact.out = function () {
587    $(document).off("click", "button[name=_submit_contact]");
588}
589
590

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.