1$( document ).ready(function() { 2 3 $(".toggle_title_block").click(function(e) { 4 if($(this).parents(".toggle_item").hasClass("open")) 5 { 6 $(this).parents(".toggle_item").removeClass("open"); 7 $(this).find("i").attr("class",$(this).parents(".toggle").attr("close")); 8 $(this).parents(".toggle_item").find(".toggle_html").slideUp(200); 9 } 10 else 11 { 12 $(this).parents(".toggle_item").addClass("open"); 13 $(this).find("i").attr("class",$(this).parents(".toggle").attr("ouvert")); 14 $(this).parents(".toggle_item").find(".toggle_html").slideDown(200); 15 } 16 }); 17}); 18 19function valid_radio(id,elem) 20{ 21 $(elem).parent().parent().find(".radio_input").removeClass("checked"); 22 if(!$(elem).hasClass("checked")) 23 { 24 $(elem).addClass("checked"); 25 $("#"+id).prop("checked", true); 26 } 27} 28 29function valid_checkbox(id,elem) 30{ 31 if($(elem).hasClass("checked")) 32 { 33 $(elem).removeClass("checked"); 34 $("#"+id).prop("checked", false); 35 } 36 else 37 { 38 $(elem).addClass("checked"); 39 $("#"+id).prop("checked", true); 40 } 41} 42 43function valid_form(formulaire) 44{ 45 var valid = 1; 46 var msg = new Array(); 47 48 $(formulaire).find(".obligatoire").each(function(index, element) { 49 50 $(this).find(".formulaire_field_txt").removeClass("field_error_txt"); 51 52 if($(this).find(".formulaire_field_input").attr("type") == "radio") 53 { 54 var selected = $(this).find("input[type='radio']:checked"); 55 $(this).find(".field_error_info").remove(); 56 57 if (selected.length == 0) { 58 valid = 0; 59 msg["fr"] = "Veuillez selectionner l'une des options suivante!"; 60 msg["en"] = "Please select one of the following options!"; 61 62 $(this).find(".formulaire_field_txt").addClass("field_error_txt"); 63 $(this).find(".formulaire_field_txt").after("<div class='field_error_info'>"+msg[lang]+"</div>"); 64 } 65 } 66 67 else if($(this).find(".formulaire_field_input").attr("type") == "list") 68 { 69 var selected = $(this).find("select").val(); 70 $(this).find(".field_error_info").remove(); 71 72 if ($(this).find("select").val().trim() == "") { 73 valid = 0; 74 msg["fr"] = "Veuillez selectionner l'une des options suivante!"; 75 msg["en"] = "Please select one of the following options!"; 76 77 $(this).find(".formulaire_field_txt").addClass("field_error_txt"); 78 $(this).find(".formulaire_field_txt").after("<div class='field_error_info'>"+msg[lang]+"</div>"); 79 } 80 } 81 82 else if($(this).find(".formulaire_field_input").attr("type") == "checkbox") 83 { 84 var selected = $(this).find("input[type='checkbox']:checked"); 85 $(this).find(".field_error_info").remove(); 86 87 if (selected.length == 0) { 88 valid = 0; 89 msg["fr"] = "Veuillez cocher au minimum l'une des options suivante!"; 90 msg["en"] = "Please check at least one of the following options!"; 91 92 $(this).find(".formulaire_field_txt").addClass("field_error_txt"); 93 $(this).find(".formulaire_field_txt").after("<div class='field_error_info'>"+msg[lang]+"</div>"); 94 } 95 } 96 97 else if($(this).find(".formulaire_field_input").attr("type") == "courriel") 98 { 99 $(this).find("input").removeClass("field_error"); 100 $(this).find(".field_error_info").remove(); 101 102 if($(this).find("input").val().trim() == "" || validateEmail($(this).find("input").val()) == false) 103 { 104 valid = 0; 105 msg["fr"] = "Le courriel est invalide!"; 106 msg["en"] = "The email is invalid!"; 107 108 $(this).find(".formulaire_field_txt").addClass("field_error_txt"); 109 $(this).find(".formulaire_field_txt").after("<div class='field_error_info'>"+msg[lang]+"</div>"); 110 } 111 } 112 113 else if($(this).find(".formulaire_field_input").attr("type") == "textarea") 114 { 115 $(this).find("textarea").removeClass("field_error"); 116 $(this).find(".field_error_info").remove(); 117 118 if($(this).find("textarea").val().trim() == "") 119 { 120 valid = 0; 121 msg["fr"] = "Le champs est vide!"; 122 msg["en"] = "The field is empty!"; 123 124 $(this).find(".formulaire_field_txt").addClass("field_error_txt"); 125 $(this).find(".formulaire_field_txt").after("<div class='field_error_info'>"+msg[lang]+"</div>"); 126 } 127 } 128 129 else if($(this).find(".formulaire_field_input").attr("type") == "text") 130 { 131 $(this).find("input").removeClass("field_error"); 132 $(this).find(".field_error_info").remove(); 133 134 if($(this).find("input").val().trim() == "") 135 { 136 valid = 0; 137 msg["fr"] = "Le champs est vide!"; 138 msg["en"] = "The field is empty!"; 139 140 $(this).find(".formulaire_field_txt").addClass("field_error_txt"); 141 $(this).find(".formulaire_field_txt").after("<div class='field_error_info'>"+msg[lang]+"</div>"); 142 } 143 } 144 145 else if($(this).find(".formulaire_field_input").attr("type") == "date") 146 { 147 $(this).find("input").removeClass("field_error"); 148 $(this).find(".field_error_info").remove(); 149 150 if($(this).find("input").val().trim() == "") 151 { 152 valid = 0; 153 msg["fr"] = "Le champs est vide!"; 154 msg["en"] = "The field is empty!"; 155 156 $(this).find(".formulaire_field_txt").addClass("field_error_txt"); 157 $(this).find(".formulaire_field_txt").after("<div class='field_error_info'>"+msg[lang]+"</div>"); 158 } 159 } 160 }); 161 162 reset_parralax(); 163 164 if(valid == 1) 165 { 166 $(formulaire).submit(); 167 } 168 else 169 { 170 msg["fr"] = "Corriger les erreurs suivantes *"; 171 msg["en"] = "Correct the following errors *"; 172 173 alert(msg[lang]); 174 175 } 176} 177 178function valid_checkbox_checked() 179{ 180 jQuery( "input[type=checkbox]" ).each(function(index, element) { 181 if(jQuery(this).prop('checked')) 182 { 183 jQuery(this).addClass("checked"); 184 } 185 }); 186} 187 188function add_file_upload_input() 189{ 190 jQuery("input[type=file]").each(function(index, element) { 191 192 jQuery(this).after("<span class='custom_file'>
192Joindre un fichier</span><input type='text' readonly='readonly' class='custom_file_txt'>"); 193 var input = jQuery(this); 194 195 jQuery(this).parent().find(".custom_file_txt").val(jQuery(this).val()); 196 197 jQuery(this).parent().find( ".custom_file" ).bind( "click", function() { 198 jQuery(input).trigger( "click" ); 199 }); 200 201 jQuery(input).bind( "change", function() { 202 jQuery(this).parent().find(".custom_file_txt").val(jQuery(input).val()); 203 }); 204 205 }); 206} 207 208function validateEmail(email) { 209 var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 210 return re.test(email); 211} 212 213function reset_parralax() 214{ 215 $('[data-parallax="scroll"]').parallax('destroy'); 216 $('[data-parallax="scroll"]').parallax(); 217}
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.