1function validateEmail(email) { 2 var re = /^[\w.%+-]+@[\w.-]+(\.)?[a-zA-Z0-9]{2,6}?\.[a-zA-Z]{2,6}$/i; 3 return re.test(email); 4} 5 6function checkFormContact() { 7 let _error = 0; 8 $('#formulaireDeContact input[required],textarea[required],select[required]').each(function () { 9 if ("text" == $(this).attr('type') || "select" == $(this).attr('type') || "message" == $(this).attr('type')) { 10 if ("" == $.trim($(this).val())) { 11 _error++; 12 } 13 } 14 if ("email" == $(this).attr('type')) { 15 if (!validateEmail($(this).val())) { 16 _error++; 17 } 18 } 19 }); 20 if (0 == _error) { 21 return true; 22 } 23 return false; 24} 25 26function validFormContact () { 27 if (checkFormContact()) { 28 $('#validForm').prop('disabled', false).addClass('btn-success').removeClass('btn-warning'); 29 } else { 30 $('#validForm').prop('disabled', true).addClass('btn-warning').removeClass('btn-success'); 31 } 32} 33 34 35$(document).ready(function () { 36 37 //--- Class img-responsive sur toutes les images (sauf les img-no-responsive) 38 $('.body-wrapper img').each(function () { 39 //--- Ajoute la class 'img-responsive' aux images 40 if (!$(this).hasClass('img-no-responsive') && !$(this).hasClass('img-responsive')) { 41 $(this).addClass('img-responsive'); 42 } 43 if ('right' == $(this).css('float')) $(this).addClass('margin-left'); 44 if ('left' == $(this).css('float')) $(this).addClass('margin-right'); 45 //--- Ajoute l'attribut sizes aux images avec srcset 46 if ($(this).attr('srcset') && !$(this).attr('sizes')) { 47 $(this).attr('sizes', '100vw'); 48 } 49 }); 50 51 // Ajoute un data-rel à la place du rel sur les liens lightcase 52 $('a[rel^="lightcase"]').each(function () { 53 $(this).attr('data-rel', $(this).attr('rel')); 54 }); 55 56 // lightcase sur les liens 57 $('a[rel^="lightcase"]').lightcase({ 58 swipe: true, 59 transition: 'fade', //'none', 'fade', 'fadeInline', 'elastic', 'scrollTop', 'scrollRight', 'scrollBottom', 'scrollLeft', 'scrollHorizontal', 'scrollVertical'. 60 showSequenceInfo: false, 61 showTitle: false, 62 showCaption: false, 63 fullscreenModeForMobile: true, 64 maxWidth: 1200, 65 maxHeight: 1024, 66 }); 67 68 // Ajoute les btn de partage sur les réseaux sociaux si le bloc share est présent 69 if ('undefined' != typeof share) { 70 $('#share').jsSocials({ 71 showLabel: false, 72 showCount: false, 73 shares: ["email", "twitter", "facebook", "linkedin", "pinterest", "whatsapp" /* , "stumbleupon" */] 74 }); 75 } 76 77 $('.nav-search a').click(function () { 78 $('#searchForm').toggle('slow'); 79 }); 80 if ('undefined' != typeof selectpicker) { 81 $('.selectpicker').selectpicker(); 82 } 83 84 //--- Pour le formulaire de contact 85 /* 86 if ('undefined' != typeof contactForm && 'undefined' != typeof mail) { 87 if (validateEmail($('#mail').val())) { 88 $('#mail').removeClass('error'); 89 $('#validForm').prop('disabled', false); 90 } 91 92 $('#mail').on('input', function (e) { 93 if (validateEmail($(this).val())) { 94 $(this).removeClass('error'); 95 $('#validForm').prop('disabled', false); 96 } else { 97 $(this).addClass('error'); 98 $('#validForm').prop('disabled', true); 99 } 100 }); 101 } 102 */ 103 104 //--- Pour le formulaire de contact 105 if ('undefined' != typeof contactForm && 'undefined' != typeof mail) { 106 if (validateEmail($('#mail').val())) { 107 $('#mail').removeClass('error'); 108 validFormContact(); 109 } 110 $('#formulaireDeContact input[required],textarea[required],select[required]').on('blur', function (e) { 111 validFormContact(); 112 }); 113 114 $('#mail').on('input', function (e) { 115 if (validateEmail($(this).val())) { 116 $(this).removeClass('error'); 117 } else { 118 $(this).addClass('error'); 119 } 120 validFormContact(); 121 }); 122 123 //--- Gestion du captcha 124 if ('undefined' != typeof verification) { 125 $('.valeurBtn').click(function (e) { 126 $('.valeurBtn').removeClass('btn-danger').addClass('btn-default'); 127 $(this).removeClass('btn-default').addClass('btn-danger'); 128 $('#captcha').val($(this).data('verif')); 129 validFormContact(); 130 }); 131 } 132 } 133 134 135 136 137 //--- Pour l'inscription à l'infolettre' 138 if ('undefined' != typeof infolettreForm && 'undefined' != typeof mail) { 139 140 if (validateEmail($('#mail').val())) { 141 $('#mail').removeClass('error'); 142 } else { 143 $('#mail').addClass('error'); 144 } 145 $('#validForm').prop('disabled', true); 146 147 $('#mail').on('input', function (e) { 148 if (validateEmail($(this).val())) { 149 $(this).removeClass('error'); 150 if ($('#accepte').is(':checked')) { 151 $('#validForm').prop('disabled', false); 152 } else { 153 $('#validForm').prop('disabled', true); 154 } 155 } else { 156 $(this).addClass('error'); 157 $('#validForm').prop('disabled', true); 158 } 159 }); 160 161 $('#accepte').on('change', function (e) { 162 if ($('#accepte').is(':checked')) { 163 if (validateEmail($('#mail').val())) { 164 $('#validForm').prop('disabled', false); 165 } else { 166 $('#validForm').prop('disabled', true); 167 } 168 } else { 169 $('#validForm').prop('disabled', true); 170 } 171 }); 172 } 173 174 //--- Plan 175 if ('undefined' != typeof mapVillage) { 176 if ('undefined' == typeof _markersPlan || _markersPlan.length == 0) { 177 $('#mapVillage').remove(); 178 $('<div class="row"><h2>Il n\'y a pas d\'élément géolocalisé dans cette rubique</h2></div>').insertAfter('.categoriesMenu'); 179 } 180 } 181});
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.