var sendVirtualFBApi = function() { rand_event_id = randomInt(1000000); window.dataLayer.push({ event: 'VirtualFBApi', event_random_id: rand_event_id }); } document.addEventListener('swup:willReplaceContent', function(e) { sendVirtualFBApi(); }); // 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, id) { var result = $.Deferred(); var script = document.createElement("script"); if (id !== undefined) { script.id = id } 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' : '6LeQ3Q0fAAAAAJ85IBHH3NWb1HjIZl5ghOncqNdE', 'callback' : gcallback, 'error-callback' : onErrorRecaptcha, 'size' : 'invisible' }); }); }; $(window).on("load resize scroll", function() { if ($(".googlemaps").length > 0) { if ($(".googlemaps").isInViewport(0) && !isMapsLoaded) { isMapsLoaded = true; var lang = getCookie('lang'); loadScript("https://www.bixiopoderi.it/js/gmap.js.php").then(function() { var googleMap = document.createElement("script"); googleMap.src = "//maps.googleapis.com/maps/api/js?key=AIzaSyAR7-1v53_qBpTpZoW8y72Yow2rOCwBJ8s&callback=mapsCallback&language="+lang; googleMap.async = true; googleMap.defer = true; document.body.appendChild(googleMap); }); } } }); 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': '127.0.0.1', 'u': 'www.bixiopoderi.it', '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.bixiopoderi.it/js/recaptcha.js.php?20261030080820").then(function() { var googleRecaptcha = document.createElement("script"); googleRecaptcha.src = "https://www.google.com/recaptcha/api.js?hl="+lang+"&onload=onloadCallback&render=explicit"; googleRecaptcha.async = true; googleRecaptcha.defer = true; document.body.appendChild(googleRecaptcha); adsBlocked(function(blocked){ var exdate = new Date() var n = document.location.hostname.split("."); var e = n.slice(1).join("."); exdate.setDate(exdate.getDate() + 1) var value = 0; if (blocked) value = 1; document.cookie = "adblock=" + escape(value) + ";path=/;expires="+exdate.toGMTString(); }) }); $('form input, form select, form textarea, form button').unbind('focus.recaptcha'); }); }); lazyExecute = function(el, force) { if (force === undefined) force = true; var instance = $(el).lazy({ chainable: !force, delay:-1, afterLoad: function(element) { $(element).addClass('lazy-loaded'); $.event.trigger({ type: "lazyAfterLoad", time: new Date(), element : element }); }, onFinishedAll: function() { $.event.trigger({ type: "lazyComplete", time: new Date() }); } }); if (force) instance.force($(el)); } var scroll = null; var previousScroll = 0; var changeScroll = 0; var isGliderLoadedScroll = false; var isMasonryLoadedScroll = false; var scroll = null; var scrollWindowWidth = 0; var idxLazyImg = 0; var idxLazyVideo = 0; var idxLazyFrame = 0; var $aLazyPicture = null; var $aLazyVideo = null; var $aLazyFrame = null; var $aLazyStarted = false; var scroolUpdateAfterLazy = true; var initialHash = ''; $( document ).on('inizialize', function() { previousScroll = 0; isGliderLoadedScroll = false; isMasonryLoadedScroll = false; initialHash = ''; if (scroll !== null) { scroll.destroy(); scroll = null; } idxLazyImg = 0; idxLazyVideo = 0; idxLazyFrame = 0; $aLazyPicture = null; $aLazyVideo = null; $aLazyFrame = null; $aLazyStarted = false; scroolUpdateAfterLazy = true; }); $(window).on('lazyComplete', function() { if ($aLazyStarted) lazy_load(); }); var lazy_load = function() { if ($($aLazyPicture[idxLazyImg]).hasClass('lazy-loaded')) { idxLazyImg++; lazy_load(); return; } if (idxLazyImg < $aLazyPicture.length) { lazyExecute($aLazyPicture[idxLazyImg]); idxLazyImg++; } else { if ((idxLazyImg == $aLazyPicture.length) && (scroll !== null)) { idxLazyImg++; if (scroolUpdateAfterLazy) { setTimeout(function() { if (scroll !== null) { scroll.update(); $(document).trigger('scrollUpdateImage'); } }, 2000); } else { $(document).trigger('scrollUpdateImage'); } } if ($($aLazyVideo[idxLazyVideo]).hasClass('lazy-loaded')) { idxLazyVideo++; lazy_load(); return; } if (idxLazyVideo < $aLazyVideo.length) { lazyExecute($aLazyVideo[idxLazyVideo]); idxLazyVideo++; } else { if ((idxLazyVideo == $aLazyVideo.length) && (scroll !== null)) { idxLazyVideo++; if (scroolUpdateAfterLazy) { setTimeout(function() { if (scroll !== null) { scroll.update(); $(document).trigger('scrollUpdateVideo'); } }, 2000); } else { $(document).trigger('scrollUpdateVideo'); } } if ($($aLazyFrame[idxLazyFrame]).hasClass('lazy-loaded')) { idxLazyFrame++; lazy_load(); return; } if (idxLazyFrame < $aLazyFrame.length) { lazyExecute($aLazyFrame[idxLazyFrame]); idxLazyFrame++; } else { if ((idxLazyFrame == $aLazyFrame.length) && (scroll !== null)) { idxLazyFrame++; if (scroolUpdateAfterLazy) { setTimeout(function() { if (scroll !== null) { scroll.update(); $(document).trigger('scrollUpdateFrame'); } }, 2000); } else { $(document).trigger('scrollUpdateFrame'); } } } } } } var scroll_call_load = function(obj) { $('[data-scroll-call="load"]').removeAttr('data-scroll-call'); $aLazyStarted = true; lazy_load(); setTimeout(function() { if ($('.glider').length > 0) { if (!isGliderLoadedScroll) { $('', { rel: 'stylesheet', type: 'text/css', href: 'https://www.bixiopoderi.it/css/glider.min.css' }).appendTo('head'); isGliderLoadedScroll = true; loadScript("https://www.bixiopoderi.it/js/glider.min.js").then(function() { loadScript("https://www.bixiopoderi.it/js/glider.clm.min.js.php").then(function() {}); }); } } if ($('.gallery-mas').length > 0) { if (!isMasonryLoadedScroll) { isMasonryLoadedScroll = true; loadScript("https://www.bixiopoderi.it/js/imagesloaded.pkgd.min.js").then(function() { loadScript("https://www.bixiopoderi.it/js/masonry.pkgd.min.js").then(function() { loadScript("https://www.bixiopoderi.it/js/masonry.clm.min.js.php").then(function() {}); }); }); } } $(document).trigger('scrollCallLoad'); }, 1000); }; $(window).on('load', function() { $aLazyPicture = $('picture.lazy, img.lazy'); $aLazyVideo = $('video.lazy'); $aLazyFrame = $('iframe.lazy'); scrollWindowWidth = $(window).width(); initialHash = window.location.hash; if (initialHash) { removeHashFromUrl(); } var locomotive_arg = { el: document.querySelector('[data-scroll-container]'), smooth: true, tablet: { smooth: true }, smartphone: { smooth: true }, lerp: scrollWindowWidth < 960 ? .1 : .06, touchMultiplier: 2.5, }; if ($('[data-scroll-scrollbar]').length > 0) { locomotive_arg['scrollbarClass'] = 'c-myscrollbar'; } scroll = new LocomotiveScroll(locomotive_arg); $(document).trigger('scrollLoaded'); if (initialHash) { waitForLayout(); } function waitForLayout() { requestAnimationFrame(onFirstFrame); } function onFirstFrame() { requestAnimationFrame(onSecondFrame); } function onSecondFrame() { scrollToInitialHash(); } function scrollToInitialHash() { var target = document.querySelector(initialHash); if (!target || !scroll) return; scroll.update(); scroll.scrollTo(target, { 'offset': -functionOffset(), duration: 1000, }); restoreHashInUrl(); } function removeHashFromUrl() { var url = window.location.pathname + window.location.search; history.replaceState(null, '', url); } function restoreHashInUrl() { var url = window.location.pathname + window.location.search + initialHash; history.replaceState(null, '', url); } if ($('[data-scroll-call="load_delay"]').length > 0) { $('[data-scroll-call="load_delay"]').removeAttr('data-scroll-call'); setTimeout(function() { if ($('[data-scroll-call="load"]').length > 0) scroll_call_load(); }, 1000); } scroll.on("call", (fun, dir, obj) => { if (fun === "load") { scroll_call_load(obj); } }); $(document).on('click', 'a[href^="#"]', function(e) { e.preventDefault(); var elTo = $(this).attr('href'); if (elTo == "#") return false; scroll.scrollTo($(elTo)[0], { 'offset': -functionOffset(), 'duration': 1000 } ); return false; }); }); // 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).off('change', '[type="radio"]'); $(document).on('change', '[type="radio"]', function() { var name = $(this).attr('name'); $('[name="'+name+'"]').removeAttr('required'); }); $(document).off('change', 'select'); $(document).on('change', 'select', function() { if ($(this).val() !== "") { $(this).addClass('selected'); } else { $(this).removeClass('selected'); } }); $("#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'); }); execute_animated(); // Effect input $(document).on("blur", 'form input, form textarea, form select', function(){ if($(this).val().length !== 0) { $(this).addClass('filled'); } else { $(this).removeClass('filled'); } }); }); function execute_animated() { $(document).find('.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'); if (typeof myAnimated === 'undefined') myAnimated = 'in-view'; // 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(myAnimated).css("opacity", "1"); // animazione da eseguire sempre } else $element.toggleClass(myAnimated); }, { offset: offset+'%', context: context, horizontal: horizontal, }); }); $(document).find('.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'); if (typeof myAnimated === 'undefined') myAnimated = 'in-view'; $element.addClass("execute").addClass(myAnimated).css("opacity", "1"); $('[data-group="'+group+'"]').each(function( index ) { var el = $(this); var delay = el.data('delay') * el.data('order'); setTimeout( function() { var elAnimated = el.data('animated'); if (typeof elAnimated === 'undefined') elAnimated = 'in-view'; el.addClass("execute").addClass(elAnimated).css("opacity", "1"); }, delay, el); }); }, { offset: offset+'%', context: context, horizontal: horizontal, }); }); $(document).find('.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'); if (typeof myAnimated === 'undefined') myAnimated = 'in-view'; $element.addClass("execute").addClass(myAnimated).css("opacity", "1"); $('[data-group="'+group+'"]').each(function( index ) { var el = $(this); var delay = el.data('delay'); setTimeout( function() { var elAnimated = el.data('animated'); if (typeof elAnimated === 'undefined') elAnimated = 'in-view'; el.addClass("execute").addClass(elAnimated).css("opacity", "1"); }, delay, el); }); }, { offset: offset+'%', context: context, horizontal: horizontal, }); }); } // 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 isIE = /*@cc_on!@*/false || !!document.documentMode; if (!isIE) { var options = { LINK_SELECTOR: 'a[href^="https://www.bixiopoderi.it/"]:not([data-no-swup]):not([class^="thumb"]), a[href^="#"]:not([data-no-swup]):not([class^="thumb"])', cache:false, animateHistoryBrowsing:true, skipPopStateHandling: function(event){ if (event.state === null) return false; if (event.state && event.state.source == "swup" && !window.photoswipe_open) { return false; } window.photoswipe_open = false; return true; } }; var swup = new Swup(options); swup.use(new SwupHeadPlugin()); swup.use(new SwupScrollPlugin({functionOffset: "functionOffset"})); swup.use(new SwupPreloadPlugin()); swup.use(new SwupGtmPlugin()); swup.use(new SwupBodyClassPlugin()); const bodyClassPlugin = new SwupBodyClassPlugin({ prefix: 'page-' }); } var sendVirtualEvent = function(eventForce, eventItem) { if (eventForce === undefined) eventForce = ""; if (eventItem === undefined) eventItem = null; $.post({ url: "https://www.bixiopoderi.it/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 fbCapi = function(eventForce = "") { if (eventForce === undefined) eventForce = ""; if (eventForce != "") { sendVirtualFBApi(); } if (rand_event_id !== undefined) { var page = window.location.href; $.post({ url: "https://www.bixiopoderi.it/admin/includes/ajax/ajax_frontend.php", data: { "type": "fbCapi", "url" : page, "eventForce" : eventForce, "event_random_id" : rand_event_id, } }) .done(function(data ) { datiJSON = JSON.parse(data); if (datiJSON.event_send != "") { window.dataLayer.push({ event: datiJSON.event_send, fb_event_name: datiJSON.fb_event_name, }); } }) } } $( window ).on('load', function() { fbCapi(); $("[class*='gtag_phone']").on('click', function(e) { fbCapi('LeadPhone'); }); $("[class*='gtag_mail']").on('click', function(e) { fbCapi('LeadMail'); }); $("[class*='gtag_whatsapp']").on('click', function(e) { fbCapi('LeadWhatsapp'); }); $("[class*='gtag_map']").on('click', function(e) { fbCapi('ClickMap'); }); }); $( window ).on('load', function() { if ($(".popup-maker-modal").length > 0) { loadScript("https://www.bixiopoderi.it/js/popup_maker.js.php").then(function() {}); } }); $(window).on("load", function() { $(document).find('.carousel').each(function () { var $carousel = $(this); if ($carousel.attr('data-ride') === 'carousel') { return; } var $firstItem = $carousel.find('.carousel-item.active').first(); var $media = $firstItem.find('img, video').first(); var interval = parseInt($carousel.attr('data-interval'), 10); if (isNaN(interval)) { interval = 5000; } function startCarousel() { $carousel.carousel({ interval: interval, ride: 'carousel', pause: false }); } if ($media.length) { // Caso immagine if ($media.is('img')) { $media.on('load', function () { startCarousel(); }); // se già caricata da cache if ($media[0].complete) { $media.trigger('load'); } } // Caso video if ($media.is('video')) { if ($media[0].readyState >= 3) { startCarousel(); } else { $media.on('loadeddata', function () { startCarousel(); }); } } } else { // nessun media → parte subito startCarousel(); } }); }); var $filesToUploadContainer = undefined; var $filesToUploadList = undefined; var $filesToUploadInput = undefined; var $filesToUploadInputArray = undefined; $(document).on('inizialize', function() { $filesToUploadContainer = undefined; $filesToUploadList = undefined; $filesToUploadInput = undefined; $filesToUploadInputArray = undefined; }); function setFilesToUploadElement(el) { $filesToUploadContainer = $(el).closest('[data-type="filesToUpload"]'); $filesToUploadList = $filesToUploadContainer.find('[data-id="fileList"]'); $filesToUploadInputArray = $filesToUploadContainer.find('[data-id="filesToUpload"]'); } function updateFileList() { $filesToUploadList.html(''); if ($filesToUploadInputArray.length == 1) { $filesToUploadList.append('
  • Nessun file caricato!
  • '); } else { for (var i = 0; i < $filesToUploadInputArray.length - 1; i++) { $value = $filesToUploadInputArray[i]; files = $value.files[0]; files.idx = i; if (files.type.match('image.*')) { var reader = new FileReader(); reader.onload = (function(theFile) { return function(e) { $filesToUploadList.append('
  • x
  • '); }; })(files); // Read in the image file as a data URL. reader.readAsDataURL(files); } else { $filesToUploadList.append('
  • ' + files.name + ' x
  • '); } }; } } $(document).on('click', '[data-id="fileList"] li.success span', function() { setFilesToUploadElement(this); var indexLi = $(this).attr('data-id'); element = $filesToUploadInputArray[indexLi]; $(element).detach(); setFilesToUploadElement(this); updateFileList(); }); function errorFileList(msg) { // cancella elemento caricato $filesToUploadInput.val(''); updateFileList(); $filesToUploadList.append('
  • ' + msg + '
  • '); } // carica l'immagine $(document).on('change', '[data-id="filesToUpload"]', function(event) { // recupero elementi associati all'input $filesToUploadInput = $(this); setFilesToUploadElement(this); var currentFiles = event.target.files; var num_files = currentFiles.length; var type_mime = ""; var max_files = $filesToUploadContainer.attr('data-max-files'); var max_size = $filesToUploadContainer.attr('data-max-size'); if (max_files === undefined) max_files = 1; if (max_size === undefined) max_size = 5; if ((($filesToUploadInputArray.length - 1) + num_files) > max_files) { txt_max_files = 'ERRORE: Puoi caricare massimo {num} file'; txt_max_files = txt_max_files.replace("{num}", max_files); errorFileList(txt_max_files); return; } for (i = 0; i < num_files; i++) { var file = event.target.files[i]; if (file.size >= max_size*1024*1024) { txt_max_size = 'ERRORE: Dimensione massima di {num} Mb'; txt_max_size = txt_max_size.replace("{num}", max_size); errorFileList('File: '+file.name+' - '+txt_max_size); return; } var matchAccepter = $filesToUploadInput.attr('accept').split(','); var accept_ok = false; for (a=0; a < matchAccepter.length; a++) { if (file.type.match(matchAccepter[a])) accept_ok = true; } if (!accept_ok) { errorFileList('File: '+file.name+' - ERRORE: Formato del file non valido'); return; } $clone = $filesToUploadInput.clone(); $filesToUploadInput.parent().append($clone); $filesToUploadInput.removeClass('no-send'); setFilesToUploadElement(this); } updateFileList(); }); var isMenuOpen = false; var menuTriggered = false; $( document ).on('inizialize', function() { menuTriggered = false; }); $(window).on('lazyComplete', function() { if (scroll !== null) { scroll.update(); } }); var detectCollide = function() { var currentScroll = scroll.scroll.instance.scroll.y; changeScroll = 0; if (currentScroll > 50 && currentScroll > previousScroll) { changeScroll = 1; } if(currentScroll < 50 && currentScroll < previousScroll) { changeScroll = -1; } switch (changeScroll) { case 1: $("#top_content").addClass('scrolling'); break; case -1: $("#top_content").removeClass('scrolling'); break; } previousScroll = currentScroll; requestAnimationFrame(detectCollide); }; function newsletter_positive_response(element, datiJSON, value_class_hide) { $('#modal_newsletter').modal('hide'); $('#form_newsletter_ajax')[0].reset(); // sistema la sidebar $('#modal_result_newsletter .modal-body').html(datiJSON.positive_response); $('#modal_result_newsletter').modal('show'); setTimeout(function() {$('#modal_result_newsletter').modal('hide');}, 3000); } $(window).on('load', function() { requestAnimationFrame(detectCollide); if ($('.pswp').length > 0) { loadScript("https://www.bixiopoderi.it/js/jquery.photoswipe.min.js").then(function() { loadScript("https://www.bixiopoderi.it/js/simple-gallery.min.js").then(function() {}); }); } /*NAVBAR COLLAPSED CLICK BUTTON*/ isMenuOpen = false; $(document).off("click", ".navbar-toggler"); $(document).on("click", ".navbar-toggler", function() { if (!menuTriggered) { scroll_call_load(); menuTriggered = true; } var nav = $(this).parents("#top_content").first(); if (!isMenuOpen) { isMenuOpen = true; nav.addClass("collapsed-open"); currentPageLink.find(".nav-link").trigger("mouseenter"); if ($(".container-video").length > 0) { $(".container-video").addClass("covered"); } } else { isMenuOpen = false; nav.removeClass("collapsed-open"); if ($(".container-video").length > 0) { $(".container-video").removeClass("covered"); } } }); /*NAVBAR SCROLLING EFFECT*/ /*if($(window).scrollTop() > 50) { $("#top_content").addClass("scrolling"); } else { $("#top_content").removeClass("scrolling"); }*/ /*NAV IMGS MANAGER*/ var currentPageLink; if ($("#menu-top .nav-item.act").length > 0) { currentPageLink = $("#menu-top .nav-item.act"); } else { currentPageLink = $("#menu-top .nav-item:first-child"); } var triggerImgClass = currentPageLink.attr("data-hover"); currentPageLink.find(".nav-link").trigger("mouseenter"); $(".nav-img-item").addClass("active"); $("#menu-top .nav-item .nav-link").hover(function() { var classActive = $(this).attr("data-hover"); if(classActive == undefined) { classActive = ''; } $(".nav-img-item").each(function() { $(this).removeClass("active"); }); $(".nav-img-item." + classActive ).addClass("active"); }); /*EFFETTO MAPPA INDEX*/ if($("#moving-area").length > 0) { document.getElementById("moving-area").onmousemove = handmousemove; document.getElementById("moving-area").onmouseout = handmousedefault; } }); /* $(window).on('scroll', function() { if($(window).scrollTop() > 50) { $("#top_content").addClass("scrolling"); } else { $("#top_content").removeClass("scrolling"); } }); */ $(window).on('resize', function() { if(window.innerWidth > 767 && isMenuOpen) { $(".navbar-toggler").trigger("click"); } }); function handmousemove(e) { if(window.innerWidth > 767) { // e = Mouse click event. var rect = e.target.getBoundingClientRect(); var mouseOffsetX = e.clientX - rect.left; //x position within the element. var mouseOffsetY = e.clientY - rect.top; //y position within the element. var windowHalfW = (window.innerWidth / 2) + 1; var windowHalfH = (window.innerHeight / 2) + 1; var movingElem = $("#moving-area").find(".moving-content"); if(mouseOffsetX > windowHalfW && mouseOffsetY > windowHalfH) { movingElem.css({"transform":"translate(-0.5%,-0.5%) scale(1.02)"}); } else if(mouseOffsetX > windowHalfW && mouseOffsetY < windowHalfH) { movingElem.css({"transform":"translate(-0.5%,0.5%) scale(1.02)"}); } else if(mouseOffsetX < windowHalfW && mouseOffsetY < windowHalfH) { movingElem.css({"transform":"translate(0.5%,0.5%) scale(1.02)"}); } else if(mouseOffsetX < windowHalfW && mouseOffsetY > windowHalfH) { movingElem.css({"transform":"translate(0.5%,-0.5%) scale(1.02)"}); } } } function handmousedefault() { if(window.innerWidth > 767) { var movingElem = $("#moving-area").find(".moving-content"); movingElem.css({"transform":"translate(0%,0%) scale(1)"}); } }$(window).on('load', function(){ });$(window).on('load', function(){ $(document).on('click', '.video__item__box__desc__read', function() { $(this).parent().addClass('open'); }); $(document).on('click', '.video__item__box__desc__unread', function() { $(this).parent().removeClass('open'); }); });$(window).on('load', function(){ });$(window).on('load', function(){ });