{"version":3,"file":"src/js/main.js","sources":["../../src/js/main.js"],"sourcesContent":["//export default class Main {\r\n\r\n//\tconstructor() {\r\n//\t\tthis.init();\r\n//\t}\r\n\r\n//\tinit() {\r\n//\t\talert('ciao');\r\n//\t\tconst body = document.querySelector('body');\r\n//\t\tbody.classList.add('ready');\r\n\r\n//\t\tconst mainContainerNode = document.querySelector('main .container');\r\n\r\n//\t\tconst messageNode = document.createElement('div');\r\n//\t\tmessageNode.innerHTML = /* html */ `
\r\n//\t\t\tI'm an ES6 module! ES6\r\n//\t\t
`;\r\n//\t\tmainContainerNode.appendChild(messageNode);\r\n//\t}\r\n\r\n//}\r\n\r\n//const main = new Main();\r\n\r\nvar windowW,\r\n\twindowH,\r\n\theaderH,\r\n\tbodyH,\r\n\tsideFilterTop,\r\n\tfooterTop,\r\n\tcorrelatiTop,\r\n\tfakeFooterTop,\r\n\tfilterTop,\r\n\tmapH;\r\n\r\n/*--------------------------------------------------\r\nFUNZIONI\r\n--------------------------------------------------*/\r\nfunction myVar() {\r\n\twindowW = $(window).width();\r\n\twindowH = $(window).height();\r\n\theaderH = $('.header').outerHeight();\r\n\tbodyH = $('body').height();\r\n\tfilterTop = $('.col-filter-dx').length ? $('.col-filter-dx').offset().top : 0;\r\n\tmapH = windowH - filterTop - 20;\r\n\t//console.log(windowH + '/' + filterTop + '/' + headerH);\r\n\tif ($('.side-filter').length) {\r\n\t\tsideFilterTop = $('.side-filter').offset().top - 20;\r\n\t}\r\n\tif ($('#gmap').length) {\r\n\t\t$('#gmap').height(mapH);\r\n\t}\r\n\r\n\tfooterTop = ($('.footer').offset().top - windowH) + headerH;\r\n\tif ($('.elenco-correlati').length) {\r\n\t\tcorrelatiTop = ($('.elenco-correlati').offset().top - windowH) + headerH;\r\n\t}\r\n\r\n\tif (!$('.elenco-correlati').length) {\r\n\t\tfakeFooterTop = footerTop;\r\n\t} else {\r\n\t\tfakeFooterTop = correlatiTop;\r\n\t}\r\n}\r\n\r\nfunction controllScroll(scrollo) {\r\n\t//console.log(scrollo + '/ filterTop: ' + sideFilterTop + '/ footerTop: ' + footerTop);\r\n\r\n\tif ($('.slideshow').not($('.landing .slideshow')).length) {\r\n\t\tif (scrollo > $(window).height() / 3) {\r\n\t\t\t$('.header').addClass('fixed');\r\n\t\t} else {\r\n\t\t\t$('.header').removeClass('fixed');\r\n\t\t}\r\n\t}\r\n\r\n\tif (scrollo > 40) {\r\n\t\t$('.scroll-down, .scroll-bottom').addClass('disabled');\r\n\t} else {\r\n\t\t$('.scroll-down, .scroll-bottom').removeClass('disabled');\r\n\t}\r\n\r\n\tif (scrollo > windowH - (headerH + 40)) {\r\n\t\t$('.scroll-top').addClass('active');\r\n\r\n\t\tif (scrollo > $('.footer').offset().top + $('.footer').height() - $(window).height()) {\r\n\t\t\t$('.scroll-top').addClass('arrived');\r\n\t\t} else {\r\n\t\t\t$('.scroll-top').removeClass('arrived');\r\n\t\t}\r\n\t} else {\r\n\t\t$('.scroll-top').removeClass('active');\r\n\t}\r\n\r\n\tif (!isMobile.tablet) {\r\n\t\tif (scrollo > sideFilterTop) {\r\n\t\t\t$('.side-filter').addClass('fixed').css({ 'top': headerH + 20, 'width': $('.col-filter-sx').outerWidth() });\r\n\t\t} else {\r\n\t\t\t$('.side-filter').removeClass('fixed').css({ 'top': 0 });\r\n\t\t}\r\n\t}\r\n\r\n\tif (scrollo > fakeFooterTop) {\r\n\t\t$('.side-filter').css({ 'top': (headerH + 20) - (scrollo - fakeFooterTop) });\r\n\t}\r\n\r\n\t//console.log(scrollo);\r\n\r\n\tif ($('.col-filter-dx').length) {\r\n\t\tif (scrollo > $('.col-filter-dx').offset().top - (windowH / 2) && scrollo > headerH) {\r\n\t\t\t$('.open-filters').addClass('active');\r\n\t\t} else {\r\n\t\t\tif (!$('.side-filter').hasClass('active')) {\r\n\t\t\t\t$('.open-filters').removeClass('active');\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction homepageRender() {\r\n\tif ($('.magnetic-scroll').size() && $(window).width() > 768 && $('html.touch').size() != 1) {\r\n\r\n\t\t$('body').addClass('fullpage');\r\n\r\n\t\t$('.magnetic-scroll').fullpage({\r\n\r\n\t\t\tlicenseKey: '8AB6B1ED-6647439B-AE46917C-7D6879D4 ',\r\n\t\t\t//Navigation\r\n\r\n\t\t\t//Scrolling\r\n\t\t\tcss3: true,\r\n\t\t\tscrollingSpeed: 700,\r\n\t\t\tautoScrolling: true,\r\n\t\t\tfitToSection: true,\r\n\t\t\tfitToSectionDelay: 1000,\r\n\t\t\tscrollBar: true,\r\n\t\t\teasing: 'easeInOutCubic',\r\n\t\t\teasingcss3: 'cubic-bezier(0.645, 0.045, 0.355, 1)',\r\n\t\t\tloopBottom: false,\r\n\t\t\tloopTop: false,\r\n\t\t\tloopHorizontal: false,\r\n\t\t\tcontinuousVertical: false,\r\n\t\t\t//normalScrollElements: '#news, #footer',\r\n\t\t\tnormalScrollElements: '',\r\n\t\t\tscrollOverflow: false,\r\n\t\t\ttouchSensitivity: 15,\r\n\t\t\tnormalScrollElementTouchThreshold: 5,\r\n\r\n\t\t\t//Accessibility\r\n\t\t\tkeyboardScrolling: true,\r\n\t\t\tanimateAnchor: true,\r\n\t\t\trecordHistory: true,\r\n\r\n\t\t\t//Design\r\n\t\t\tcontrolArrows: false,\r\n\t\t\tverticalCentered: false,\r\n\t\t\tresize: false,\r\n\t\t\tpaddingTop: '81px',\r\n\t\t\tpaddingBottom: '0',\r\n\t\t\tfixedElements: '',\r\n\t\t\tresponsiveWidth: 0,\r\n\t\t\tresponsiveHeight: 0,\r\n\r\n\t\t\t//Custom selectors\r\n\t\t\tsectionSelector: '.magnetic',\r\n\t\t\tslideSelector: '.no',\r\n\r\n\t\t\t//events\r\n\t\t\tonLeave: function (index, nextIndex, direction) { },\r\n\t\t\tafterLoad: function (anchorLink, index) { },\r\n\t\t\tafterRender: function () { },\r\n\t\t\tafterResize: function () { },\r\n\t\t\tafterSlideLoad: function (anchorLink, index, slideAnchor, slideIndex) { },\r\n\t\t\tonSlideLeave: function (anchorLink, index, slideIndex, direction, nextSlideIndex) { }\r\n\t\t});\r\n\t}\r\n}\r\n\r\nfunction subMenu() {\r\n\t$('.header .menu a').not($('.header .menu .actions-mobile a')).not($('.header .menu .social-mobile a')).on('click', function () {\r\n\t\t//closeMenuAny();\r\n\t\t$('.cerca-panel, .langs_wrap').removeClass('active');\r\n\t\t$('.header .menu a').removeClass('on');\r\n\t\t$(this).addClass('on');\r\n\t\tif (windowW > 991) {\r\n\t\t\t//PARTE DESKTOP\r\n\t\t\tvar myGrid = $(this).attr('data-menu');\r\n\t\t\tconsole.log(myGrid);\r\n\t\t\t$('.submenu').not($('.submenu-mobile')).addClass('active');\r\n\t\t\t$('.service-menu .close').addClass('active');\r\n\t\t\t$('.show-menu').not($('.submenu-mobile .show-menu')).each(function () {\r\n\t\t\t\tif ($(this).attr('data-menu') == myGrid) {\r\n\t\t\t\t\t$('.show-menu.active').removeClass('active');\r\n\t\t\t\t\t$(this).addClass('active');\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\t$('.submenu .col-dx .box-lanci').each(function () {\r\n\t\t\t\tif ($(this).attr('data-box') == myGrid) {\r\n\t\t\t\t\t$('.submenu .col-dx .box-lanci.active').removeClass('active');\r\n\t\t\t\t\t$(this).addClass('active');\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t//PARTE MOBILE\r\n\t\t\tvar myGrid = $(this).attr('data-menu');\r\n\t\t\t$('.submenu-mobile').addClass('active');\r\n\t\t\t$('.submenu-mobile .show-menu').each(function () {\r\n\t\t\t\tif ($(this).attr('data-menu') == myGrid) {\r\n\t\t\t\t\t$('.show-menu.active').removeClass('active');\r\n\t\t\t\t\t$(this).addClass('active');\r\n\t\t\t\t\t//menuMobile();\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\t$('.return').addClass('active');\r\n\t\t}\r\n\t\treturn false;\r\n\t});\r\n\r\n\t$('.service-menu .close').on('click', function () {\r\n\t\t$('.header .menu a').removeClass('on');\r\n\t\t$('.submenu, .cerca-panel, .langs_wrap').removeClass('active');\r\n\t\t$(this).removeClass('active');\r\n\t\t$('.show-menu.active').removeClass('active');\r\n\t\t$('#search-fast').removeClass('full');\r\n\t\t$('#search-advanced').show();\r\n\t\treturn false;\r\n\t});\r\n}\r\n\r\nfunction hoverMenu() {\r\n\t$('.header .menu .menu-primary').each(function () {\r\n\t\tvar myTxt = $('.real-menu', this).html();\r\n\t\t$(this).append(\" \");\r\n\t});\r\n}\r\n\r\nfunction menuMd() {\r\n\tif (windowW < 1199 && windowW > 767) {\r\n\t\tvar myHDefaultProdotti = 0;\r\n\t\tvar myHDefaultProgetti = 0;\r\n\t\t$('.show-menu.prodotti .cat-menu ul').each(function () {\r\n\t\t\tvar myH = $(this).height();\r\n\t\t\t//console.log(myH);\t\t\t\r\n\t\t\tif (myH > myHDefaultProdotti) {\r\n\t\t\t\tmyHDefaultProdotti = myH;\r\n\t\t\t}\r\n\t\t});\r\n\t\t$('.show-menu.progetti .cat-menu ul').each(function () {\r\n\t\t\tvar myH = $(this).height();\r\n\t\t\t//console.log(myH);\r\n\t\t\tif (myH > myHDefaultProgetti) {\r\n\t\t\t\tmyHDefaultProgetti = myH;\r\n\t\t\t}\r\n\t\t});\r\n\t\t$('.show-menu.prodotti .cat-menu ul').height(myHDefaultProdotti);\r\n\t\t$('.show-menu.progetti .cat-menu ul').height(myHDefaultProgetti);\r\n\t} else {\r\n\t\t$('.cat-menu ul').css({ 'height': 'auto' });\r\n\t}\r\n}\r\n\r\nfunction menuMobile() {\r\n\t$('.hamburger a').on('click', function () {\r\n\t\tif (!$(this).hasClass('active')) {\r\n\t\t\t$(this).addClass('active');\r\n\t\t\t$('.header').addClass('header-mobile');\r\n\t\t} else {\r\n\t\t\t$(this).removeClass('active');\r\n\t\t\t$('.header').removeClass('header-mobile');\r\n\t\t\t$('.submenu').removeClass('active');\r\n\t\t\t$('.show-menu').removeClass('active');\r\n\t\t\t$('.submenu-mobile .cat-menu ul.active').removeClass('active');\r\n\t\t\t$('.return').removeClass('active');\r\n\t\t}\r\n\t\treturn false;\r\n\t});\r\n\r\n\t//SOTTO MENU MOBILE\r\n\t$('.submenu-mobile .tit.small').on('click', function () {\r\n\t\t$(this).next().addClass('active');\r\n\t});\r\n\r\n\t//RETURN\r\n\t$('.return a').on('click', function () {\r\n\t\tif ($('.submenu-mobile .cat-menu ul').hasClass('active')) {\r\n\t\t\t$('.submenu-mobile .cat-menu ul.active').removeClass('active');\r\n\t\t} else {\r\n\t\t\t$('.submenu, .show-menu, .return').removeClass('active');\r\n\t\t}\r\n\t\treturn false;\r\n\t});\r\n\r\n\t//CERCA\r\n\t$('.close-cerca').on('click', function () {\r\n\t\t$('.cerca-panel').removeClass('active');\r\n\t\treturn false;\r\n\t});\r\n\r\n\t//LINGUE\r\n\t$('.header .menu .actions-mobile .mercati').on('click', function () {\r\n\t\tif (!$('.langs_wrap-mobile').hasClass('active')) {\r\n\t\t\t$('.langs_wrap-mobile').addClass('active');\r\n\t\t} else {\r\n\t\t\t$('.langs_wrap-mobile').removeClass('active');\r\n\t\t}\r\n\t\treturn false;\r\n\t});\r\n}\r\n\r\nfunction cercaRicerca() {\r\n\t$('.service-menu .cerca').on('click', function () {\r\n\t\t$('.header .menu a').removeClass('on');\r\n\t\t$('.service-menu .close').addClass('active');\r\n\t\t$('.submenu').removeClass('active');\r\n\t\t$('.langs_wrap').removeClass('active');\r\n\t\t$('.cerca-panel').addClass('active');\r\n\t\treturn false;\r\n\t});\r\n}\r\n\r\nfunction selectLang() {\r\n\tif (windowW > 991) {\r\n\t\t$('.service-menu .mercati a, .footer .mercati').on('click', function () {\r\n\t\t\t$('.header .menu a').removeClass('on');\r\n\t\t\t$('.service-menu .close').addClass('active');\r\n\t\t\t$('.submenu').removeClass('active');\r\n\t\t\t$('.cerca-panel').removeClass('active');\r\n\t\t\t$('.langs_wrap').addClass('active');\r\n\t\t\treturn false;\r\n\t\t});\r\n\t}\r\n}\r\n\r\nfunction selectMarket() {\r\n\t$('.langs_wrap #Markets a').on('click', function () {\r\n\t\t$('.col-langs').addClass('active');\r\n\t\t$('.langs_wrap #Markets a.active').removeClass('active');\r\n\t\t$(this).addClass('active');\r\n\t\treturn false;\r\n\t});\r\n}\r\n\r\nfunction closeMenuAny() {\r\n\tif (windowW >= 991) {\r\n\t\t$('body').on('click', function (e) {\r\n\t\t\tif (!$(e.target).closest('.submenu').hasClass('active') && !$(e.target).closest('.cerca-panel').hasClass('active') && !$(e.target).closest('.langs_wrap').hasClass('active')) {\r\n\t\t\t\t$('.service-menu .close').click();\r\n\t\t\t}\r\n\t\t\t//console.log($(e.target));\r\n\t\t});\r\n\t}\r\n}\r\n\r\nfunction chechboxFake() {\r\n\t$('input[type=\"checkbox\"]').on('click', function () {\r\n\t\tif ($(this).prop(\"checked\") == true) {\r\n\t\t\t$(this).parent().addClass('checked');\r\n\t\t} else if ($(this).prop(\"checked\") == false) {\r\n\t\t\t$(this).parent().removeClass('checked');\r\n\t\t}\r\n\t});\r\n\r\n\t$('.radiogrp').each(function () {\r\n\t\t$('input[type=\"radio\"]', this).on('click', function () {\r\n\t\t\tif ($(this).prop(\"checked\") == true) {\r\n\t\t\t\t//console.log($(this).parents());\r\n\t\t\t\t$(this).closest('.radiogrp').find('.checked').removeClass('checked');\r\n\t\t\t\t$(this).parent().addClass('checked');\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n}\r\n\r\nfunction scrollDown() {\r\n\t$('.scroll-down, .scroll-bottom').on('click', function () {\r\n\t\t$('body,html').stop().animate({ scrollTop: $(this).next().offset().top - $('.header').outerHeight() }, 'slow');\r\n\t\treturn false;\r\n\t});\r\n}\r\n\r\nfunction scrollTop() {\r\n\t$('.scroll-top').on('click', function () {\r\n\t\t$('body,html').stop().animate({ scrollTop: $('body').offset().top }, 'slow');\r\n\t\treturn false;\r\n\t});\r\n}\r\n\r\nfunction bigSlideshow() {\r\n\t$('.slideshow').slick({\r\n\t\tautoplay: true,\r\n\t\tautoplaySpeed: 5000,\r\n\t\tarrows: false,\r\n\t\tinfinite: true,\r\n\t\tdots: true,\r\n\t\tpauseOnHover: false\r\n\t});\r\n\r\n\t$('.slideshow .item').each(function () {\r\n\t\tvar myTit = $('.tit-slide', this).html();\r\n\t\tvar shortTit = jQuery.trim(myTit).substring(0, 20).trim(this) + \"...\";\r\n\t\tvar myTxt = $('.txt', this).html();\r\n\t\tvar myIndex = $(this).closest('.slick-slide').index() - 1;\r\n\t\t//console.log(myTit + ' / ' + myTxt + ' / ' + myIndex);\r\n\r\n\t\t$('.slideshow .slick-dots li:eq(' + myIndex + ') button').html('