1$(function() { 2 3 $('.upy-contact-form').each(function() { 4 5 var $frm = $(this).closest('form'); 6 $frm.attr('action', main_host + 'ajax/CONTACT.SEND'); 7 $frm.attr('method', 'post'); 8 9 $frm.ajaxForm({ 10 'beforeSerialize': function($form, options) { 11 if($form.find('.page').length === 0) { 12 $('<input type="hidden" name="page" value="" class="page" />').appendTo($form); 13 } 14 $form.find('.page').val(location.href); 15 }, 16 'beforeSubmit' : function(arr, $form, options) { 17 var errori = []; 18 var $firstName = $form.find('[name="firstName"]'); 19 if($firstName.length) { 20 if($.trim($firstName.val()) == '') { 21 errori.push(Utility.getLang('contact', 'NOME_VUOTO')); 22 } 23 } 24 var $lastName = $form.find('[name="lastName"]'); 25 if($lastName.length) { 26 if($.trim($lastName.val()) == '') { 27 errori.push(Utility.getLang('contact', 'COGNOME_VUOTO')); 28 } 29 } 30 var $email = $form.find('[name="email"]'); 31 if($email.length) { 32 if($.trim($email.val()) == '') { 33 errori.push(Utility.getLang('contact', 'EMAIL_VUOTO')); 34 } 35 } 36 var $text = $form.find('[name="text"]'); 37 if($text.length) { 38 if($.trim($text.val()) == '') { 39 errori.push(Utility.getLang('contact', 'TEXT_VUOTO')); 40 } 41 } 42 43 var $privacy = $form.find('[name="privacy"]'); 44 if($privacy.length) { 45 if($privacy.is(":checked")==false) { 46 errori.push(Utility.getLang('contact', 'PRIVACY_VUOTO')); 47 } 48 } 49 if(errori.length) { 50 Utility.alert({ 51 'message': errori.join('<br />'), 52 'type' : 'danger' 53 }); 54 return false; 55 } 56 var $sbm = $form.find('.upy-contact-form'); 57 $sbm.val(Utility.getLang('contact', 'INVIO_IN_CORSO')); 58 $sbm.html(Utility.getLang('contact', 'INVIO_IN_CORSO')); 59 $sbm.attr('disabled', true); 60 }, 61 'success' : function(ret_data, statusText, xhr, $form) { 62 var $sbm = $form.find('.upy-contact-form'); 63 $sbm.val(Utility.getLang('base', 'INVIA')); 64 $sbm.html(Utility.getLang('base', 'INVIA')); 65 $sbm.removeAttr('disabled'); 66 if(parseInt(ret_data.result, 10) == 1) { 67 var redirectUrl = $form.data('thankyou'); 68 if(redirectUrl) { 69 window.location.assign(redirectUrl); 70 } else { 71 $form.replaceWith('<div class="alert alert-success">' + Utility.getLang('contact', 'MESSAGGIO_SPEDITO') + '</div>'); 72 } 73 } else { 74 Utility.alert({'message': ret_data.error}); 75 } 76 }, 77 'dataType' : 'json' 78 }); 79 }); 80});
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.