1window.loadScriptWithSuppressedSrc = async (scriptPath) => { 2 return new Promise((resolve, reject) => { 3 const existingScript = document.querySelector(`script[data-suppressedsrc="${scriptPath}"]`); 4 if (existingScript) { 5 resolve(); 6 return; 7 } 8 const script = document.createElement('script'); 9 script.setAttribute('data-suppressedsrc', scriptPath); 10 script.setAttribute('type', 'text/plain'); 11 script.setAttribute('class', '_iub_cs_activate'); 12 script.onload = resolve; 13 script.onerror = reject; 14 document.head.appendChild(script); 15 }); 16}; 17//$(document).on('click', '.button-open', function () { 18// if ($('.content-menu').is(":visible")) { 19// $('.content-menu').hide("slide", { direction: "left" }, 1000, 'easeInOutQuint'); 20// } 21// else { $('.content-menu').show("slide", { direction: "left" }, 1000, 'easeInOutQuint'); } 22//}); 23 24$(document).on('click', '.button-open-ricambi', function () { 25 if ($('.content-ricambi').is(":visible")) { 26 $('.content-ricambi').hide(100); 27 } 28 else { $('.content-ricambi').show(100); } 29}); 30 31$(document).on('click', '.button-close-ricambi', function () { 32 if ($('.content-ricambi').is(":visible")) { 33 $('.content-ricambi').hide(100); 34 } 35 else { 36 $('.content-ricambi').show(100); 37 } 38}); 39 40$(document).on('click', '.button-open-accessori', function () { 41 if ($('.content-accessori').is(":visible")) { 42 $('.content-accessori').hide(100); 43 } 44 else { $('.content-accessori').show(100); } 45}); 46 47$(document).on('click', '.button-close-accessori', function () { 48 if ($('.content-accessori').is(":visible")) { 49 $('.content-accessori').hide(100); 50 } 51 else { 52 $('.content-accessori').show(100); 53 } 54}); 55 56$(document).on('click', '.button-open-abbigliamento', function () { 57 if ($('.content-abbigliamento').is(":visible")) { 58 $('.content-abbigliamento').hide(100); 59 } 60 else { $('.content-abbigliamento').show(100); } 61}); 62 63$(document).on('click', '.button-close-abbigliamento', function () { 64 if ($('.content-abbigliamento').is(":visible")) { 65 $('.content-abbigliamento').hide(100); 66 } 67 else { 68 $('.content-abbigliamento').show(100); 69 } 70}); 71$(document).on('click', '.button-open-ricercalibera', function () { 72 if ($('.content-ricercalibera').is(":visible")) { 73 $('.content-ricercalibera').hide(100); 74 } 75 else { $('.content-ricercalibera').show(100); } 76}); 77 78$(document).on('click', '.button-close-ricercalibera', function () { 79 if ($('.content-ricercalibera').is(":visible")) { 80 $('.content-ricercalibera').hide(100); 81 } 82 else { 83 $('.content-ricercalibera').show(100); 84 } 85}); 86 87// 88$(document).on('click', '.opensharebutton', function () { 89 $('.contentsharebutton').toggleClass('invisible'); 90}); 91// 92 93//BARRE LATERALI 94$(document).on('click', '.open-sidebar-left', function () { 95 if ($('.leftbar-desk').is(":visible")) { 96 $('.leftbar-desk').hide("slide", { direction: "left" }, 300, 'easeInOutQuint'); 97 } 98 else if ($('.rightbar-desk').is(":visible")) { 99 $('.rightbar-desk').hide("slide", { direction: "right" }, 300, 'easeInOutQuint'); 100 $('.leftbar-desk').show("slide", { direction: "left" }, 300, 'easeInOutQuint'); 101 } 102 else { 103 $('.leftbar-desk').show("slide", { direction: "left" }, 300, 'easeInOutQuint'); 104 } 105 $('.search-vertical').toggleClass('hidemobile'); 106 closeFiltriMobile(); 107}); 108 109$(document).on('mouseover', '.open-sidebar-right', function () { 110 if ($('.leftbar-desk').is(":visible")) { 111 $('.leftbar-desk').hide("slide", { direction: "left" }, 300, 'easeInOutQuint'); 112 $('.rightbar-desk').show("slide", { direction: "right" }, 300, 'easeInOutQuint'); 113 } 114 else { 115 $('.rightbar-desk').show("slide", { direction: "right" }, 300, 'easeInOutQuint'); 116 } 117 $('.search-vertical').toggleClass('hidemobile'); 118 closeRicercaMobile(); 119}); 120 121//$(document).on('click', function (e) { 122// if (!$('.rightbar-desk').is(e.target) && $('.rightbar-desk').has(e.target).length === 0) { 123// $('.rightbar-desk').hide("slide", { direction: "right" }, 300, 'easeInOutQuint'); 124// } 125//}); 126 127$(document).on('click', '.close-sidebar', function () { 128 $('.leftbar-desk').hide("slide", { direction: "left" }, 300, 'easeInOutQuint'); 129 $('.rightbar-desk').hide("slide", { direction: "right" }, 300, 'easeInOutQuint'); 130}); 131 132// 133$(document).on('click', '.step05 .searchtitle', function () { 134 if ($('.step05 .step-content').is(":visible")) { 135 $('.step05 .step-content').hide(100); 136 } 137 else { 138 $('.step05 .step-content').show(100); 139 } 140}); 141 142// 143$(document).on('click', '.open-filtri-mobile', function () { 144 openFiltriMobile(); 145}); 146 147function openFiltriMobile() { 148 149 if ($('.search-vertical').is(":visible") && $('.open-filtri-mobile').is(":visible")) { 150 151 $('.search-vertical').hide(0); 152 $('#divCloseCerc').hide(0); 153 } 154 else { 155 156 $('.search-vertical').show(0); 157 $('#divCloseCerc').show(0); 158 159 } 160 161} 162 163function closeFiltriMobile() { 164 165 if ($('.search-vertical').is(":visible") && $('.open-filtri-mobile').is(":visible")) { 166 167 $('.search-vertical').hide(0); 168 } 169 170} 171 172$(document).on('click', '.openrecensioni', function () { 173 if ($('.content-recensioni').is(":visible")) { 174 $('.content-recensioni').toggleClass('invisible'); 175 } 176 else { 177 $('.content-recensioni').toggleClass('invisible'); 178 } 179}); 180$(document).on('click', '.openaggiungirecensione', function () { 181 if ($('.aggiungirecensione').is(":visible")) { 182 $('.aggiungirecensione').toggleClass('invisible'); 183 } 184 else { 185 $('.aggiungirecensione').toggleClass('invisible'); 186 } 187}); 188//tinyslider 189if ($('#my-slider').length) { 190 var slider = tns({ 191 container: "#my-slider", 192 items: 4, 193 gutter: 20, 194 slideBy: 1, 195 controlsPosition: "bottom", 196 navPosition: "bottom", 197 mouseDrag: true, 198 autoplay: true, 199 autoplayHoverPause: true, 200 autoplayButtonOutput: false, 201 controlsContainer: "#custom-control", 202 responsive: { 203 0: { 204 items: 1, 205 nav: false 206 }, 207 768: { 208 items: 2, 209 nav: true 210 }, 211 1440: { 212 items: 4 213 } 214 } 215 // mode: 'gallery', 216 // speed: 2000, 217 // animateIn: "scale", 218 // controls: false, 219 // nav: false, 220 // edgePadding: 20, 221 // loop: false, 222 });
223} 224// 225function incrementValue(e) { 226 e.preventDefault(); 227 var fieldName = $(e.target).data('field'); 228 var parent = $(e.target).closest('div'); 229 var currentVal = parseInt(parent.find('input[name=' + fieldName + ']').val(), 10); 230 var maxVal = parseInt(parent.find('input[name=' + fieldName + ']').attr('max'), 10); 231 232 if (!isNaN(currentVal) && currentVal < maxVal) { 233 parent.find('input[name=' + fieldName + ']').val(currentVal + 1); 234 } else { 235 parent.find('input[name=' + fieldName + ']').val(maxVal); 236 } 237} 238 239function decrementValue(e) { 240 e.preventDefault(); 241 var fieldName = $(e.target).data('field'); 242 var parent = $(e.target).closest('div'); 243 var currentVal = parseInt(parent.find('input[name=' + fieldName + ']').val(), 10); 244 245 if (!isNaN(currentVal) && currentVal > 1) { 246 parent.find('input[name=' + fieldName + ']').val(currentVal - 1); 247 } else { 248 parent.find('input[name=' + fieldName + ']').val(1); 249 } 250} 251 252$('.input-group').on('click', '.button-plus', function (e) { 253 incrementValue(e); 254}); 255 256$('.input-group').on('click', '.button-minus', function (e) { 257 decrementValue(e); 258}); 259 260$(document).on('click', '.open-next-div', function (e) { 261 $(this).next('div').toggleClass('invisible'); 262}); 263$(document).on('click', '.checklist-button', function (e) { 264 $(this).next('div').toggleClass('invisible'); 265}); 266// 267$(document).on('click', '.openimmagine', function () { 268 if ($('.content-immagine').is(":visible")) { 269 $('.content-lista').toggleClass('contents-invisible'); 270 $('.content-immagine').toggleClass('contents-invisible'); 271 } 272 else { 273 $('.content-immagine').toggleClass('contents-invisible'); 274 $('.content-lista').toggleClass('contents-invisible'); 275 } 276}); 277$(document).on('click', '.openlista', function () { 278 if ($('.content-lista').is(":visible")) { 279 $('.content-immagine').toggleClass('contents-invisible'); 280 $('.content-lista').toggleClass('contents-invisible'); 281 } 282 else { 283 $('.content-immagine').toggleClass('contents-invisible'); 284 $('.content-lista').toggleClass('contents-invisible'); 285 } 286}); 287$(document).on('click', '.openconsegna', function () { 288 if ($('.contentconsegna').is(":visible")) { 289 $('.contentconsegna').toggleClass('invisible'); 290 } 291 else { 292 $('.contentconsegna').toggleClass('invisible'); 293 } 294}); 295$(document).on('click', '.openindirizziFatt', function () { 296 if ($('.container-selezioneindirizziFatt').is(":visible")) { 297 $('.container-selezioneindirizziFatt').toggleClass('invisible'); 298 $('.container-aggiungidatiFatt').toggleClass('invisible'); 299 } 300 else { 301 $('.container-selezioneindirizziFatt').toggleClass('invisible'); 302 $('.container-aggiungidatiFatt').toggleClass('invisible'); 303 } 304}); 305$(document).on('click', '.openindirizzi', function () { 306 if ($('.container-selezioneindirizzi').is(":visible")) { 307 $('.container-selezioneindirizzi').toggleClass('invisible'); 308 $('.container-aggiungidati').toggleClass('invisible'); 309 } 310 else { 311 $('.container-selezioneindirizzi').toggleClass('invisible'); 312 $('.container-aggiungidati').toggleClass('invisible'); 313 } 314}); 315$(document).on('click', '.openfatturazione', function () { 316 if ($('.contentfatturazione').is(":visible")) { 317 $('.contentfatturazione').toggleClass('invisible'); 318 } 319 else { 320 $('.contentfatturazione').toggleClass('invisible'); 321 } 322}); 323 324$(document).on('click', '.opendiv', function () { 325 if ($(this).siblings().is(":visible")) { 326 $(this).siblings().toggleClass('invisible-container'); 327 } 328 else { 329 $(this).siblings().toggleClass('invisible-container'); 330 } 331}); 332 333 334$(document).on('click', '.checkmark', function () { 335 if ($(this).siblings('input').is(":checked")) { 336 $(this).parent().parent().parent().siblings().children('div').toggleClass('invisible-reso'); 337 } 338 else { 339 $(this).parent().parent().parent().siblings().children('div').toggleClass('invisible-reso'); 340 } 341}); 342 343$(document).on('click', '.opendivfatturazione', function () { 344 if ($(this).is(":checked")) { 345 $('.divfatturazione').toggleClass('invisible'); 346 } 347 else { 348 $('.divfatturazione').toggleClass('invisible'); 349 } 350}); 351 352 353//$(function () { 354// $("#header").load("header.html"); 355//}); 356//$(function () { 357// $("#chat").load("Chat.html"); 358//}); 359$(function () { 360 $("#footer").load("footer.html"); 361}); 362$(function () { 363 $("#header-2").load("header-area-dealer.html"); 364}); 365$(function () { 366 $("#footer-2").load("footer-area-dealer.html"); 367}); 368$(function () { 369 $("#leftbar").load("leftbar.html"); 370}); 371 372// 373$('#OpenImgUpload').click(function () { $('#imgupload').trigger('click'); }); 374 375//inizializzo lightGallery 376$(document).ready(function () { 377 lightGallery(document.getElementById('galleryDetail'), { 378 plugins: [lgZoom, lgAutoplay, lgFullscreen, lgHash, lgPager, lgThumbnail, lgVideo], //scegliere i plugin, metto i più comuni per altre opzioni vedi -> https://github.com/sachinchoolur/lightGallery 379 speed: 500 380 //,licenseKey: 'your_license_key' // da mettere appena me la forniscono... 381 });
382}); 383 384$(document).on('click', '.openinviamessaggio', function () { 385 if ($('.inviamessaggio').is(":visible")) { 386 $('.inviamessaggio').toggleClass('invisible'); 387 } 388 else { 389 $('.inviamessaggio').toggleClass('invisible'); 390 } 391}); 392/*RICERCA C-CARE*/ 393$(document).on('click', '.search-c-care', function (e) { 394 $(this).siblings('div').toggleClass('invisible'); 395}); 396/**/ 397 398$(document).on('click', '.link-ricambi', function () { 399 if ($('.body-ricambi.targa').is(":visible")) { 400 $('.body-ricambi.targa').toggleClass('invisible'); 401 $('.body-ricambi.marca').toggleClass('invisible'); 402 } 403 else { 404 $('.body-ricambi.marca').toggleClass('invisible'); 405 $('.body-ricambi.targa').toggleClass('invisible'); 406 } 407}); 408 409$(document).on('click', '.button-cerca', function () { 410 if ($('.container-modale-ricambi').is(":visible")) { 411 $('.container-modale-ricambi').toggleClass('invisible'); 412 } 413 else { 414 $('.container-modale-ricambi').toggleClass('invisible'); 415 } 416}); 417 418$(document).on('click', '.close-modale-ricambi', function () { 419 if ($('.container-modale-ricambi').is(":visible")) { 420 $('.container-modale-ricambi').toggleClass('invisible'); 421 } 422 else { 423 $('.container-modale-ricambi').toggleClass('invisible'); 424 } 425}); 426 427 428$(document).on('click', '.open-modal-allestimenti', function () { 429 if ($('.container-modale-allestimenti').is(":visible")) { 430 $('.container-modale-allestimenti').toggleClass('invisible'); 431 } 432 else { 433 $('.container-modale-allestimenti').toggleClass('invisible'); 434 } 435}); 436 437$(document).on('click', '.close-modale-allestimenti', function () { 438 if ($('.container-modale-allestimenti').is(":visible")) { 439 $('.container-modale-allestimenti').toggleClass('invisible'); 440 } 441 else { 442 $('.container-modale-allestimenti').toggleClass('invisible'); 443 } 444}); 445 446$(document).on('click', '.openlista', function () { 447 if ($('.modale-lista-ricambi').is(":visible")) { 448 $('.modale-lista-ricambi').toggleClass('invisible'); 449 } 450 else { 451 $('.modale-lista-ricambi').toggleClass('invisible'); 452 } 453}); 454 455$(document).on('click', '#modelliRicercati', function () { 456 //$('#landingPages').show(); 457 458 if ($('#landingPages').is(":visible")) { 459 $('#landingPages').toggleClass('invisible'); 460 } 461 else { 462 $('#landingPages').toggleClass('invisible'); 463 } 464 465}); 466 467$(document).on('click', '#menuAccessori', function () { 468 if ($('#listaAccessori').is(":visible")) { 469 $('#listaAccessori').toggleClass('invisible'); 470 } 471 else { 472 $('#listaAccessori').toggleClass('invisible'); 473 } 474 475}); 476 477function closeFiltriRisultatiMobile(countRisult) { 478 if (window.innerWidth <= 950) { 479 if (countRisult > 0) { 480 $('.open-filtri-mobile').show(); 481 } else { 482 $('.open-filtri-mobile').hide(); 483 } 484 } 485} 486 487 488function applyMobileLogiSearchVertical() { 489 setTimeout(function () { 490 var searchVertical = document.querySelector('.search-vertical'); 491 if (window.innerWidth < 950) { 492 if (searchVertical) { 493 searchVertical.classList.remove('hidemobile'); 494 if (!$('#divCloseCerc').is(':visible')) { 495 searchVertical.style.display = 'none'; 496 } 497 } 498 } else { 499 if (searchVertical) { 500 searchVertical.classList.remove('hidemobile'); 501 } 502 } 503 }, 2000); // 2000 millisecondi = 2 secondi 504 505} 506 507 508function OpenFiltraDiv() { 509 if (window.innerWidth < 950) { 510 $('#FiltraDiv').on('click', function () { 511 if (window.scrollY < 300) { 512 window.scrollBy({ 513 top: 350, 514 left: 0, 515 behavior: 'smooth' 516 }); 517 } 518 $('#divCloseCerc').show(); 519 $('#SearchDiv').removeClass('hidemobile'); 520 $('#SearchDiv').show(); 521 $('.lista-second-section, .risultati, .banner, .open-filtri-mobile').css('filter', 'blur(5px)'); 522 $('#SearchDiv').scrollTop($('#SearchDiv')[0].scrollHeight); 523 524 $(document.body).on('click', function (event) { 525 if ($('#SearchDiv').is(':visible')) { 526 var header = $('header'); 527 var isOutsideSearchDiv = !$(event.target).closest('#SearchDiv').length; 528 var isOutsideDivCloseCerc = !$(event.target).closest('#divCloseCerc').length; 529 var isNotHeader = !$(event.target).is('header'); 530 531 if (isOutsideSearchDiv && isOutsideDivCloseCerc && isNotHeader) { 532 event.stopPropagation(); // Impedisce la propagazione dell'evento di click 533 event.preventDefault(); // Impedisce il comportamento predefinito del clic 534 } 535 } 536 }); 537 }); 538 } 539} 540 541 542var currentWidth = $(window).width(); 543var searchDivTopPosition = 0; 544$(window).on('resize', function () { 545 if ($('#SearchDiv').length > 0) { 546 var newWidth = $(window).width(); 547 548 if (newWidth !== currentWidth) { 549 currentWidth = newWidth; 550 551 if (currentWidth > $(window).height()) { 552 if (currentWidth > 950) { 553 closeRicercaMobile(); 554 $('#SearchDiv').show(); 555 } else { 556 if ($('#SearchDiv').is(':visible')) { 557 $('.lista-second-section, .risultati, .banner, .open-filtri-mobile').css('filter', 'blur(5px)'); 558 } 559 } 560 } else { 561 if (currentWidth > 950) { 562 if (!$('#SearchDiv').is(':visible')) { 563 closeRicercaMobile(); 564 } 565 } else { 566 if (!$('#divCloseCerc').is(':visible')) { 567 $('#SearchDiv').hide(); 568 } 569 if ($('#SearchDiv').is(':visible')) { 570 $('.lista-second-section, .risultati, .banner, .open-filtri-mobile').css('filter', 'blur(5px)'); 571 572 movePageTop(); 573 } 574 } 575 } 576 } 577 } else { 578 if (currentWidth < 950) { 579 closeRicercaMobile(); 580 } 581 } 582}); 583 584function movePageTop() { 585 $('html, body').animate({ 586 scrollTop: 350 587 }, 'slow'); 588} 589$(document).ready(function () { 590 $(window).trigger('resize'); 591}); 592 593function closeRicercaMobile() { 594 closeFiltriMobile(); 595 $('#divCloseCerc').hide(0); 596 $('.lista-second-section, .risultati, .banner, .open-filtri-mobile').css('filter', 'none'); 597 document.body.style.overflow = 'visible'; 598 searchDivTopPosition = 0; 599}; 600 601 602function preventScroll() { 603 if (window.innerWidth < 950 && $('#SearchDiv').is(':visible')) { 604 document.body.style.overflow = 'hidden'; 605 } else { 606 document.body.style.overflow = 'visible'; 607 } 608} 609 610window.addEventListener('scroll', preventScroll); 611 612$(document).ready(function () { 613 $("#divCloseCerc").click(function () { 614 closeRicercaMobile(); 615 });
616}); 617 618 619 620$(document).on('click', '.item.custom-item-search-font-size', function (e) { 621 setTimeout(function () { 622 closeRicercaMobile(); 623 }, 1500); 624}); 625 626$(document).on('click', '.opensubmenu', function (e) { 627 var submenu = $(this).find('.submenu-footer'); 628 $('.submenu-footer').not(submenu).removeClass('show'); // Nasconde gli altri menu 629 submenu.toggleClass('active'); 630 submenu.toggleClass('show'); // Mostra o nascondi il menu corrente 631}); 632 633$(document).click(function (e) { 634 if (!$(e.target).closest('.opensubmenu').length) { 635 $('.opensubmenu').removeClass('active'); 636 $('.submenu-footer').removeClass('show'); 637 } 638}); 639 640// copy to clipboard 641$(document).on('click', '#btnCopy2Clipboard', function (e) { 642 try { 643 var txt = $(this).data('clipboard-text'); 644 const textCopied = ClipboardJS.copy(txt); 645 alert('Link copiato!'); 646 } catch (error) { 647 alert(error); 648 } 649}); 650 651// home page slider 652$(document).ready(function () { 653 setInterval(function () { 654 $(".carousel-control-next").click(); 655 }, 20000); 656}); 657 658function toggleExMessage(objId, showMsg) { 659 if (showMsg) { 660 setTimeout(function () { 661 $(objId).removeClass('invisible'); 662 }, 200); 663 } 664 else { 665 setTimeout(function () { 666 $(objId).addClass('invisible'); 667 }, 200); 668 } 669} 670// Stripe embedded checkout 671let currentCheckout = null; // Store the checkout instance globally 672async function initializeCheckout(checkoutObj) { 673 try { 674 if (!currentCheckout) { 675 const stripe = Stripe(checkoutObj.publishableKey); 676 const checkout = await stripe.initEmbeddedCheckout({ 677 clientSecret: checkoutObj.clientSecret 678 }); 679 // Store the checkout instance 680 currentCheckout = checkout; 681 // Mount the checkout 682 checkout.mount('#checkout'); 683 } 684 else { 685 // Mount the checkout 686 currentCheckout.clientSecret = checkoutObj.clientSecret; 687 currentCheckout.mount('#checkout'); 688 } 689 } catch (e) { 690 console.error("Error initializing checkout:", e); 691 } 692} 693// Clean up function to be called when leaving the page 694function cleanupCheckout() { 695 if (currentCheckout) { 696 try { 697 currentCheckout.unmount(); 698 } catch (e) { 699 console.warn("Error unmounting checkout:", e); 700 } 701 // currentCheckout = null; 702 } 703} 704// Add event listener for page unload 705//window.addEventListener('beforeunload', cleanupCheckout); 706
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.