// load scripts for replaced elements var isExecuteLoad = false; document.addEventListener('swup:pageView', function(e) { $( document ).trigger('inizialize'); if (isExecuteLoad) { $( document ).trigger('executeReady'); $( window ).trigger('load'); } else { $('.transition-fade').addClass('finished'); } isExecuteLoad = true; }); document.addEventListener('swup:transitionStart', function(e) { $('.transition-fade').removeClass('finished'); $(document).trigger('removeEvent'); }); document.addEventListener("swup:transitionEnd", function(e){ $('.transition-fade').addClass('finished'); }); $.fn.isInViewport = function(offset) { var $el = $(this); if (offset === undefined) offset = 50; var elementTop = $el.offset().top; var elementBottom = elementTop + ($el.outerHeight() * offset / 100); var viewportHeight = $(window).height(); var viewportToll = 15; var viewportTop = $(window).scrollTop() - viewportToll; var viewportBottom = viewportTop + viewportHeight + (viewportToll * 2.0); if (offset < 0) return elementTop < viewportBottom && elementBottom < viewportBottom; else { return elementBottom >= viewportTop && elementTop < viewportBottom && elementBottom < viewportBottom; } }; var loadScript = function (path) { var result = $.Deferred(); var script = document.createElement("script"); script.async = "async"; script.type = "text/javascript"; script.src = path; script.onload = script.onreadystatechange = function(_, isAbort) { if (!script.readyState || /loaded|complete/.test(script.readyState)) { if (isAbort) result.reject(); else result.resolve(); } }; script.onerror = function () { result.reject(); }; $("head")[0].appendChild(script); return result.promise(); } function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie.replace(/\+/g, ' ')); var ca = decodedCookie.split(';'); for(var i = 0; i ') }); $('.clm-recaptcha').each(function( index ) { recaptcha_form = $(this).closest("form"); // recupera la callback success per il recaptcha di google del form, // se non esiste mette quella di default if (recaptcha_form.data('gcallback') === undefined) gcallback = onSuccessRecaptcha; else gcallback = window[recaptcha_form.data('gcallback')]; // render il recaptcha clmrecaptchaID[index] = this.id; clmrecaptchaFunc[index] = grecaptcha.render(this.id, { 'sitekey' : '6LdIcRgUAAAAAPqxP2-P1h1HaFM2hVJvcGWHO0hs', 'callback' : gcallback, 'error-callback' : onErrorRecaptcha, 'size' : 'invisible' }); }); }; function adsBlocked(callback){ var testURL = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js' var myInit = { method: 'HEAD', mode: 'no-cors' }; try { var myRequest = new Request(testURL, myInit); fetch(myRequest).then(function(response) { return response; }).then(function(response) { callback(false) }).catch(function(e){ callback(true) }); } catch (e) { callback(false) }; } function showStatusCookie() { var policyCookieConsent = getCookie('policyCookieConsent'); var policyCookiePreferences = getCookie('policyCookiePreferences'); var policyCookieStatistics = getCookie('policyCookieStatistics'); var policyCookieMarketing = getCookie('policyCookieMarketing'); var policyCookieUnique = getCookie('policyCookieUnique'); var policyCookieLanguage = 0; if (getCookie('lang_id') != 1) policyCookieLanguage = 1; var txtPolicyCookieStatusDeclineDef = ['Rifiuta', 'Reject']; var txtPolicyCookieStatusConfirmDef = ['Accetta selezionati', 'Allow selection']; var txtPolicyCookieStatusNecessaryDef = ['Tecnici', 'Technical']; var txtPolicyCookieStatusPreferencesDef = ['Preferenze', 'Preference']; var txtPolicyCookieStatusStatisticsDef = ['Statistici', 'Statistical']; var txtPolicyCookieStatusMarketingDef = ['Marketing', 'Marketing']; var txtPolicyCookieStatus = "---"; var txtPolicyCookieStatusSelect = ""; var txtPolicyCookieDate = '---'; var txtPolicyCookieUnique = '---'; if (policyCookieConsent == "") { $('.cookie-btn-erase').hide(); } else if (policyCookieConsent == "0") { txtPolicyCookieStatus = txtPolicyCookieStatusDeclineDef[policyCookieLanguage]; txtPolicyCookieStatusSelect = '('+txtPolicyCookieStatusNecessaryDef[policyCookieLanguage]+')'; txtPolicyCookieDate = getCookie('policyCookieDate'); } else if (policyCookieConsent == "1") { txtPolicyCookieStatus = txtPolicyCookieStatusConfirmDef[policyCookieLanguage]; txtPolicyCookieStatusSelect = '('+txtPolicyCookieStatusNecessaryDef[policyCookieLanguage]; if (policyCookiePreferences == "1") txtPolicyCookieStatusSelect += ', '+txtPolicyCookieStatusPreferencesDef[policyCookieLanguage]; if (policyCookieStatistics == "1") txtPolicyCookieStatusSelect += ', '+txtPolicyCookieStatusStatisticsDef[policyCookieLanguage]; if (policyCookieMarketing == "1") txtPolicyCookieStatusSelect += ', '+txtPolicyCookieStatusMarketingDef[policyCookieLanguage]; txtPolicyCookieStatusSelect += ')'; txtPolicyCookieDate = getCookie('policyCookieDate'); } if (policyCookieUnique != "") txtPolicyCookieUnique = policyCookieUnique; $('.statusConsent').html(txtPolicyCookieStatus + ' ' +txtPolicyCookieStatusSelect); $('.dateConsent').html(txtPolicyCookieDate); $('.dateUniqueId').html(txtPolicyCookieUnique); } $(window).on("load", function() { showStatusCookie(); $(window).off('eventCookieUpdate'); $(window).on('eventCookieUpdate', function() { var policyCookieUnique = getCookie('policyCookieUnique'); var sendInfo = { 'p': !window.policyCookiePreferences, 's': !window.policyCookieStatistics, 'm': !window.policyCookieMarketing, 'i': '80.88.87.58', 'u': 'www.colomboprova.com', 't': 0, }; if (policyCookieUnique != "") sendInfo['uq'] = policyCookieUnique; if (policyCookieRequired1 == '0') sendInfo['d'] = true; $.ajax({ type: "PUT", url: 'https://registro-cookie.colombo3000.com/api/update', beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer t-7614f875-8423-4f20-a674-d7cf3096290e'); }, data: JSON.stringify(sendInfo), contentType: "application/json; charset=utf-8", }) .done(function(datiJSON){ SetCookie('policyCookieUnique', datiJSON.uq, 365); $('.dateUniqueId').html(datiJSON.uq); }) .fail(function(data, textStatus, errorThrown) { }); }); var lang = getCookie('lang'); $('form input, form select, form textarea, form button').bind('focus.recaptcha', function() { loadScript("https://www.colomboprova.com/js/recaptcha.js.php").then(function() { }); $('form input, form select, form textarea, form button').unbind('focus.recaptcha'); }); }); lazyExecute = function(el) { $(el).lazy({ delay:-1, afterLoad: function(element) { $.event.trigger({ type: "lazyAfterLoad", time: new Date(), element : element }); $(window).trigger('resize'); }, onFinishedAll: function() { $.event.trigger({ type: "lazyComplete", time: new Date() }); $(window).trigger('resize'); } }); } $(window).on('load', function() { $('.lazy').each(function() { if ($(this).closest('.waitLazyLoad').length == 0) { lazyExecute(this); } }); }); // lunghezza calcolata al caricamento della pagina e ad ogni resize della schermata var actualWidth; $( document ).ready(function() { $(document).trigger('executeReady'); }); $( document ).on('executeReady', function() { $(document).on('change', '[type="radio"]', function() { var name = $(this).attr('name'); $('[name="'+name+'"]').removeAttr('required'); }); $("#bottom-to-top").click(function() { $("html, body").animate({ scrollTop: 0 }, "slow"); return false; }); $('[data-toggle="tooltip"]').tooltip(); $( ".table" ).each(function( index ) { if (!$(this).parent().hasClass("table-responsive")) { $(this).wrap( "
" ); } }); $('.carousel').carousel(); $('.modal').modal('hide'); $('.dropdown-submenu > a').on("click", function(e) { e.preventDefault(); var submenu = $(this); var isShow = submenu.next('.dropdown-menu').hasClass('show'); $('.dropdown-submenu .dropdown-menu').removeClass('show'); if (!isShow) { submenu.next('.dropdown-menu').addClass('show'); } e.stopPropagation(); }); $('.dropdown').on("hidden.bs.dropdown", function() { // hide any open menus when parent closes $('.dropdown-menu.show').removeClass('show'); }); //One Animated /* var is_iOS = ( /iPhone|iPad|iPod/i.test(navigator.userAgent) ); // le animazioni waypoint laterali estendono la pagina causando problemi di visualizzazione nei sistemi operativi IOS // le animazioni waypoint disabilitate if(is_iOS) { $('.animated').css("opacity", "1"); } else { */ $('.animated:not([data-delay],[data-order])').each(function() { var element = this.element; if (element === undefined) $element = $(this); else $element = $(element); var offset = $element.data('offset'); if (typeof offset === 'undefined') offset = 80; var context = window; var horizontal = false; var data_context = $element.data('context'); if (data_context !== undefined) { context = document.getElementById(data_context) horizontal = true; } $(this).waypoint(function() { var element = this.element; if (element === undefined) $element = $(this); else $element = $(element); var myAnimated = $element.data('animated'); var oneSomeAnimated = $element.data('oneanimated'); // animazione da eseguire una singola volta if (oneSomeAnimated == true) { // animazione non e' stata gia' eseguita in tal caso la esegue if (!($element.hasClass(myAnimated))) $element.toggleClass($element.data('animated')).css("opacity", "1"); // animazione da eseguire sempre } else $element.toggleClass($element.data('animated')); }, { offset: offset+'%', context: context, horizontal: horizontal, }); }); $('.animated[data-order="0"]').each(function() { var element = this.element; if (element === undefined) $element = $(this); else $element = $(element); var offset = $element.data('offset'); if (typeof offset === 'undefined') offset = 80; var context = window; var horizontal = false; var data_context = $element.data('context'); if (data_context !== undefined) { context = document.getElementById(data_context) horizontal = true; } $(this).waypoint(function() { var element = this.element; if (element === undefined) $element = $(this); else $element = $(element); if ($element.hasClass('execute')) return; var myAnimated = $element.data('animated'); var group = $element.data('group'); $element.addClass("execute").addClass($element.data('animated')).css("opacity", "1"); $('[data-group="'+group+'"]').each(function( index ) { var el = $(this); var delay = el.data('delay') * el.data('order'); setTimeout( function() { el.addClass("execute").addClass(el.data('animated')).css("opacity", "1"); }, delay, el); }); }, { offset: offset+'%', context: context, horizontal: horizontal, }); }); $('.animated[data-delay="0"]').each(function() { var element = this.element; if (element === undefined) $element = $(this); else $element = $(element); var offset = $element.data('offset'); if (typeof offset === 'undefined') offset = 80; var context = window; var horizontal = false; var data_context = $element.data('context'); if (data_context !== undefined) { context = document.getElementById(data_context) horizontal = true; } $(this).waypoint(function() { var element = this.element; if (element === undefined) $element = $(this); else $element = $(element); if ($element.hasClass('execute')) return; var myAnimated = $element.data('animated'); var group = $element.data('group'); $element.addClass("execute").addClass($element.data('animated')).css("opacity", "1"); $('[data-group="'+group+'"]').each(function( index ) { var el = $(this); var delay = el.data('delay'); setTimeout( function() { el.addClass("execute").addClass(el.data('animated')).css("opacity", "1"); }, delay, el); }); }, { offset: offset+'%', context: context, horizontal: horizontal, }); }); /* } */ // Effect input $(document).on("blur", 'form input, form textarea, form select', function(){ if($(this).val().length !== 0) { $(this).addClass('filled'); } else { $(this).removeClass('filled'); } }); }); // Inizializza l'effetto input function init_form(form_id) { $.each($('input, textarea, select', '#'+form_id),function(e){ if($(this).val().length !== 0) { $(this).addClass('filled'); } else { $(this).removeClass('filled'); } }) } var sendVirtualEvent = function(eventForce, eventItem) { if (eventForce === undefined) eventForce = ""; if (eventItem === undefined) eventItem = null; $.post({ url: "https://www.colomboprova.com/admin/includes/ajax/ajax_frontend.php", data: { "type": "sendVirtualEvent", "url" : window.location.href, "lang" : getCookie('lang'), "eventForce" : eventForce, "eventItem" : eventItem, } }) .done(function(data ) { datiJSON = JSON.parse(data); if (datiJSON.event != "") { window.dataLayer.push({ event: datiJSON.event, event_name: datiJSON.event_name, item: datiJSON.item, }); } }); } var supportsCssVariables = (window.CSS && window.CSS.supports && window.CSS.supports('--fake-var', 0)); function functionOffset() { var offsetH = $('#top_content').outerHeight(true); return offsetH; } $(window).on('load', function() { if ($('.pswp').length > 0) { loadScript("https://www.colomboprova.com/js/jquery.photoswipe.min.js").then(function() { loadScript("https://www.colomboprova.com/js/simple-gallery.min.js").then(function() {}); }); } }); $(window).on('load resize', function() { console.log($('iframe.frame')); if ($('iframe.frame').length) { if ($(window).width() < 440) { var wH = $(window).height(); wH -= 65; $('iframe.frame').css({ "min-height": wH+"px", }); } else { $('iframe.frame').css({ "min-height": "calc(100vh - 65px)", }); } } }); $(window).on('load', function(){ $('.btn-toggle').click(function() { var $el = $(this); if ($el.hasClass('active')) { $('.nav__menu__list').removeClass('show'); $el.removeClass('active'); } else { $('.nav__menu__list').addClass('show'); $el.addClass('active'); } }); $('[data-fx="change"]').on('click', function() { var size = $(this).attr('data-size'); $('.frame-wrapper').removeClass('show'); $('.frame-wrapper_'+size).addClass('show'); $('.nav__size__list__icon').removeClass('active'); $(this).addClass('active'); }); $('.hide-nav').on('click', function() { $('header').addClass('header_hidden'); $('.show-nav').show(); $('main').addClass('header_hidden'); }); $('.show-nav').on('click', function() { $('header').removeClass('header_hidden'); $('.show-nav').hide(); $('main').removeClass('header_hidden'); }); var previousScroll = 0; var previousScroll2= 0; $effectmenu = $('body header.top_change'); $effectmenu2 = $('body header'); if ($effectmenu.length > 0) { $(window).scroll(function() { var currentScroll = $(this).scrollTop(); var outerHeight = $effectmenu.outerHeight(); if ((currentScroll > outerHeight) && (currentScroll > previousScroll)) { $('header').addClass('sftop'); } if ((currentScroll < outerHeight) && (currentScroll < previousScroll)) { $('header').removeClass('sftop'); } previousScroll = currentScroll; }); }; if ($effectmenu2.length > 0) { $(window).scroll(function() { var currentScroll = $(this).scrollTop(); var outerHeight = $effectmenu2.outerHeight(); if ((currentScroll > outerHeight) && (currentScroll > previousScroll2)) { $('footer').addClass('sfbottom'); } if ((currentScroll < outerHeight) && (currentScroll < previousScroll2)) { $('footer').removeClass('sfbottom'); } previousScroll2 = currentScroll; }); }; });