var isIE = (navigator.appName.indexOf("Microsoft") != -1); var isIE8 = (navigator.appName.indexOf("MSIE 8.0") != -1); var isFF = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1); /* window.onerror = function(message, url, linenumber) { pDebug("JavaScript error: " + message + " on line " + linenumber + " for " + url); } */ jQuery(window).load(function(){ if(jQuery('#superloginbox').length>0) { /* * open page di superloginbox */ jQuery('#superloginbox, .overlay, #superloginboxinside').click(function () { jQuery('#superloginbox').toggleClass('clicked'); jQuery('.overlay').toggleClass('show'); jQuery('nav#burger').toggleClass('show'); jQuery('body').toggleClass('overflow'); }); } setTimeout(function(){ pGsLoadingImages(); },100); // }) // jQuery(document).ready(function(){ exStartup(); controllomenupromozioni(); pSetGeoLoc(); if(jQuery('#modificaparametriricerca').length >0) { jQuery('#modificaparametriricerca').on('click',function(){ if(jQuery(".banner_wapper").hasClass('xs-dn')) { jQuery('.banner_wapper.xs-dn').removeClass('xs-dn'); } else { jQuery('.banner_wapper').addClass('xs-dn'); } }); } if(jQuery(".wpcf7-form input[type=submit]").length>0) { jQuery(".wpcf7-form input[type=submit]").on("click", function (e) { jQuery(this).closest("form").find(".wpcf7-response-output").show().addClass("fl c12 tac fs18").html("ATTENDERE L'INVIO"); jQuery(this).closest("form").submit(); jQuery(this).addClass("dn"); }); jQuery(".wpcf7-form input[type=submit]").on("submit", function (e) { jQuery(this).closest("form").find(".wpcf7-response-output").show().addClass("fl c12 tac fs18").html("ATTENDERE L'INVIO"); jQuery(this).closest("form").submit(); jQuery(this).addClass("dn"); }); } if(jQuery('label.tooltip').length >0) { activateTooltip(); } if(jQuery('#scaricapersonalpass').length > 0 ) { scaricapersonalpass(); } if(jQuery('#selectBlogCategories').length >0 ) { searchEngineBlogHp(); } jQuery('.stoppropagation').each(function(){ jQuery(this).on('click',function(e){ e.preventDefault(); e.stopPropagation(); }); }) if(jQuery('.buttonrequestchangepassword').length > 0) { requestchangepass(); } if(jQuery('.updaterfield').length > 0) { updaterField(); } if(location.href.indexOf('backoffice-operatori') > -1) { var hash = window.location.hash.substr(1); if(hash!=""){ jQuery('.sezioniboo').removeClass('dn').addClass('dn'); jQuery('#'+hash).removeClass('dn'); } else { jQuery('.sezioniboo').removeClass('dn').addClass('dn'); jQuery('#boxContenutiBoo').removeClass('dn'); jQuery('.sezioniboo.boxContentenutiSidebarBoo').removeClass('dn'); } jQuery('.boosections').on('click',function(){ jQuery('.sezioniboo').removeClass('dn').addClass('dn'); jQuery('#'+jQuery(this).data('id')).removeClass('dn'); }); } if(location.href.indexOf('backoffice-utenti') > -1) { var hash = window.location.hash.substr(1); if(hash!=""){ jQuery('.sezioneboo').each(function (){ if(jQuery(this).data('name')==hash){ jQuery(this).click(); } }); } } if(location.href.indexOf('backoffice-operatori') > -1) { var hash = window.location.hash.substr(1); if(hash!=""){ jQuery('.sezioneboo').each(function (){ if(jQuery(this).data('name')==hash){ setTimeout(function() { jQuery('.sezioneboo[data-name="' + hash + '"]').click(); },1000); } }); } } if(jQuery('#boxRecoverypwdBou').length >0 ) { jQuery('#boxRecoverypwdBou').on('click',function() { jQuery('#accediguidasposi').parent().parent().addClass('dn'); jQuery('.sezionibou.dn').removeClass('dn'); }); } /** Nice Select Init **/ jQuery('.customsel').niceSelect(); jQuery('.customsel').css({'visibility': 'visible'}) pSetGeoLoc(); /********Form 1 Code STart Here ************/ jQuery('#sfsel').on('change', function(){ var firstselval = jQuery(this).val(); pOperatorSearchAjax(firstselval); pSetGeoLoc(); }); /****** Form 1 Submit Code STart Here *****/ jQuery( "#firstfrmbtn" ).click( function(e){ idForm='#'+ jQuery(this).closest('form').attr('id'); var firstfrmoldvalue = jQuery(idForm).find('ul.list:eq(0) li.selected').data('value'); var frmoneselone = jQuery(idForm).find('ul.list:eq(0) li.selected').data('value'); var frmoneseltwo = jQuery(idForm).find('ul.list:eq(1) li.selected').data('value'); var idx = jQuery(idForm).find('select:eq(1)').prop('selectedIndex'); if(idx===0) { frmoneseltwo="";} if(frmoneseltwo=="News e informazioni") { frmoneseltwo=""; } if(frmoneseltwo!="") { var r1 = "/"+frmoneseltwo; }else { var r1=""; } var newfrmoneurlboth = r1 +'/'+frmoneselone; window.location.href = newfrmoneurlboth; return false; }); /****** Form 1 Submit Code End Here *****/ /*******Form 2 Code Start Here *********/ jQuery('#frm2 select:eq(0)').on('change', function(){ var secondselval = jQuery(this).val(); pPromoSearchAjax(secondselval); }); /****** Form 2 Submit Code STart Here *****/ jQuery( "#secondfrmbtn" ).click(function() { idForm='#'+ jQuery(this).closest('form').attr('id'); var firstfrmoldvalue = jQuery(idForm).find('ul.list:eq(0) li.selected').data('value'); var frmtwoselone = jQuery(idForm).find('ul.list:eq(0) li.selected').data('value'); var frmtwoseltwo = jQuery(idForm).find('ul.list:eq(1) li.selected').data('value'); var idx1 = jQuery(idForm).find('select:eq(0)').prop('selectedIndex'); var idx2 = jQuery(idForm).find('select:eq(1)').prop('selectedIndex'); var url = "/"; if(idx1>0 && idx2<2) { url += "promozioni-"+frmtwoselone; } else if(idx1>0 && idx2>=2) { url += "promozioni/"+frmtwoseltwo+'/'+frmtwoselone; } else { url += "promozioni"; } window.location.href = url; return false; }); if(jQuery('#registrazioneutente').length>0) { registrazioneutente(); } if(jQuery('#registrazioneoperatore').length>0) { registrazioneoperatore(); } if(jQuery('#affinalaricerca').length >0) { jQuery('#affinalaricerca').on('click',function(){ jQuery('#layernavigation').removeClass('xs-dn'); jQuery('#openlayer').removeClass('xs-show'); }); } /* * intervista */ if(jQuery('#intervista').length>0){ allAboutIntervista(); if(jQuery('.gotoend2').length >0) { } } /* * additional field in cf7 */ if(jQuery('#id_operatore').length > 0) { jQuery('#id_operatore').val(jQuery('#postid').text()); } /* * Altri Operatori */ if(jQuery('#datadelmatrimonio').length >0) { openDatePicker("datadelmatrimonio"); } if(jQuery('#altri_operatori').length > 0) { openDatePicker("datadelmatrimonio"); // jQuery( "#datadelmatrimonio" ).datepicker(); if(jQuery('.wpcf7-response-output.wpcf7-mail-sent-ok').length >0) { jQuery('.tolightoff').each(function(){ jQuery(this).addClass('dn'); }); jQuery('.wpcf7-response-output.wpcf7-mail-sent-ok').closest('form').find('#altri_operatori').each(function(){ jQuery(this).addClass('dn'); }); } html=""; // anche altri fornitori possono essere interessati alla tua richiesta // procedi html = html + ""; html = html + ""; html = html + "Anche altri fornitori possono essere interessati alla tua richiesta"; html = html + ""; html = html + ""; html = html + "Procedi"; html = html + ""; html = html + ""; html = html + "
"; jQuery('#altri_operatori').html(html); buildAltriOperatori(); jQuery('.checkon').each(function(){ jQuery(this).removeClass('dn').addClass('dn'); arOperatore(jQuery(this).data('id'),0); }); jQuery('.checkoff').each(function() { jQuery(this).removeClass('dn'); }) jQuery('.button.stoppropagation').on('click',function(e){ e.preventDefault(); e.stopPropagation(); openAltriOperatori(); }) jQuery('#altri_operatori .cliccker').on('click',function(e){ e.preventDefault(); e.stopPropagation(); openAltriOperatori(); }) checkboxAltriOperatori(); } regeneratePageNavi(); /* * gestore del barra filter layeredsearch * */ if(jQuery('.filterbyoperator').length >0) { jQuery('.filterbyoperator').on('click', function(e){ e.preventDefault(); e.stopPropagation(); jQuery('#cropOperatorEngine').click(); }); } jQuery('#cropOperatorEngine').on('click',function(e){ e.preventDefault(); e.stopPropagation(); var qvar=jQuery('#formRicerca').serialize() ; jQuery.ajax({ type: "POST", url: cropengine.ajax_url, data: { action: 'cropengine', query_vars: cropengine.query_vars, query: qvar, page: jQuery('.wp-pagenavi .clicked').html() }, beforeSend: function(){ html='

In ricerca...

'; jQuery('#risultatiCropEngine').html(html); } , success: function(html) { jQuery('#risultatiCropEngine').html(html); pGsLoadingImages(); regeneratePageNavi(); numero=jQuery('#contatoreOperatori').val(); if(numero==0) { testo=" nessun fornitore "; } if(numero==1) { testo=" un fornitore "; } if(numero > 1) { testo= numero + " fornitori "; } jQuery('#counterOperatori').html(testo); // setTimeout(pGsLoadingImages(),1000); } }); }); if(jQuery('.richiediinformazionicommerciali').length >0) { jQuery('.richiediinformazionicommerciali').on('click',function(){ jQuery(this).addClass('dn'); jQuery('.formRichiediInformazioniCommerciali').removeClass('dn'); }); } // // favourites // if(jQuery('.favoritelink').length > 0) { jQuery('.favoritelink').on('click',function () { favoritelink(this); }); } /* if(jQuery('.rslides').length>0) { jQuery(".rslides").responsiveSlides({ auto: false, speed: 500, pager: false, namespace: "large-btns", nav: true }); } */ jQuery('#carousel').flexslider({ animation: "slide", controlNav: false, animationLoop: true, slideshow: true, itemWidth: 210, itemMargin: 5, asNavFor: '#slider', start: function(){ jQuery('.slider-blk.vh').removeClass('vh'); } }); jQuery('#slider').flexslider({ animation: "slide", controlNav: false, animationLoop: false, slideshow: true, sync: "#carousel" }); jQuery('#show').click(function () { if(jQuery('.phone_no').hasClass('dn')) { var id = jQuery('#postid').text(); jQuery.ajax({ type: "POST", url: showtel.ajax_url, data: { action: 'showtel', op: id }, beforeSend: function () { }, success: function () { } }); jQuery('.phone_text').addClass("dn"); jQuery('.phone_no').removeClass("dn"); } }); if(jQuery('#operatorelat').length>0) { initializeGM(); // google.maps.event.addDomListener(window, 'load', initializeGM); } startSliders() jQuery('#back-to-top').click(function(){ jQuery("html, body").animate({ scrollTop: 0 }, 1200); return false; }); //jQuery( ".wpcf7-response-output" ).attr( "role" ); var noAttr = jQuery('div.wpcf7-response-output').attr('role'); if(typeof noAttr == 'undefined') { } else { jQuery("div.wpcf7-response-output").addClass("intro"); } jQuery("div#tabs_siticonsigliati_container a").click(function(){ var url = jQuery(this).attr("href"); _gaq.push(['_trackEvent', 'Link consigliati', 'click', url]); setTimeout(function(){ document.location.href = url; }, 250); return false; }); // Slideshow 3 if (jQuery("#slider3").length>0){ jQuery("#slider3").responsiveSlides({ manualControls: '#slider3-pager', maxwidth: 640, }); } // Slideshow 4 if (jQuery("#slider4").length>0){ jQuery("#slider4").responsiveSlides({ auto: true, pager: false, nav: true, maxwidth: 640, speed: 500, namespace: "callbacks", }); } //jQuery(".container_ricerca").hide(); //jQuery(".container").hide(); jQuery("div.trigger").css("cursor","pointer").toggle(function(){ jQuery(this).addClass("active"); jQuery(this).next(".container_ricerca").show(500); }, function () { jQuery(this).removeClass("active"); jQuery(this).next(".container_ricerca").hide(500); }); /* $("div.box_telefono_trigger").css("cursor","pointer").toggle(function(){ var el = $(this); el.addClass("active"); $.get($('body').data('jadmin')+ "?action=contatore_telefono&id=" + el.data("id")); el.next(".container").show(500); }, function () { var el = $(this); el.removeClass("active"); el.next(".container").hide(500); }); */ $(".box").css("cursor","pointer").hover(function(){ $(this).find(".overlay").show(500); }, function () { $(this).find(".overlay").hide(500); }); jQuery.extend(jQuery.fn, { validate: function () { if (jQuery(this).val().length < 3) {jQuery(this).addClass('error');return false} else {jQuery(this).removeClass('error');return true} }, /* * check if email is correct * add to your CSS the styles of .error field, for example border-color:red; */ validateEmail: function () { var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/, emailToValidate = jQuery(this).val(); if (!emailReg.test( emailToValidate ) || emailToValidate == "") { jQuery(this).addClass('error');return false } else { jQuery(this).removeClass('error');return true } }, }); /* * On comment form submit */ $( '#commentform' ).submit(function(){ // define some vars var button = $('#submit'), // submit button respond = $('#respond'), // comment form container commentlist = $('.comment-list'), // comment list container cancelreplylink = $('#cancel-comment-reply-link'); // if user is logged in, do not validate author and email fields if( $( '#author' ).length ) $( '#author' ).validate(); if( $( '#email' ).length ) $( '#email' ).validateEmail(); // validate comment in any case $( '#comment' ).validate(); // if comment form isn't in process, submit it if ( !button.hasClass( 'loadingform' ) && !$( '#author' ).hasClass( 'error' ) && !$( '#email' ).hasClass( 'error' ) && !$( '#comment' ).hasClass( 'error' ) ){ // ajax request $.ajax({ type : 'POST', url : misha_ajax_comment_params.ajaxurl, // admin-ajax.php URL data: $(this).serialize() + '&action=ajaxcomments', // send form data + action parameter beforeSend: function(xhr){ // what to do just after the form has been submitted button.addClass('loadingform').val('Loading...'); }, error: function (request, status, error) { if( status == 500 ){ alert( 'Error while adding comment' ); } else if( status == 'timeout' ){ alert('Error: Server doesn\'t respond.'); } else { // process WordPress errors var wpErrorHtml = request.responseText.split("

"), wpErrorStr = wpErrorHtml[1].split("

"); alert( wpErrorStr[0] ); } }, success: function ( addedCommentHTML ) { // if this post already has comments if( commentlist.length > 0 ){ // if in reply to another comment if( respond.parent().hasClass( 'comment' ) ){ // if the other replies exist if( respond.parent().children( '.children' ).length ){ respond.parent().children( '.children' ).append( addedCommentHTML ); } else { // if no replies, add
    addedCommentHTML = '
      ' + addedCommentHTML + '
    '; respond.parent().append( addedCommentHTML ); } // close respond form cancelreplylink.trigger("click"); } else { // simple comment commentlist.append( addedCommentHTML ); } }else{ // if no comments yet addedCommentHTML = '
      ' + addedCommentHTML + '
    '; respond.before( $(addedCommentHTML) ); } // clear textarea field $('#comment').val(''); }, complete: function(){ // what to do after a comment has been added button.removeClass( 'loadingform' ).val( 'Post Comment' ); } }); } return false; }); setTimeout(function(){ if(jQuery('#datadelmatrimonio').length >0) { openDatePicker("datadelmatrimonio"); } if(jQuery(".inv-recaptcha-holder").length >0 ) { renderInvisibleReCaptcha(); } },3000); }); function initializeGM() { var myCenter = new google.maps.LatLng( jQuery('#operatorelat').data('lat'),jQuery('#operatorelng').data('lng')); var mapProp = { center: myCenter, zoom: 16, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("googleMap"), mapProp); var marker = new google.maps.Marker({ position: myCenter, }); marker.setMap(map); } function scaricapersonalpass() { jQuery('#scaricapersonalpass').on('click',function(){ jQuery.ajax({ type:'POST', url: intervista.ajax_url, data: { action: 'scaricapersonalpass' }, beforeSend: function(xhr, opts){ jQuery('.scaricapersonalpass.iltitolo').remove(); jQuery('.scaricapersonalpass.altro').html('Loading...'); } , success: function(html) { html = "
    Il tuo Personal Pass
    " + html + "
    Stampa l'invito per accedere alla fiera.
    "; jQuery('.scaricapersonalpass.altro').closest('.container').parent().closest('.container').html(html); } }); }); } function favoritelink() { // if (!isFavClickEnabled) return; // isFavClickEnabled = false; var isFav = 0; if(jQuery(".favoritelink.pFavOn").length >0 ) { isFav = 1; } var post_id = jQuery('#postid').html(); var user_id = jQuery('#userid').html(); if (user_id == 0) { // pShowRegUserPopupCont(); // alert("login first"); // var u = ""; // var x = window.open(u); if (!x) location.href = u; } else if (isFav) { jQuery.ajax({ type: "POST", url: ajaxurl, data: { pid: post_id, uid: user_id, action: 'delfavids' }, cache: false, success: function (res) { jQuery(this).find(".heart").attr("src", "/wp-content/themes/responsive-child/images/star_0.svg"); jQuery('.favoritelink').removeClass('pFavOn'); } }); } else if (!isFav) { jQuery.ajax({ type: "POST", url: ajaxurl, data: { pid: post_id, uid: user_id, action: 'favids' }, cache: false, success: function (res) { jQuery(this).find(".heart").attr("src", "/wp-content/themes/responsive-child/images/star_1.svg"); jQuery('.favoritelink').addClass('pFavOn'); } }); } } function requestchangepass() { jQuery('.buttonrequestchangepassword').on('click',function(){ jQuery(this).addClass('dn'); jQuery('.dn.containerrequestnewpass').removeClass('dn'); }); jQuery('.buttonconfirmchangepass').on('click',function(e){ e.preventDefault(); e.stopPropagation(); p=jQuery('#changepass').val(); c=jQuery('#confirmchangepass').val(); if(p.length < 8) { jQuery('#errorichangepass').removeClass('dn').html('Password troppo corta, min 8 caratteri'); return false; } else { jQuery('#errorichangepass').addClass('dn').html(''); }; if(p !== c) { jQuery('#erroriconfirmchangepass').removeClass('dn').html('Le due Password NON coincidono'); return false; } else { jQuery('#erroriconfirmchangepass').addClass('dn').html(''); }; jQuery.ajax({ type: "POST", url: changepass.ajax_url, data: { action: 'changepass', p:p, c:c }, beforeSend: function(xhr, opts){ } , success: function(html) { if(html.indexOf('OK') > -1) { jQuery('.containerrequestnewpass').html('

    Grazie per la modifica

    '); } else { jQuery('.containerrequestnewpass').html('

    Modifica non avvenuta, contattare lo staff di Guidasposi.it

    '); } } }); }); } function updaterField() { jQuery('.updaterfield').on('blur',function(){ f=jQuery(this).attr('name'); v=jQuery(this).val(); el=jQuery(this); jQuery.ajax({ type: "POST", url: updaterfield.ajax_url, data: { action: 'updaterfield', f: f, v: v, u: jQuery('#userid').text() }, beforeSend: function(xhr, opts){ jQuery(el).parent().find('.updaterfieldafter').html(""); } , success: function(html) { if (jQuery.trim(html) === "OK") { jQuery(el).parent().find('.updaterfieldafter').html(""); } else { jQuery(el).parent().find('.updaterfieldafter').html("Ci sono stati problemi con l'aggiornamento dei dati, contattare lo staff di Guidasposi.it"); } // jQuery('body').html('

    Grazie per la registrazione, attendere prego...

    '); // location.href='/backoffice-utenti'; } }); }) } function openAltriOperatori(){ if(jQuery('#cont_altri_operatori').hasClass('dn')) { jQuery('#cont_altri_operatori').removeClass('dn'); jQuery('#altri_operatori .cliccker').addClass('dn'); jQuery('#altri_operatori .checkon').each(function(){ if(!jQuery(this).hasClass('dn')) { arOperatore(jQuery(this).data('id'),1); } }); jQuery('.tolight').removeClass('dn'); } else { jQuery('#cont_altri_operatori').addClass('dn'); } } function searchEngineBlogHp(){ jQuery('#selectBlogCategories').on('click',function(e) { e.preventDefault(); e.stopPropagation(); }) jQuery('#selectBlogCategories').on('change',function(e){ e.preventDefault(); location.href=jQuery('#selectBlogCategories option:selected').data('link'); }); } function registrazioneutente() { openDatePicker('datamatrimonio'); test=0; jQuery('#registrazioneutente').on('click',function(){ nome=jQuery('#nomesposoregistrazione').val(); cognome=jQuery('#cognomesposoregistrazione').val(); email=jQuery('#emailsposoregistrazione').val(); luogo=jQuery('#luogoregistrazione').val(); cellulare=jQuery('#cellulare').val(); datanozze=jQuery('#datamatrimonio').val(); consenso=jQuery('#consenso').prop('checked'); if(!isValidEmailAddress(email)) { testo = "Compilare correttamente il campo Email"; pubblicaerrore('containererroremail', 1, testo); test++; } else if(email.length<2) { testo="Compilare il campo Email"; pubblicaerrore('containererroremail',1, testo); test++; } else { pubblicaerrore('containererroremail',0, ''); } if(nome.length<2) { testo="Compilare il campo Nome"; pubblicaerrore('containererrornome',1, testo); test++;} else { pubblicaerrore('containererrornome',0, ''); } if(cognome.length<2) { testo="Compilare il campo Cognome"; pubblicaerrore('containererrorcognome',1, testo); test++;} else { pubblicaerrore('containererrorcognome',0, ''); } if(luogo.length<2) { testo="Compilare il Luogo delle nozze"; pubblicaerrore('containererrorluogo',1, testo); test++;} else { pubblicaerrore('containererrorluogo',0, ''); } if(cellulare.length<2) { testo="Compilare il campo Cellulare"; pubblicaerrore('containererrorcellulare',1, testo); test++;} else { pubblicaerrore('containererrorcellulare',0, ''); } if(datanozze.length<2) { testo="Compilare la data delle nozze"; pubblicaerrore('containererrordatanozze',1, testo); test++;} else { pubblicaerrore('containererrordatanozze',0, ''); } // if(testoconsenso!="") { jQuery('#containererrordatanozze').html(testonome); jQuery('#containererrordatanozze').removeClass('dn');} if(consenso===false) { testo="È necessario accettare il trattamento della normativa privacy"; pubblicaerrore('containererrorconsenso',1, testo); test++; } else { pubblicaerrore('containererrorconsenso',0, ''); } if(test==0) { allok(nome, cognome, email, luogo, cellulare, datanozze, consenso, test); } }); } function allok(nome, cognome, email, luogo, cellulare, datanozze, consenso,test){ regione= jQuery('.datigeo span.dn[data-geo="administrative_area_level_1"]').html(); stato= jQuery('.datigeo span.dn[data-geo="country_short"]').html(); indirizzo= jQuery('.datigeo span.dn[data-geo="formatted_address"]').html(); lng= jQuery('.datigeo span.dn[data-geo="lng"]').html(); lat= jQuery('.datigeo span.dn[data-geo="lat"]').html(); cap= jQuery('.datigeo span.dn[data-geo="postal_code"]').html(); citta= jQuery('.datigeo span.dn[data-geo="locality"]').html(); provincia= jQuery('.datigeo span.dn[data-geo="administrative_area_level_2_short"]').html(); provinciaext= jQuery('.datigeo span.dn[data-geo="administrative_area_level_2"]').html(); jQuery.ajax({ type: "POST", url: registrazione.ajax_url, data: { action: 'registrazione', email: email, regione: regione, stato: stato, indirizzo: indirizzo, lng: lng, lat: lat, cap: cap, citta: citta, provincia: provincia, provinciaext: provinciaext, nome: nome, cognome: cognome, luogo: luogo, cellulare: cellulare, datanozze: datanozze, consenso: consenso }, beforeSend: function(xhr, opts){ } , success: function(html) { var redir=jQuery('#redirectto').data('value'); jQuery('body').html('

    Grazie per la registrazione, attendere prego...

    '); location.href=redir; } }); } function allokOperatore(nome, cognome, email, nomestruttura, telefono, telefonopubblico, categoria, sitoweb, consenso, test){ regione= jQuery('.datigeo span.dn[data-geo="administrative_area_level_1"]').html(); stato= jQuery('.datigeo span.dn[data-geo="country_short"]').html(); indirizzo= jQuery('.datigeo span.dn[data-geo="formatted_address"]').html(); lng= jQuery('.datigeo span.dn[data-geo="lng"]').html(); lat= jQuery('.datigeo span.dn[data-geo="lat"]').html(); cap= jQuery('.datigeo span.dn[data-geo="postal_code"]').html(); citta= jQuery('.datigeo span.dn[data-geo="locality"]').html(); provincia= jQuery('.datigeo span.dn[data-geo="administrative_area_level_2_short"]').html(); provinciaext= jQuery('.datigeo span.dn[data-geo="administrative_area_level_2"]').html(); jQuery.ajax({ type: "POST", url: intervista.ajax_url, data: { action: 'roperatore', nome: nome, cognome: cognome, email: email, nomestruttura: nomestruttura, telefono: telefono, telefonopubblico: telefonopubblico, categoria: categoria, sitoweb: sitoweb, regione: regione, stato: stato, indirizzo: indirizzo, lng: lng, lat: lat, cap: cap, citta: citta, provincia: provincia, provinciaext: provinciaext, consenso: consenso }, beforeSend: function(xhr, opts){ } , success: function(html) { var results=jQuery.trim(html); if(results.indexOf("OK")>0) { jQuery('body').html('

    Grazie per la registrazione, attendere prego...

    '); location.href='/backoffice-operatori'; } else { jQuery('#erroreregistrazione').html(html); } } }); } function pubblicaerrore(id,active,testo) { if(active==1) { jQuery('#' + id).html(testo); jQuery('#' + id).removeClass('dn'); } else { jQuery('#' + id).html(''); jQuery('#' + id).removeClass('dn').addClass('dn'); } } function registrazioneoperatore() { test=0; jQuery('#registrazioneoperatore').on('click',function(){ nome=jQuery('#nomeoperatore').val(); cognome=jQuery('#cognomeoperatore').val(); email=jQuery('#emailoperatore').val(); nomestruttura=jQuery('#nomestrutturaoperatore').val(); telefono=jQuery('#telefonooperatore').val(); telefonopubblico=jQuery('#telefonopubblicooperatore').val(); // categoria=jQuery('#categoriaoperatore').val(); var categoria=[]; jQuery("input[name='categoria']:checked").each(function(){ categoria.push($(this).val()); }); indirizzo=jQuery('#indirizzooperatore').val(); sitoweb=jQuery('#sitoweboperatore').val(); consenso=jQuery('#consenso').prop('checked'); if(!isValidEmailAddress(email)) { testo = "Compilare correttamente il campo Email"; pubblicaerrore('containererroremail', 1, testo); test++; } else if(email.length<2) { testo="Compilare il campo Email"; pubblicaerrore('containererroremail',1, testo); test++; } else { pubblicaerrore('containererroremail',0, ''); } if(nome.length<2) { testo="Compilare il campo Nome"; pubblicaerrore('containererrornome', 1, testo); test++;} else { pubblicaerrore('containererrornome', 0, ''); } if(cognome.length<2) { testo="Compilare il campo Cognome"; pubblicaerrore('containererrorcognome', 1, testo); test++;} else { pubblicaerrore('containererrorcognome', 0, ''); } if(nomestruttura.length<2) { testo="Compilare il nome della struttura"; pubblicaerrore('containererrornomestruttura', 1, testo); test++;} else { pubblicaerrore('containererrornomestruttura', 0, ''); } if(telefono.length<2) { testo="Compilare il numero di telefono"; pubblicaerrore('containererrortelefono', 1, testo); test++;} else { pubblicaerrore('containererrortelefono', 0, ''); } if(telefonopubblico.length<2) { testo="Compilare il numero di telefono"; pubblicaerrore('containererrortelefonopubblico',1, testo); test++;} else { pubblicaerrore('containererrortelefonopubblico',0, ''); } if(categoria.length<1) { testo="Indicare almeno una categoria"; pubblicaerrore('containererrorcategoria', 1, testo); test++;} else { pubblicaerrore('containererrorcategoria', 0, ''); } if(indirizzo.length<2) { testo="Compilare l'indirizzo"; pubblicaerrore('containererrorindirizzo', 1, testo); test++;} else { pubblicaerrore('containererrorindirizzo', 0, ''); } if(sitoweb.length<2) { testo="Compilare l'indirizzo del sito web"; pubblicaerrore('containererrorsitoweb', 1, testo); test++;} else { pubblicaerrore('containererrorsitoweb', 0, ''); } // if(testoconsenso!="") { jQuery('#containererrordatanozze').html(testonome); jQuery('#containererrordatanozze').removeClass('dn');} if(consenso===false) { testo="È necessario accettare il trattamento della normativa privacy"; pubblicaerrore('containererrorconsenso',1, testo); test++; } else { pubblicaerrore('containererrorconsenso',0, ''); } if(test===0) { allokOperatore(nome, cognome, email, nomestruttura, telefono, telefonopubblico, categoria, sitoweb, consenso, test); } }); } function gobackindex() { setTimeout(function(){ location.href="/"; },10000); } function openDatePicker(theid) { jQuery( "#"+theid ).datepicker(); jQuery.datepicker.regional['it'] = { clearText: 'Effacer', clearStatus: '', closeText: 'Chiudi', closeStatus: 'Chiudi senza modifiche', prevText: '< Prec', prevStatus: 'Mese precedente', nextText: 'Succ >', nextStatus: 'Mese successivo', // currentText: 'Courant', currentStatus: 'Voir le mois courant', monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno', 'Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'], monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'], // monthStatus: 'Voir un autre mois', yearStatus: 'Voir un autre année', weekHeader: 'Sm', weekStatus: '', dayNames: ['Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato'], dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'], dayNamesMin: ['Do','Lu','Ma','Me','Gi','Ve','Sa'], // dayStatus: 'Utiliser DD comme premier jour de la semaine', dateStatus: 'Choisir le DD, MM d', dateFormat: 'dd/mm/yy', firstDay: 0, initStatus: 'Scegli la data', isRTL: false }; jQuery.datepicker.setDefaults(jQuery.datepicker.regional['it']); jQuery("#"+theid).datepicker({ // yearRange: "-100:+0", dateFormat: 'dd/mm/yy', changeMonth: true, changeYear: true, regional:'it', }); } function isValidEmailAddress(emailAddress) { var pattern = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; if(pattern.test(emailAddress) && emailAddress !== '') { return true; } else { return false; } }; function checkboxAltriOperatori(){ jQuery('.altrioperatoricontainer').on('click',function(){ if(jQuery(this).find('.checkon').hasClass('dn')){ jQuery(this).find('.checkon').removeClass('dn'); jQuery(this).find('.checkoff').addClass('dn'); // remove from input[name='altrioperatori'] postid passo=jQuery(this).find('.checkon').data('id'); arOperatore(passo,1); } else { jQuery(this).find('.checkoff').removeClass('dn'); jQuery(this).find('.checkon').addClass('dn'); passo=jQuery(this).find('.checkon').data('id'); arOperatore(passo,0); // add in input[name='altrioperatori'] postid } }); } function arOperatore(valore, funzione) { if(funzione ===1){ // add value valorehidden=jQuery("input[name='altrioperatori']").val(); valorehidden= valore + ' ' + valorehidden ; jQuery("input[name='altrioperatori']").val(valorehidden); } if(funzione ===0){ // remove value valorehidden=jQuery("input[name='altrioperatori']").val(); arr=valorehidden.split(' '); var valoreout=""; for(i=0;i"; htmlO = htmlO + "Anche questi fornitori rispondono alle tue necessità e possono essere inclusi nella tua richiesta."; htmlO = htmlO + "NOTA: deseleziona quelli che non sono di tuo interesse prima di inviare."; htmlO = htmlO + ""; Object.keys(obj).forEach(function(key) { if(c>1) { c=0; } if(c===0) { htmlO = htmlO + ""; } obj2=obj[key]; var thumb=obj2['thumb']; var obj2id=obj2['id']; var url=obj2['url']; var title=obj2['title']; var localita=obj2['localita']; var provincia=obj2['provincia']; var prezzo=obj2['prezzo']; htmlO = htmlO +""; // htmlO = htmlO + ""; htmlO = htmlO + '\n'; htmlO = htmlO + ''; htmlO = htmlO + ""; htmlO = htmlO + "" ; htmlO = htmlO + ""; htmlO = htmlO + "" ; htmlO = htmlO + ""; htmlO = htmlO + ""; htmlO = htmlO + ""; htmlO = htmlO + ""; htmlO = htmlO + ""; htmlO = htmlO + title; htmlO = htmlO + ""; htmlO = htmlO + ""; htmlO = htmlO + ""; htmlO = htmlO + localita; htmlO = htmlO + ' (' + provincia + ')'; htmlO = htmlO + ""; htmlO = htmlO + ""; htmlO = htmlO + prezzo; htmlO = htmlO + ""; htmlO = htmlO + ""; htmlO = htmlO + ""; if(c===1) { htmlO=htmlO + ""; } c=(c*1)+1; }); if(c===1) { htmlO=htmlO + ""; } htmlO = htmlO + "
    RICEVERAI AL PIÙ PRESTO UN RISCONTRO PER FISSARE UN APPUNTAMENTO.
    "; htmlO = htmlO + "
    Con l'invio di questo form ti stai registrando e stai accettando le condizioni legali di guidasposi.it.
    "; htmlO = htmlO + '
    ' + 'Leggi l\'Informativa sulla privacy completa' + '
    ' + '' + '' + '' + '' + 'Accetto la normativa privacy di Guidasposi.it' + '' + '' + '' + '
    ' + '
    '; return htmlO; } function regeneratePageNavi() { // return ; if(jQuery('.wp-pagenavi a').length >0) { jQuery('.wp-pagenavi a').each(function () { jQuery(this).attr({'href': '#'}); valore=jQuery(this).html(); // jQuery(this).after('' + valore + ''); // jQuery(this).remove(); }); jQuery('.wp-pagenavi .gotopage').on('click',function(){ jQuery(this).addClass('clicked'); jQuery('#cropOperatorEngine').click(); }); } } function socialBlockPosition() { jQuery('.banner_wapper .h_social').removeClass('dn'); x=jQuery('.banner_wapper').height() - jQuery('.banner_wapper .h_social').height()-13; jQuery('.banner_wapper .h_social').css({'top':x+'px'}); } function beforeOwl(chiave, valore){ c='.' + chiave + ' .offers-box'; jQuery(c).removeClass('dn'); } function afterOwl(chiave, valore) { if(chiave=="homeslider") { setTimeout("socialBlockPosition();", 1000); } } /* * Builder delle slide * * */ function startSliders() { var param111={autoplay:true,loop:true,margin:0, nav:false,dots:true,responsive:{0:{items:1},600:{items:1},1000:{items:1}}}; param123={autoplay:false,loop:false,margin:30,nav:true,dots:false,responsive:{0:{items:1},600:{items:2},1000:{items:3}}}; param124={autoplay:false,loop:false,margin:30,nav:true,dots:false,responsive:{0:{items:1},600:{items:2},1000:{items:4}}}; x={ 'homeslider':param111, "in-primoslider":param123, "promozioni-slider":param124, "premiumslider":param123, "single-page-premiumslider":param124, "in-blogslider":param124 }; for (var key in x){ var chiave=key; var valore=x[key]; jQuery('.'+chiave).owlCarousel({ autoplay:valore['autoplay'], loop:valore['loop'], margin:valore['margin'], nav:valore['nav'], dots:valore['dots'], responsive:valore['responsive'], initialize:beforeOwl(chiave,valore), onInitialized:afterOwl(chiave, valore) }); } } function getCookie(name) { var value = "; " + document.cookie; var parts = value.split("; " + name + "="); if (parts.length == 2) return parts.pop().split(";").shift(); } function pSetGeoLoc(){ t=getCookie('geoLocProv'); var o, $ = jQuery; if (jQuery("#sfsel").length>0) { if (t == "") { if (jQuery('#sfsel').val() != "") { t = jQuery('#sfsel').val(); } } } if(1==2) { /* o = $("#ffsel"); if (o.length>0){ o.val(t).niceSelect('update').change(); pOperatorSearchAjax(t); } // o = $("#sfsel"); if (o.length>0){ o.val(t).niceSelect('update').change(); pPromoSearchAjax(t); } */ } // --- /* o = $("#innerfsel"); if (o.length>0){ o.val(t).niceSelect('update').change(); // pInnerSearchAjax(t); } */ // Categories jQuery(".ubermenu-submenu li a").each(function(index, element) { jQuery(this).attr( "href", jQuery(this).attr("href2")+"/"+t ); }); // Promozioni jQuery(".ubermenu-main li.ubermenu-item-level-0 a").each(function(index, element) { if(jQuery(this).text()=="Promozioni") { jQuery(this).attr("href", "/promozioni-" + t + "?paged=1"); } }); // --- } function pOpenPreventivoForm(){ var $ = jQuery; var o = $(".schedabox--preventivo a:first-child"); if (o.length==0) return; // o.first().click(); $(".schedabox--preventivo div.showhide").slideDown(); $("body, html").animate({ scrollTop: o.offset().top -50 }, 500); // $(".pOperatorPreventivo").hide().parent().remove(); } /** Load delayed images **/ pGetJollyImageK = Math.floor(Math.random() * 10); function pGetJollyImage(){ var s = "/wp-content/uploads/2018/01/0"+pGetJollyImageK+"_IMG-jolly.jpg"; pGetJollyImageK = (pGetJollyImageK+1) % 10; return(s); } function pGsLoadingImages(){ var wh=jQuery(window).height(); var woffset=jQuery(window).scrollTop(); // return; jQuery("img[data-src2]").each(function(index, element) { imOffsetT=jQuery(this).offset().top; imOffsetL=jQuery(this).offset().left; visibile=wh+woffset; var img = jQuery(this).data("src2"); if (img==='') { img = pGetJollyImage(); } if(imOffsetT < visibile) { jQuery(this).attr("src", img + "?6"); jQuery(this).removeData("src2"); jQuery(this).removeAttr("data-src2"); } }); jQuery("div[data-src2]").each(function(index, element) { imOffsetT=jQuery(this).offset().top; imOffsetL=jQuery(this).offset().left; visibile=wh+woffset; img = jQuery(this).data("src2"); if (img=='') { img = pGetJollyImage(); } if(imOffsetT < visibile) { jQuery(this).css("background-image", "url(" + img + ")"); jQuery(this).removeData("src2"); jQuery(this).removeAttr("data-src2"); } }); jQuery("a[data-src2]").each(function(index, element) { imOffsetT=jQuery(this).offset().top; imOffsetL=jQuery(this).offset().left; visibile=wh+woffset; img = jQuery(this).data("src2"); if (img==='') { img = pGetJollyImage(); } if(imOffsetT < visibile) { jQuery(this).css("background-image","url("+img+")"); jQuery(this).removeData("src2"); jQuery(this).removeAttr("data-src2"); } else { } }); /* x=jQuery("a[data-src2]").length; y=jQuery("img[data-src2]").length; z=jQuery("div[data-src2]").length; if(x>0 || y>0 || z>0) { setTimeout(function(){ pGsLoadingImages(); },1000); } else { return; } */ } function pSetSameHeight(o){ var h = 0; // pDebug("pSetSameHeight: "+$(o).length); jQuery(o).each(function(index, element) { var t = jQuery(this).height(); if (t>h) h = t; }); if (h>0) { jQuery(o).height(h); } } function pHomeResize(){ // return; var $ = jQuery; sw = $(window).width(); sh = $(window).height(); // pDebug("pHomeResize "+sw+" "+sh); // --- Images always 4:3 $(".home-offers-slider .offers-box .imgbox a").each(function(index, element) { $(this).css("min-height", $(this).width()/4*3 ); }); // --- pSetSameHeight(".in-primoslider .offers-box h3"); pSetSameHeight(".promozioni-slider .offers-box h3"); pSetSameHeight(".premiumslider .offers-box h3"); pSetSameHeight(".articoli-bottom .articoli-box h3"); pSetSameHeight(".pSearchResults .articoli-box"); pSetSameHeight(".pCategoryList .articoli-box"); // --- var o = $(".footer-top .f-help-center.pFixedBottom"); if (o.length>0) o.css("left", ((sw-1170)/2)+1170-250 ); // --- } function exStartup(){ var jQuery = $; // pDebug('Guidasposi'); jQuery(window).resize(pHomeResize); setTimeout("pHomeResize();",100); jQuery(window).on("scroll", function(){ pGsLoadingImages(); if(jQuery('.footer-new').length > 0 && jQuery('.footer-top').length > 0) { var ph = jQuery(window).scrollTop() + jQuery(window).height(); var fh = jQuery(".footer-new").offset().top; var o = jQuery(".footer-top .f-help-center"); if (ph < fh) { o.addClass("pFixedBottom"); pHomeResize(); } else { o.removeClass("pFixedBottom").css("left", ""); } } }); // --- jQuery(".pFastMessage .pCloseIcon").click(function(e) { jQuery(".footer-top .f-help-center").show(); jQuery(".pFastMessage").hide(); jQuery(".pFastMessage div.wpcf7-response-output").hide(); jQuery(".pFastMessage .pFormCont span.wpcf7-not-valid-tip").hide(); }); jQuery(".footer-top .f-help-center").click(function(e) { /* jQuery(".wp-live-chat-header").click(); jQuery("#wp-live-chat-header").show(); //*/ jQuery(".footer-top .f-help-center").hide(); jQuery(".pFastMessage").slideDown(); }); // --- // pGsLoadingImages(); // --- jQuery(".risultato_ricerca_fornitori h3").click(function(e) { var o = jQuery(".affina-box .links_consigliati"); if (o.is(":visible")){ o.slideUp(); jQuery(".risultato_ricerca_fornitori h3 span").removeClass("active"); }else{ jQuery(".risultato_ricerca_fornitori h3 span").addClass("active"); o.slideDown(); } }); if (urlParam('query')!='') jQuery(".affina-box .links_consigliati").show(); // --- jQuery(".ubermenu-submenu li a").each(function(index, element) { jQuery(this).attr( "href2", (""+jQuery(this).attr("href")).split('/matrimonio/').join('/') ); }); // --- /* var geoLoc_prov = getCookie("geoLocProv"); if (gv_curProv!=''){ pSetGeoLoc(gv_curProv); }else if (geoLoc_prov!=''){ pSetGeoLoc(geoLoc_prov); }else if (geoLoc_prov!=''){ jQuery.get("https://api.ipdata.co", function (response) { // city: "Turin", region: "Piedmont" // pDebug(response); var c = (""+response.city).toLowerCase(); var r = (""+response.region).toLowerCase(); var k, t = ''; // --- for (k=0;k0) { jQuery("input[data-pGeoAddress]").geocomplete({ country: 'it', details: ".details", detailsAttribute: "data-geo" }).bind("geocode:result", function (event, result) { var lat = result.geometry.location.lat() ; var lng = result.geometry.location.lng() ; jQuery("input[data-pGeoLat]").val(lat); // jQuery("input[data-pGeoLat]").attr({'pGeoLat':lat}); jQuery("input[data-pGeoLng]").val(lng); // jQuery("input[data-pGeoLng]").attr({'pGeoLng':lng}); setCookie("pGeoLat", lat, 3600); setCookie("pGeoLng", lng, 3600); }) } // --- jQuery(".commentlist .avatar").removeClass("grav-hashed").removeClass("grav-hijack"); // jQuery(".pVideoCont .fluid-width-video-wrapper").removeClass(".fluid-width-video-wrapper").css("padding-top",""); // --- if (isFF) jQuery("head").append(''); // --- var ck = false; if ( document.cookie && document.cookie.match(/cookie=1/) ) { ck = true; } /* if ( !ck ) { jQuery("body").append( "" ); jQuery("a[data-setc='closecookie']").click( function (e) { jQuery("#cookie").remove(); document.cookie = [ encodeURIComponent('cookie'), '=1', //'; expires=Sat, 31 Dec 2050 00:00:00 UTC', // IMPOSTATO COSI, CIOE' SENZA SCADENZA, IL COOKIE SCADE ALLA CHIUSURA DEL BROWSER. Per impostare una scadenza temporale rimuovere il commento dalla riga precedente // '; path=/' ].join(''); } ); } */ // --- if (jQuery(".pOperatorsAdvantageCont").length>0){ var h1 = jQuery(".pOperatorsAdvantageCont .aziende-banner--top").height(); var h2 = jQuery(".pOperatorsAdvantageCont .pOperatorsLogin .pTitle").height(); jQuery(".pOperatorsAdvantageCont .pOperatorsLogin .pFormCont").height(h1-h2-16); } // --- Javascript Alert Disabled Everywhere window.alert = function() {}; alert = function() {}; } // --- function pShowRegUserPopupCont(){ jQuery(".pOnlyRegUserPopupCont").fadeIn(); } // --- function pHideRegUserPopupCont(){ jQuery(".pOnlyRegUserPopupCont").fadeOut(); } /* function pDebug(s){ if (isIE) return; if (console) if (console.log) console.log(s); } */ function urlParam(name){ var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(top.window.location.href); return (results !== null) ? results[1] : ""; } function setCookie(cname,cvalue,exsec) { var d = new Date(); d.setTime(d.getTime()+exsec*1000); document.cookie = cname + "=" + cvalue + "; path=/; expires="+d.toGMTString(); } function getCookie(cname){ var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i