PageSourceSearch

https://ensembleici.fr/js/frontend.js?t=1790949182

js ensembleici.fr collected 2026-10-02 13:53:09 UTC 18,648 bytes, 538 lines download raw bytes

1// $('iframe').each(function() {
2//     var elt = $(this);
3//     var ratio = elt.width() / elt.height();
4//     var limite = parseInt(elt.attr('width'));
5//     var largeur = Math.min(elt.parent().width(), limite);
6//     elt.width(largeur).height(largeur / ratio);
7// });
8
9if (typeof $('.select2').val() != 'undefined'){
10    $('.select2').select2();
11}
12// ***** GESTION DU MENU SLIDEBAR *****
13const $menu = $('#slideBar');
14$(document).mouseup(e => {
15    if (!$menu.is(e.target) && $menu.has(e.target).length === 0) {
16        //$menu.removeClass('is-active');
17        if ($menu.hasClass('open-slide')) {
18            $('#slideBar').hide('slide', {direction: 'left'}, 1000);
19            $('#slideBar').removeClass('open-slide');
20        }
21    }
22});
23$('#openSlideMenu').on('click', function(e) {
24    e.preventDefault();
25    $('#slideBar').show('slide', {direction: 'left'}, 1000);
26    $('#slideBar').addClass('open-slide');
27})
28$('#openSlideMenuXs').on('click', function(e) {
29    e.preventDefault();
30    $('#slideBar').show('slide', {direction: 'left'}, 1000);
31    $('#slideBar').addClass('open-slide');
32})
33$('#closeSlideBar').on('click', function(e) {
34    e.preventDefault();
35    $('#slideBar').hide('slide', {direction: 'left'}, 1000);
36    $('#slideBar').removeClass('open-slide');
37})
38
39const $dropdown_show_account = $('#dropdown_show_account');
40$(document).mouseup(e => {
41    if (!$dropdown_show_account.is(e.target) && !$('#show_account').is(e.target) && $dropdown_show_account.has(e.target).length === 0) {
42        $('#dropdown_show_account').slideUp(500);
43    }
44});
45$('div[name=show_account]').on('click', function() {
46    $('#dropdown_show_account').slideDown(500);
47})
48const $dropdown_show_account2 = $('#dropdown_show_account2');
49$(document).mouseup(e => {
50    if (!$dropdown_show_account2.is(e.target) && !$('#show_account2').is(e.target) && $dropdown_show_account2.has(e.target).length === 0) {
51        $('#dropdown_show_account2').slideUp(500);
52    }
53});
54$('div[name=show_account2]').on('click', function() {
55    $('#dropdown_show_account2').slideDown(500);
56})
57
58// **** GESTION DU POP-UP LOCALISATION ******
59const $localisation = $('#localisationModal');
60$(document).mouseup(e => {
61    if (!$localisation.is(e.target) && $localisation.has(e.target).length === 0) {
62        if ($localisation.hasClass('open-localisation')) {
63            var display_none = "display: none;";
64            if ($('#ui-id-1').attr('style').indexOf(display_none) != -1) {
65                $('#localisationModal').hide();
66                $('#localisationModal').removeClass('open-localisation');
67            }
68            // else {
69            //     alert($('#token-id').html());
70            // }
71        }
72    }
73});
74$('#view-localisation').on('click', function(e) {
75    e.preventDefault();
76    $('#localisationModal').show();
77    $('#localisationModal').addClass('open-localisation');
78})
79
80$('#closeLocalisationModal').on('click', function(e){
81    e.preventDefault();
82    $('#localisationModal').hide();
83    $('#localisationModal').removeClass('open-localisation');
84})
85
86$('#connexionAccueil').on('click', function(e) {
87    e.preventDefault();
88    $('#localisationModal').show();
89    $('#localisationModal').addClass('open-localisation');
90})
91$('#connexionAccueilXs').on('click', function(e) {
92    e.preventDefault();
93    $('#localisationModal').show();
94    $('#localisationModal').addClass('open-localisation');
95})
96
97if (typeof $('#localisationMember').val() != 'undefined') {
98    $tokenField = $('#localisationMember');
99    $tokenField.tokenfield({
100        autocomplete: {
101            source: $tokenField.data('url'),
102            minLength: 2,
103            delay: 100,
104            limit: 1
105        },
106        showAutocompleteOnFocus: true
107    })
108}
109
110if (typeof $('#localisationInfo').val() != 'undefined') {
111    $tokenField = $('#localisationInfo');
112    $tokenField.tokenfield({
113        autocomplete: {
114            source: $tokenField.data('url'),
115            minLength: 2,
116            delay: 100,
117            limit: 1
118        },
119        limit: 1,
120        showAutocompleteOnFocus: true
121    })
122}
123if (typeof $('#localisationWidget').val() != 'undefined') {
124    $tokenField = $('#localisationWidget');
125    $tokenField.tokenfield({
126        autocomplete: {
127            source: $tokenField.data('url'),
128            minLength: 2,
129            delay: 100,
130            limit: 1
131        },
132        limit: 1,
133        showAutocompleteOnFocus: true
134    })
135}
136
137if (typeof $('#linkOtherEvt').val() != 'undefined') {
138    $tokenField = $('#linkOtherEvt');
139    $tokenField.tokenfield({
140        autocomplete: {
141            source: $tokenField.data('url'),
142            minLength: 2,
143            delay: 100,
144            limit: 1
145        },
146        showAutocompleteOnFocus: true
147    })
148}
149
150if (typeof $('#linkOtherStructure').val() != 'undefined') {
151    $tokenField = $('#linkOtherStructure');
152    $tokenField.tokenfield({
153        autocomplete: {
154            source: $tokenField.data('url'),
155            minLength: 2,
156            delay: 100,
157            limit: 1
158        },
159        showAutocompleteOnFocus: true
160    })
161}
162
163// **** GESTION DU POP-UP CONNEXION ******
164const $connexion = $('#connexionModal');
165$(document).mouseup(e => {
166    if (!$connexion.is(e.target) && $connexion.has(e.target).length === 0) {
167        if ($connexion.hasClass('open-connexion')) {
168            $('#connexionModal').hide();
169            $('#connexionModal').removeClass('open-connexion');
170        }
171    }
172});
173$('a[name=link_connexion]').on('click', function() {
174    $('#connexionModal').show();
175    $('#connexionModal').addClass('open-connexion');
176})
177$('#closeConnexionModal').on('click', function(e){
178    e.preventDefault();
179    $('#connexionModal').hide();
180    $('#connexionModal').removeClass('open-connexion');
181})
182
183const $forgetpassword = $('#forgetPasswordModal');
184$(document).mouseup(e => {
185    if (!$forgetpassword.is(e.target) && $forgetpassword.has(e.target).length === 0) {
186        if ($forgetpassword.hasClass('open-forget-password')) {
187            $('#forgetPasswordModal').hide();
188            $('#forgetPasswordModal').removeClass('open-forget-password');
189        }
190    }
191});
192$('a[name=forgetPasswordLink]').on('click', function() {
193    $('#connexionModal').hide();
194    $('#forgetPasswordModal').show();
195    $('#forgetPasswordModal').addClass('open-forget-password');
196})
197
198$('#closeForgetPasswordModal').on('click', function(e) {
199    e.preventDefault();
200    $('#forgetPasswordModal').hide();
201    $('#forgetPasswordModal').removeClass('open-forget-password');
202})
203
204$('#slideToTop').on('click', function(){
205    $('html,body').animate({scrollTop:0},1000);
206})
207$(window).scroll(function() {
208    if ($(window).scrollTop() > 10) {
209        $('#slideToTop').show();
210    } else {
211        $('#slideToTop').hide();
212    }
213})
214
215// ************* VISUALISATION DES CHAMPS PASSWORD ****************
216$('span[name=see_password]').on('mousedown', function(){
217    // $('#pwd_create_account').attr('type', 'text');
218    $('input[name=password]').attr('type', 'text');
219})
220$('span[name=see_password]').on('mouseup', function(){
221    // $('#pwd_create_account').attr('type', 'password');
222    $('input[name=password]').attr('type', 'password');
223})
224
225$('span[name=see_confirm_password]').on('mousedown', function(){
226    // $('#pwd_confirm_create_account').attr('type', 'text');
227    $('input[name=confirm-password]').attr('type', 'text');
228    $('input[name=password_confirmation]').attr('type', 'text');
229})
230$('span[name=see_confirm_password]').on('mouseup', function(){
231    // $('#pwd_confirm_create_account').attr('type', 'password');
232    $('input[name=confirm-password]').attr('type', 'password');
233    $('input[name=password_confirmation]').attr('type', 'password');
234})
235
236$('#see_password_connect').on('mousedown', function(){
237    $('#pwd_connect_account').attr('type', 'text');
238})
239$('#see_password_connect').on('mouseup', function(){
240    $('#pwd_connect_account').attr('type', 'password');
241})
242
243
244$('button[name=see_perso_part]').on('click', function(){
245    var ref = $(this).data('ref');
246    $('div[name=perso_part]').hide();
247    $('#perso_' + ref).show();
248    var hauteur = $('#perso_' + ref).offset().top - 50;
249    $('html,body').animate({scrollTop:hauteur},1000);
250})
251
252
253
254// APPELS API CONNEXION
255$('#btnSendLinkReinitPassword').on('click', function(e){
256    e.preventDefault();
257    if ($('#emailReinitPassword').val() == '') {
258        $('#modal-infos-body').html("Vous devez renseigner une adresse email ou un pseudo");
259        $('#modal-infos').modal('show'); return;
260    }
261
262    var url = $('#route_for_send_link_reinit_password').html();
263    $.ajax({
264        url: url,
265        type: 'POST',
266        data: {
267            email: $('#emailReinitPassword').val()
268        },
269        dataType: 'JSON',
270        success: function (data) {
271            $('#forgetPasswordModal').hide();
272            $('#modal-infos-body').html("Un lien de réinitialisation du mot de passe vous a été envoyé par email. Veuillez consulter votre messagerie pour terminer la procédure.");
273            $('#modal-infos').modal('show');
274        },
275        error: function (e) {
276            $('#forgetPasswordModal').hide();
277            $('#modal-infos-body').html("Une erreur est survenue lors de l'envoi du mail de réinitialisation. Code erreur: " + e.responseText);
278            $('#modal-infos').modal('show');
279            // console.log(e.responseText);
280        }
281    });
282})
283
284
285
286$('#acceptationCookies').on('click', function() {
287    var url = $('#route_for_acceptation_cookies').html();
288    $.ajax({
289        url: url,
290        type: 'POST',
291        data: {
292        },
293        dataType: 'JSON',
294        success: function (data) {
295            $('#bandeau-cookies').hide();
296        },
297        error: function (e) {
298            // console.log(e.responseText);
299        }
300    });
301})
302
303$('a[name=changeFontToDys]').on('click', function() {
304    const url = $('#route_for_change_font_to_dys').html();
305    $.ajax({
306        url: url,
307        type: 'POST',
308        data: {
309        },
310        dataType: 'JSON',
311        success: function (data) {
312            $(location).attr('href', $(location).attr('href'));
313        },
314        error: function (e) {
315            console.log(e.responseText);
316        }
317    });
318})
319
320$('a[name=changeFontToNormal]').on('click', function() {
321    const url = $('#route_for_change_font_to_normal').html();
322    $.ajax({
323        url: url,
324        type: 'POST',
325        data: {
326        },
327        dataType: 'JSON',
328        success: function (data) {
329            $(location).attr('href', $(location).attr('href'));
330        },
331        error: function (e) {
332            console.log(e.responseText);
333        }
334    });
335})
336
337
338$('#manageNewsletterSubscription').on('click', function() {
339    // on cherche tous les territories
340    $('#territoriesManageNewsletter').html('');
341    var url = $('#route_for_get_territories_for_newsletter_subscription').html();
342    $.ajax({
343        url: url,
344        type: 'POST',
345        data: {
346        },
347        dataType: 'JSON',
348        success: function (data) {
349            $.each(data.territories, function(key, value) {
350                let chaine = "<div class='form-check'><label class='form-check-label'>";
351                chaine += "<input name='territories_for_subscription' class='form-check-input' type='checkbox' value='" + value.id + "'>";
352                chaine += value.name;
353                chaine += "</label></div>";
354                $('#territoriesManageNewsletter').append(chaine);
355            });
356            $('#modal-manage-newsletter-subscription').modal('show');
357        },
358        error: function (e) {
359            console.log(e.responseText);
360        }
361    });
362})
363
364$('#btnInscriptionNewsletterModal').on('click', function() {
365    if ($('#emailInscriptionNewsletterModal').val() === '') {
366        $('#modal-infos-body').html("Vous devez renseigner une adresse email pour vous inscrire aux newsletter");
367        $('#modal-infos').modal('show'); return;
368    }
369
370    let terrtitories_selected = [];
371    $('input[name=territories_for_subscription]').each(function() {
372        if ($(this).is(':checked')) {
373            terrtitories_selected.push($(this).val());
374        }
375    })
376
377    let url = $('#route_for_inscription_newsletter').html();
378    $.ajax({
379        url: url,
380        type: 'POST',
381        data: {
382            territories: terrtitories_selected,
383            email: $('#emailInscriptionNewsletterModal').val()
384        },
385        dataType: 'JSON',
386        success: function (data) {
387            if (data.code == '0') {
388                $('#modal-manage-newsletter-subscription').modal('hide');
389                $('#modal-infos-body').html("Votre inscription aux newsletter a bien été prise en compte");
390                $('#modal-infos').modal('show');
391            } else {
392                switch(data.code) {
393                    case '10': alert("L'adresse email indiquée est incorrecte. Veuillez la modifier."); break;
394                    default: alert("Une erreur est survenue lors de l'inscription. Veuillez essayer de nouveau."); break;
395                }
396            }
397        },
398        error: function (e) {
399            console.log(e.responseText);
400        }
401    });
402})
403
404$(document).on("click", "div[name=addInformationToBookmark]", function(e){
405    e.preventDefault();
406    let ref = $(this).data('ref');
407
408    let url = $('#route_for_add_information_to_bookmark').html();
409    $.ajax({
410        url: url,
411        type: 'POST',
412        data: {
413            information: ref
414        },
415        dataType: 'JSON',
416        success: function (data) {
417            switch (data.code) {
418                case '0': $('#modal-infos-body').html("Cette information a bien été ajoutée à vos favoris"); break;
419                case '10': $('#modal-infos-body').html("Une erreur est survenue lors de la récupération de l'information. Veuillez essayer de nouveau ou signalez-nous le problème."); break;
420                case '20': $('#modal-infos-body').html("Veuillez-vous connecter pour enregistrer cette information dans vos favoris."); break;
421                case '30': $('#modal-infos-body').html("Une erreur est survenue lors de l'enregistrement de l'information dans vos favoris. Veuillez essayer de nouveau ou signalez-nous le problème."); break;
422                default: $('#modal-infos-body').html("Une erreur est survenue. Veuillez essayer de nouveau ou signalez-nous le problème."); break;
423            }
424            $('#modal-infos').modal('show');
425        },
426        error: function (e) {
427            console.log(e.responseText);
428        }
429    });
430})
431
432$('#myBookmarksNotConnected').on('click', function() {
433    $('#modal-infos-body').html("Vous devez vous connecter pour afficher vos favoris.");
434    $('#modal-infos').modal('show');
435})
436
437$('#myPostsNotConnected').on('click', function() {
438    $('#modal-infos-body').html("Vous devez vous connecter pour afficher vos publications.");
439    $('#modal-infos').modal('show');
440})
441
442$('button[name=deleteBookmark]').on('click', function() {
443    let ref = $(this).data('ref');
444    let member = $(this).data('member');
445    $('#information-confirm-delete-bookmark').html(ref);
446    $('#member-confirm-delete-bookmark').html(member);
447    $('#modal-confirm-delete-bookmark').modal('show');
448})
449
450$('#btnConfirmDeleteBookmark').on('click', function() {
451    let information = $('#information-confirm-delete-bookmark').html();
452    let member = $('#member-confirm-delete-bookmark').html();
453    let url = $('#route_for_delete_bookmark').html();
454    $.ajax({
455        url: url,
456        type: 'POST',
457        data: {
458            information: information,
459            member: member
460        },
461        dataType: 'JSON',
462        success: function (data) {
463            if (data.code == '0') {
464                $(location).attr('href', $(location).attr('href'));
465            } else {
466                $('#modal-infos-body').html("Une erreur est survenue lors de la suppression du favori");
467                $('#modal-infos').modal('show');
468            }
469        },
470        error: function (e) {
471            console.log(e.responseText);
472        }
473    });
474})
475
476
477$('#createAccount').on('click', function() {
478    if ($('#email_create_account').val() == '') {
479        $('#modal-infos-body').html("L'adresse email doit être renseignée");
480        $('#modal-infos').modal('show'); $('#connexionModal').show(); return;
481    }
482    if ($('#password_create_account').val() == '') {
483        $('#modal-infos-body').html("Le mot de passe doit être renseigné");
484        $('#modal-infos').modal('show'); $('#connexionModal').show(); return;
485    } else {
486        if ($('#password_create_account').val().length < 6) {
487            $('#modal-infos-body').html("Le mot de passe doit avoir une longueur minimum de 6");
488            $('#modal-infos').modal('show'); $('#connexionModal').show(); return;
489        }
490    }
491    if ($('#password_create_account').val() !== $('#confirm_password_create_account').val()) {
492        $('#modal-infos-body').html("Les deux saisies du mot de passe ne sont pas concordantes");
493        $('#modal-infos').modal('show'); $('#connexionModal').show(); return;
494    }
495
496    let url = $('#route_for_create_account').html();
497    $.ajax({
498        url: url,
499        type: 'POST',
500        data: {
501            pseudo: $('#pseudo_create_account').val(),
502            email: $('#email_create_account').val(),
503            password: $('#password_create_account').val()
504        },
505        dataType: 'JSON',
506        success: function (data) {
507            if (data.code == 0) {
508                let newurl = $('#url_espace_personnel').html();
509                $(location).attr('href', newurl);
510            } else {
511                switch (data.code) {
512                    case '10': $('#modal-infos-body').html("L'adresse email saisie est incorrecte"); break;
513                    case '20': $('#modal-infos-body').html("Un membre possédant cette adresse email est déjà enregistré"); break;
514                    case '30': $('#modal-infos-body').html("Un membre possédant ce pseudo est déjà enregistré"); break;
515                    default: $('#modal-infos-body').html("Une erreur s'est produite lors de la création du compte"); break;
516                }
517                $('#modal-infos').modal('show');
518            }
519        },
520        error: function (e) {
521            console.log(e.responseText);
522        }
523    });
524})
525
526
527if (typeof $('#structure_town_id').html() != 'undefined') {
528    $('#token-id').html($('#structure_town_id').html());
529}
530
531if (typeof $('#publication_town_id').html() != 'undefined') {
532    $('#token-id').html($('#publication_town_id').html());
533}
534
535$('span[name=erase]').on('click', function() {
536    $(this).parent().parent().parent().find('input').val('');
537})
538

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.