1var $ = jQuery.noConflict(); 2$(document).ready(function(){ 3 var errorsList = ''; 4 var idioma = 'es-GT'; 5 6if(idioma == "en_US"){ 7 $("#formulario-de-contacto").validate({ 8 onfocusout: false, 9 onkeyup: false, 10 onclick: false, 11 rules: { 12 nombre: {required: true}, 13 apellido: {required: true}, 14 telefono: {required: true}, 15 correo: {required: true, email: true}, 16 mensaje: {required: true}, 17 }, 18 messages: { 19 nombre:{required: "Enter your name."}, 20 apellido:{required: "Enter your last name."}, 21 telefono:{required: "Enter your phone."}, 22 correo:{required: "Enter your email.", email: "The email address is not valid."}, 23 mensaje:{required: "Enter your message."}, 24 }, 25 submitHandler: function(form){ 26 $.getJSON( get_template_directory_uri + '/inc/contacto.php', $(form).serialize()) 27 .done(function(data){ 28 if(data.response == 'true'){ 29 alertify.error(data.message); 30 } else { 31 alertify.success(data.message); 32 location.href = enlace_gracias; 33 } 34 }) 35 .fail(function(data){ 36 alertify.error(data.message); 37 }); 38 }, 39 showErrors: function(errorMap, errorList) { 40 this.defaultShowErrors(); 41 $(errorList).each(function(){ 42 errorsList += $(this)[0].message + '<br/>'; 43 }); 44 if (errorsList){ 45 alertify.error(errorsList); 46 } 47 errorsList = ''; 48 } 49 }); 50 51}else{ 52 53 $("#formulario-de-contacto").validate({ 54 onfocusout: false, 55 onkeyup: false, 56 onclick: false, 57 rules: { 58 nombre: {required: true}, 59 apellido: {required: true}, 60 telefono: {required: true}, 61 correo: {required: true, email: true}, 62 mensaje: {required: true}, 63 }, 64 messages: { 65 nombre:{required: "Ingresa tu nombre."}, 66 apellido:{required: "Ingresa tu apellido."}, 67 telefono:{required: "Ingresa tu teléfono."}, 68 correo:{required: "Ingresa tu correo.", email: "La dirección de correo no es válida."}, 69 mensaje:{required: "Ingresa tu mensaje."}, 70 }, 71 submitHandler: function(form){ 72 $.getJSON( get_template_directory_uri + '/inc/contacto.php', $(form).serialize()) 73 .done(function(data){ 74 if(data.response == 'true'){ 75 alertify.error(data.message); 76 } else { 77 alertify.success(data.message); 78 location.href = enlace_gracias; 79 } 80 }) 81 .fail(function(data){ 82 alertify.error(data.message); 83 }); 84 }, 85 showErrors: function(errorMap, errorList) { 86 this.defaultShowErrors(); 87 $(errorList).each(function(){ 88 errorsList += $(this)[0].message + '<br/>'; 89 }); 90 if (errorsList){ 91 alertify.error(errorsList); 92 } 93 errorsList = ''; 94 } 95 }); 96 97} 98 99 100 if(idioma == "en_US"){ 101 102 $("#formulario-de-contacto input[type='submit']").on('click',function(){ 103 var validator = $("#formulario-de-contacto").valid(); 104 if (!validator) { 105 alertify.error("All fields are required"); 106 } else { 107 $("#formulario-de-contacto").submit(); 108 } 109 return false; 110 }); 111 }else{ 112 $("#formulario-de-contacto input[type='submit']").on('click',function(){ 113 var validator = $("#formulario-de-contacto").valid(); 114 if (!validator) { 115 alertify.error("Todos los campos son requeridos"); 116 } else { 117 $("#formulario-de-contacto").submit(); 118 } 119 return false; 120 }); 121 } 122});
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.