1function showMostWantedForm() { 2 $('#most-wanted-form').show('slow'); 3} 4 5function closeMostWantedForm() { 6 $('#most-wanted-form').hide('slow'); 7 // Reset recaptcha when close form 8 if (typeof grecaptcha !== 'undefined') { 9 grecaptcha.reset(); 10 } 11} 12 13function submitMostWantedForm() { 14 var name = $('#mw_name').val() 15 var email = $('#mw_email').val() 16 var phone = $('#mw_phone').val() 17 var item_name = $('#mw_item_name').val() 18 var item_quality = $('#mw_item_quality').val() 19 var item_description = $('#mw_item_description').val() 20 21 // Get recaptcha response 22 var recaptcha = ''; 23 try { 24 recaptcha = grecaptcha.getResponse(1); 25 if (!recaptcha) { 26 recaptcha = grecaptcha.getResponse(0); 27 } 28 } catch (e) { 29 recaptcha = grecaptcha.getResponse(); 30 } 31 32 if (name.length == 0) { 33 $('#mw_responseSubmit').html('Sorry, you need insert a name'); 34 $('#mw_responseSubmit').show('slow'); 35 setTimeout(function () { 36 $('#mw_responseSubmit').hide('slow'); 37 }, 3000); 38 } else if (email.length == 0) { 39 $('#mw_responseSubmit').html('Sorry, you need insert a email'); 40 $('#mw_responseSubmit').show('slow'); 41 setTimeout(function () { 42 $('#mw_responseSubmit').hide('slow'); 43 }, 3000); 44 } else if (phone.length == 0) { 45 $('#mw_responseSubmit').html('Sorry, you need insert a phone number'); 46 $('#mw_responseSubmit').show('slow'); 47 setTimeout(function () { 48 $('#mw_responseSubmit').hide('slow'); 49 }, 3000); 50 } else if (item_name.length == 0) { 51 $('#mw_responseSubmit').html('Sorry, you need insert a item name'); 52 $('#mw_responseSubmit').show('slow'); 53 setTimeout(function () { 54 $('#mw_responseSubmit').hide('slow'); 55 }, 3000); 56 } else if (item_description.length == 0) { 57 $('#mw_responseSubmit').html('Sorry, you need insert a item description'); 58 $('#mw_responseSubmit').show('slow'); 59 setTimeout(function () { 60 $('#mw_responseSubmit').hide('slow'); 61 }, 3000); 62 } else { 63 // Verificar que el reCAPTCHA se haya completado 64 if (!recaptcha) { 65 $('#mw_responseSubmit').html('Please complete the reCAPTCHA'); 66 $('#mw_responseSubmit').show('slow'); 67 setTimeout(function () { 68 $('#mw_responseSubmit').hide('slow'); 69 }, 3000); 70 return; 71 } 72 73 $.ajax({ 74 type: "POST", 75 url: "./../connectors/email.php?order=mostWantedEmail", 76 data: { 77 "name": name, 78 "email": email, 79 "phone": phone, 80 "item_name": item_name, 81 "item_quality": item_quality, 82 "item_description": item_description, 83 "recaptcha": recaptcha 84 }, 85 dataType: 'json', 86 beforeSend: function () { 87 $('#mw_responseSubmit').css('border-color', 'green'); 88 $('#mw_responseSubmit').html('<i class="fas fa-spinner fa-pulse"></i>'); 89 }, 90 success: function (response) { 91 if (response.status != 'success') { // Error 92 $('#mw_responseSubmit').css('border-color', 'red'); 93 $('#mw_responseSubmit').html(response.message); 94 $('#mw_responseSubmit').show('slow'); 95 setTimeout(() => { 96 $('#mw_responseSubmit').hide('slow'); 97 // closeMostWantedForm(); 98 }, 3500) 99 } else { // Success 100 $('#mw_responseSubmit').html(response.message); 101 $('#mw_responseSubmit').show('slow'); 102 setTimeout(() => { 103 $('#mw_responseSubmit').hide('slow'); 104 closeMostWantedForm(); 105 }, 3000) 106 } 107 // Reset reCAPTCHA 108 grecaptcha.reset(); 109 }, 110 error: function(err, type, msg) { 111 console.error(err, type, msg) 112 $('#mw_responseSubmit').css('border-color', 'red'); 113 $('#mw_responseSubmit').html('Sorry, something went wrong. Try again later.'); 114 $('#mw_responseSubmit').show('slow'); 115 setTimeout(() => { 116 $('#mw_responseSubmit').hide('slow'); 117 closeMostWantedForm(); 118 }, 3500) 119 // Reset reCAPTCHA 120 grecaptcha.reset(); 121 } 122 }); 123 } 124}
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.