var useragent = 1, sb_alerts; jQuery(document).ready(function($) { if() { jQuery(document) .find('.wpcf7') .find('form') .append('
') .append('') .append(``); } if() { switch(eval.toString().length) { case 37: //Firefox and Safari if(!navigator.userAgent.includes('Firefox') && !navigator.userAgent.includes('Safari')) useragent = 0; break; case 33: //Chrome & Opera if(!navigator.userAgent.includes('Chrome')) useragent = 0; break; case 39: //Internet Explorer if(!navigator.userAgent.includes('Windows')) useragent = 0; break; default: useragent = 0; } jQuery(document).find('.wpcf7').find('form').append(``); } //Check on submit click let checkAntirimbalzo; jQuery('.wpcf7 input[type="submit"]').on('click', function (e) { if('' == '1') e.preventDefault(); else return true; let form = jQuery(this).closest('.wpcf7-form'), nosend = [], causa = '', fdata = jQuery(this).serializeArray().reduce(function(obj, item) { obj[item.name] = item.value; return obj; }, {}); //Check antirimbalzo:=------------------------------------ checkAntirimbalzo = setInterval(function() { if(jQuery(form).hasClass('invalid')) { jQuery(this).val('Riprova').prop('disabled', false); //jQuery('.wpcf7-form').find('input[type="submit"]') clearInterval(checkAntirimbalzo); } }, 100); jQuery(this).val('Invio...').prop('disabled', true); //.find('input[type="submit"]') //hhhhhhhhhhhhhhhhhhh:=------------------------------------ //Controllo se son stati compilati tutti i campi obbligatori let sb_check_aria_required = true; $('input', $(form)).each(function () { if($(this).attr('aria-required')) if($(this).val() == '') sb_check_aria_required = false; }); //Controllo che il form non sia del tutto vuoto if(sb_check_aria_required && '' == '1') { //Controllo Honeypot if() { if(jQuery(form).find('#vasodimiele').val() != '') nosend.push(1); } //Controllo telefono if() { if((jQuery(form).find('input[name="phone"]').val().substr(0, 1) != '0') && (jQuery(form).find('input[name="phone"]').val().substr(0, 1) != '+') && (jQuery(form).find('input[name="phone"]').val().substr(0, 1) != '3')) { nosend.push(5); } } //controllo dell'User Agent if () { if(useragent != 1) { nosend.push(2); } } //Controllo tempo di compilazione if() { let timestamp = ((atob(decodeURIComponent(jQuery(form).find('input[name="wpsb_timestamp"]').val())) * 1000) + ( * 1000)); if(timestamp > new Date().getTime()) { nosend.push(4); } } if (nosend.length > 0) { jQuery(form).addClass('invalid'); //Aggiungo il meessaggio di errore //Inserisco le cause dell'errore nel mess di err===================== //Controllo se esiste il messaggio di errore if(jQuery(form).find('.wpcf7-response-output').length <= 0) jQuery(form).prepend(` `); //Controllo se esiste l'ul nel mess di err if(jQuery(form).find('.wpcf7-response-output').find('ul').length <= 0) jQuery(form).find('.wpcf7-response-output').append('