PageSourceSearch

https://www.hautesterres.fr/wp-content/themes/hautes-terres/js/scripts.js?1791231214

js hautesterres.fr collected 2026-10-05 20:14:00 UTC 12,179 bytes, 276 lines download raw bytes

1jQuery(document).ready(function ($) {
2    //Simulateur
3    if($('.simulateur-form').length > 0){
4        $('.simulateur__validator').click(function(){
5            // Vérifie si le champ est vide
6            if ($('#quotien').val() === '') {
7                // Ajoute une bordure rouge
8                $('#quotien').css('border', '2px solid red');
9    
10                // Vérifie si le message d'erreur existe déjà
11                if ($('#error-message').length === 0) {
12                    // Crée et insère le message d'erreur après le champ
13                    $('<div id="error-message" style="color: red; margin-top: 5px;">Ce champ est obligatoire.</div>')
14                        .insertAfter($('#quotien'));
15                }
16    
17                // Effet de secousse
18                $('#quotien').css('position', 'relative');
19                for (let i = 0; i < 3; i++) {
20                    $('#quotien').animate({ left: "-5px" }, 50)
21                            .animate({ left: "5px" }, 50);
22                }
23                $('#quotien').animate({ left: "0px" }, 50);
24    
25                // Stoppe l'exécution du reste du code
26                return;
27            }       
28
29
30            // Vérifie si aucune des deux cases n'est cochée
31            if (!$('#territoire_yes').is(':checked') && !$('#territoire_no').is(':checked')) {
32                // Ajoute une bordure rouge aux checkboxes
33                $('#territoire_yes').add($('#territoire_no')).css('outline', '2px solid red');
34
35                // Effet de secousse
36                for (let i = 0; i < 3; i++) {
37                    $('#territoire_yes').add($('#territoire_no'))
38                        .animate({ marginLeft: "-5px" }, 50)
39                        .animate({ marginLeft: "5px" }, 50);
40                }
41                $('#territoire_yes').add($('#territoire_no')).animate({ marginLeft: "0px" }, 50);
42
43                // Stoppe l'exécution du reste du code
44                return;
45            }
46            
47            // Vérifie si aucune des deux cases n'est cochée
48            if (!$('#jour').is(':checked') && !$('#semaine').is(':checked')) {
49                // Ajoute une bordure rouge aux checkboxes
50                $('#jour').add($('#semaine')).css('outline', '2px solid red');
51
52                // Effet de secousse
53                for (let i = 0; i < 3; i++) {
54                    $('#jour').add($('#semaine'))
55                        .animate({ marginLeft: "-5px" }, 50)
56                        .animate({ marginLeft: "5px" }, 50);
57                }
58                $('#jour').add($('#semaine')).animate({ marginLeft: "0px" }, 50);
59
60                // Stoppe l'exécution du reste du code
61                return;
62            }
63
64
65            $('.simulateur__results').fadeOut();
66
67            quotien = $('#quotien').val();
68            jour = 0;
69            semaine = 0;
70            if($('#jour:checked').length>0){jour = 1;}
71            if($('#semaine:checked').length>0){semaine = 1;}
72            territoire = 1;
73            if($('#territoire_no:checked').length > 0){territoire = 0;}
74            
75            data = {
76                action: 'calcul_tarif_alsh',
77                afp_nonce: afp_vars.afp_nonce,
78                quotien: quotien,
79                jour: jour,
80                semaine: semaine,
81                territoire: territoire
82            };
83            jQuery.ajax({
84                type: 'post',
85                dataType: 'json',
86                url: afp_vars.afp_ajax_url,
87                data: data,
88                success: function( data, textStatus, XMLHttpRequest ) {
89                    $('.simulateur__results').addClass('ok');
90                    $('.simulateur__results').html(data);
91                    $('.simulateur__results').fadeIn();
92                    console.log( textStatus );
93                    console.log( XMLHttpRequest );
94                },
95                error: function( MLHttpRequest, textStatus, errorThrown ) {
96                    $('.simulateur__results').addClass('error');
97                    $('.simulateur__results').fadeIn();
98                    $('.simulateur__results').html('Une erreur est survenue, merci de réessayer dans quelques minutes.');
99                    console.log( MLHttpRequest );
100                    console.log( textStatus );
101                    console.log( errorThrown );
102                }
103            })
104        });
105    }
106
107    $('#quotien').on('focus', function () {
108        // Supprime l'erreur et la bordure rouge lorsqu'on focus
109        $(this).css('border', '');
110        $('#error-message').remove();
111    });
112
113    $('#jour, #semaine').on('change', function () {
114        $('#jour').add($('#semaine')).css('outline', 'none');
115    });
116
117    $('#territoire_yes, #territoire_no').on('change', function () {
118        $('#territoire_yes').add($('#territoire_no')).css('outline', 'none');
119    });
120
121
122    $('#quotien').on('keypress', function (e) {
123        if (e.which === 13) { // 13 correspond à la touche Enter
124            e.preventDefault(); // Empêche l'envoi du formulaire si présent
125            $('.simulateur__validator').trigger('click');
126        }
127    });
128    
129
130    $('#menu_principal').addClass('is-closed');
131	$( "#icon_menu" ).click(function(){$('#menu_principal').toggleClass('is-closed');});
132	$('#myCarousel').carousel({ interval: 3000 });
133	$('.imageurs a').attr('rel','nofollow');
134    $('a[href=#home_content]').click(function(){var target = $(this).attr('href'); $('html, body').animate({scrollTop: $(target).offset().top}, 1000 );return false;});
135    
136    $('.Tabs a').click(function(e){ e.preventDefault(); $('.Tabs a').removeClass('On'); var Current = $(this).attr('class'); if($('.TabsContent').find('.'+Current).css('display')!="block"){ $(this).addClass('On'); $('.TabsContent div').hide(); $('.TabsContent').find('.'+Current).slideDown(400); }else{ $('.TabsContent div').slideUp(200); } });
137
138    /*$('.wpcf7-submit').click(function(){location = 'http://ht.imageurs.net/abonnement-magazine-hautes-terres/merci/';});*/
139    document.addEventListener( 'wpcf7mailsent', function( event ) {location = 'https://www.hautesterres.fr/abonnement-magazine-hautes-terres/merci/';}, false );
140
141
142    var screenWidth = $(window).width();
143    var screenHeight = $(window).height();
144    if(screenWidth > 1700){
145        $('.video-container').css('height',screenHeight);
146    }else if(screenWidth > 1430 && screenWidth < 1700){
147        videoHeight = $('.video-container video').height();
148        $('.video-container').css('height',videoHeight);
149    }
150
151    /* Allow switch carousel with fingers */
152    $("#big_carousel1").swiperight(function() {$(this).carousel('prev');});  
153    $("#big_carousel1").swipeleft(function() {$(this).carousel('next');});  
154
155    $("#big_carousel2").swiperight(function() {$(this).carousel('prev');});  
156    $("#big_carousel2").swipeleft(function() {$(this).carousel('next');});  
157
158    $("#big_carousel3").swiperight(function() {$(this).carousel('prev');});  
159    $("#big_carousel3").swipeleft(function() {$(this).carousel('next');});  
160
161    $("#big_carousel4").swiperight(function() {$(this).carousel('prev');});  
162    $("#big_carousel4").swipeleft(function() {$(this).carousel('next');});  
163
164    $("#big_carousel5").swiperight(function() {$(this).carousel('prev');});  
165    $("#big_carousel5").swipeleft(function() {$(this).carousel('next');});  
166
167    $("#big_carousel6").swiperight(function() {$(this).carousel('prev');});  
168    $("#big_carousel6").swipeleft(function() {$(this).carousel('next');});  
169
170    $("#big_carousel_cat").swiperight(function() {$(this).carousel('prev');});  
171    $("#big_carousel_cat").swipeleft(function() {$(this).carousel('next');});  
172
173    $('.close-peage').click(function(){
174        $('.peage').css('display', 'none');
175    });
176
177    $('a[href*="#"]').click(function(){var target = $(this).attr('href'); /*target = target.substring(31,80);*/ var offset = $(target).offset().top; offset = offset - 150; $('html, body').animate({scrollTop: offset}, 'slow'); return false;});
178
179    $('#tipi_role').bind("keyup", function(event){
180        if($(this).val().length==6){
181            if($(this).val()=="050707"){
182                $('.tipi-alert').fadeOut();
183                $('form#tipi_form_om').fadeIn();
184                $('form#tipi_form_htc').fadeOut();
185            }else if($(this).val()=="050695" || $(this).val()=="050706" || $(this).val()=="050708"){
186                $('.tipi-alert').fadeOut();
187                $('form#tipi_form_htc').fadeIn();
188                $('form#tipi_form_om').fadeOut();
189            }else{
190                $('.tipi-alert').html('Le code semble invalide. Les codes possibles sont 050695, 050706 050707 ou 050708');
191                $('.tipi-alert').fadeIn();
192                $('form#tipi_form_htc').fadeOut();
193                $('form#tipi_form_om').fadeOut();
194            }
195        }else{
196            $('.tipi-alert').fadeOut();
197        }
198    });
199    $('form#tipi_form_om').submit(function(e){
200        e.preventDefault();
201        numcli=$('#tipi_role').val();
202        exer=$('#exer_om').val();
203        rolrec=$('#rolrec_om').val()
204        roldeb=$('#roldeb_om').val()
205        roldet=$('#roldet_om').val()
206        nbCarac = exer.length + rolrec.length + roldeb.length + roldet.length;
207        nbCaracMinimum = 21;
208        nbCaracManquant = nbCaracMinimum - nbCarac;
209        ajoutde0 ="";
210        for (let pas = 0; pas < nbCaracManquant; pas++) {
211          ajoutde0 = ajoutde0 + '0'; 
212        }
213        refdet = exer + rolrec + roldeb + ajoutde0 + roldet;
214        
215        montant=$('#montant_euros_om').val()+$('#montant_cents_om').val();
216        mel=$('#mel_om').val();
217        url_finale = 'https://www.tipi.budget.gouv.fr/tpa/paiement.web?numcli='+numcli+'&exer='+exer+'&refdet='+refdet+'&objet=test&montant='+montant+'&mel='+mel+'&[email protected]&saisie=M';
218        javascript:window.open(url_finale, '_blank', 'height=700, width=900, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
219    });
220
221    $('form#tipi_form_htc').submit(function(e){
222        e.preventDefault();
223        numcli=$('#tipi_role').val();
224        exer=$('#exer_htc').val();
225        rolrec=$('#rolrec_htc').val()
226        roldet=$('#roldet_htc').val()
227        
228        while(rolrec.length<8){
229            //La rolrec doit avoir exactement 8 caractères
230            rolrec = '0' +rolrec;
231        };
232        while(roldet.length<6){
233            //La roldet doit avoir exactement 6 caractères
234            roldet = '0' +roldet;
235        };
236        
237        refdet = exer + rolrec + roldet;
238        montant=$('#montant_euros_htc').val()+$('#montant_cents_htc').val();
239        mel=$('#mel_htc').val();
240
241        url_finale = 'https://www.tipi.budget.gouv.fr/tpa/paiement.web?numcli='+numcli+'&exer='+exer+'&refdet='+refdet+'&objet=test&montant='+montant+'&mel='+mel+'&urlcl=https://www.hautesterres.fr/paiement-en-ligne/paiement-pris-en-compte/&saisie=M';
242        javascript:window.open(url_finale, '_blank', 'height=700, width=900, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
243    });
244
245function createCookie(name,value,days) {if (days) {var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires = "; expires="+date.toGMTString();}else var expires = "";document.cookie = name+"="+value+expires+"; path=/";}
246
247    setTimeout(function(){
248        $('.cta-offre-emploi').addClass('on');
249
250    },300);
251    $('.cta-offre-emploi').bind("click touchstart", function(event){
252        //createCookie('offer_content','closed',7);
253    });
254    $('.close-offer').bind("click touchstart", function(event){
255        $('.cta-offre-emploi').removeClass('on');
256        //createCookie('offer_content','closed',7);
257    });
258
259
260    $('.close-peage').click(function(){
261        $('.peage').css('display', 'none');
262    });
263
264});
265
266
267$(document).ready(function() {
268    var hash = window.location.hash; // Récupère le fragment après #
269    if (hash) { 
270        var target = $(hash); // Sélectionne l'élément avec cet ID
271        
272        if (target.length) { 
273            target.find('a').trigger("click"); // Déclenche un clic
274        }
275    }
276});

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.