1(function ($, Drupal, drupalSettings) { 2 3 $(document).ready(function () { 4 5 // jQuery to manage animations 6 // Checking elements visibility 7 function isElementInViewport(el) { 8 var rect = el.getBoundingClientRect(); 9 return ( 10 rect.top >= 0 && 11 rect.left >= 0 && 12 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && 13 rect.right <= (window.innerWidth || document.documentElement.clientWidth) 14 ); 15 } 16 17 function handleScrollAnimation() { 18 // Check if the window width is 1200px or greater 19 if ($(window).width() >= 1200) { 20 $(".animate").each(function () { 21 if (isElementInViewport(this)) { 22 $(this).addClass("animated"); 23 } 24 // else { 25 // $(this).removeClass("animated"); 26 // } 27 }); 28 } 29 } 30 31 // Execute the function when the page is ready and during scrolling 32 $(document).ready(handleScrollAnimation); 33 $(window).scroll(handleScrollAnimation); 34 35 // jQuery to add "playsinline" attribute for ios autoplay 36 if ($('.diasorin-homepage-slider').length) { 37 $(".diasorin-homepage-slider .slide__media video").attr("playsinline", true); 38 } 39 40 41 // Script to add class active to nav-item if there's a match in the path url 42 var url = window.location.pathname.split('/'); 43 var secondElement = url[2]; 44 $('.diasorin-top-menu .nav .nav-item').each(function () { 45 var href = $(this).find('a').attr('href'); 46 if (href.indexOf(secondElement) !== -1) { 47 $(this).addClass('active-menu-item'); 48 } 49 }); 50 51 52 $('.menu-trigger').click(function () { 53 $('.menu-item').toggleClass('menu-open'); 54 }); 55 56 $(document).on('click', function (event) { 57 if (!$(event.target).closest('.menu-item, .menu-trigger').length) { 58 $('.menu-item').removeClass('menu-open'); 59 $('body').removeClass('menu-open'); 60 } 61 }); 62 63 // Script to toggle a class to activate single "Our history" card 64 $('.toggle-body').click(function () { 65 $('.slick-slide.slick-current .single-history-wrapper').toggleClass('active'); 66 }); 67 68 // Script to add a class to manage the sidebar when the page has been scrolled 69 if ($('.sidebar aside .diasorin-sidebar-menu').length) { 70 var $menu = $('.sidebar aside .diasorin-sidebar-menu'); 71 var $container = $('#sidebar_first .section'); 72 73 function checkPosition() { 74 var menuBottom = $menu.offset().top + $menu.outerHeight(); 75 var containerBottom = $container.offset().top + $container.outerHeight(); 76 // console.log('menuBottom:', menuBottom, 'containerBottom:', containerBottom); 77 78 // Adding a small error margin (1px) to handle minimum diff 79 var marginOfError = 1; 80 81 if (menuBottom + marginOfError >= containerBottom && !$container.hasClass('sidebar-bottom')) { 82 $container.addClass('sidebar-bottom'); 83 } else if (menuBottom < containerBottom - marginOfError && $container.hasClass('sidebar-bottom')) { 84 $container.removeClass('sidebar-bottom'); 85 } 86 } 87 checkPosition(); 88 $(window).on('resize scroll', checkPosition); 89 90 // Track last scroll position 91 var lastScrollTop = 0; 92 93 // Element references 94 var $sidebar = $('.sidebar aside'); 95 var $sidebarMenu = $('.sidebar aside .diasorin-sidebar-menu'); 96 97 // On scroll 98 $(window).scroll(function () { 99 100 // Scroll values 101 var currentScrollTop = $(this).scrollTop(); 102 var sidebarMenuTop = $sidebarMenu.offset().top; 103
104 // Check scroll direction 105 var scrollUp = currentScrollTop < lastScrollTop; 106 107 // Check scroll position only when scrolling up 108 if (scrollUp && currentScrollTop < (sidebarMenuTop - 168)) { 109 $sidebar.addClass('sidebar-scroll-up'); 110 } else { 111 $sidebar.removeClass('sidebar-scroll-up'); 112 } 113 lastScrollTop = currentScrollTop; 114 }); 115 116 } 117 118 // Script to build slider module on product line page 119 $('.slider').slick({ 120 dots: true, 121 infinite: true, 122 speed: 300, 123 slidesToScroll: 1, 124 }); 125 126 $('.csrd-slider-projects').slick({ 127 dots: true, 128 infinite: true, 129 speed: 300, 130 slidesToShow: 1, 131 slidesToScroll: 1, 132 adaptiveHeight: true, 133 arrows: false, 134 }); 135 136 137 $('.memed-slider').slick({ 138 dots: true, 139 infinite: true, 140 speed: 300, 141 autoplay: true, 142 autoplaySpeed: 3000, 143 slidesToShow: 1, 144 slidesToScroll: 1, 145 responsive: [{ 146 breakpoint: 991.98, 147 settings: { 148 adaptiveHeight: true 149 } 150 }] 151 }); 152 153 // Script to build slider module 154 $('.image-gallery-wrapper').slick({ 155 dots: true, 156 infinite: false, 157 speed: 900, 158 slidesToScroll: 1, 159 }); 160 161 // Script to build slick slider for multiple cards slider (excluding sliders in business model page) 162 if ($('.multi-card-slider').not('.business-model-slider').length) { 163 var arrows = false; 164 var $multiCardSlider = $('.multi-card-slider .slider-wrapper'); 165 var controlsContainer = $multiCardSlider; 166 167 var isGlobalEventsSlide = $multiCardSlider.parents('.global-events-highlighted').length; 168 if (isGlobalEventsSlide) { 169 arrows = true; 170 controlsContainer = $multiCardSlider.parents('.global-events-highlighted').find('.global-events-highlighted__controls'); 171 } 172 173 $multiCardSlider.slick({ 174 slidesToShow: 4, 175 slidesToScroll: 1, 176 arrows: arrows, 177 infinite: false, 178 variableWidth: false, 179 appendArrows: controlsContainer, 180 appendDots: controlsContainer, 181 dots: true, 182 responsive: [{ 183 breakpoint: 1366, 184 settings: { 185 slidesToShow: 3 186 } 187 }, 188 { 189 breakpoint: 1024, 190 settings: { 191 slidesToShow: 2 192 } 193 }, 194 { 195 breakpoint: 480, 196 settings: { 197 slidesToShow: 1, 198 } 199 }] 200 }); 201 } 202 203 // Script to build slick slider for multiple cards slider (only in business model page) 204 if ($('.multi-card-slider.business-model-slider').length) { 205 var arrows = false; 206 var $multiCardSlider = $('.multi-card-slider.business-model-slider .slider-wrapper'); 207 var controlsContainer = $multiCardSlider; 208 209 var isGlobalEventsSlide = $multiCardSlider.parents('.global-events-highlighted').length; 210 if (isGlobalEventsSlide) { 211 arrows = true; 212 controlsContainer = $multiCardSlider.parents('.global-events-highlighted').find('.global-events-highlighted__controls'); 213 } 214 215 $multiCardSlider.slick({ 216 slidesToShow: 3, 217 slidesToScroll: 1, 218 arrows: arrows, 219 infinite: false, 220 variableWidth: false, 221 dots: true, 222 responsive: [{ 223 breakpoint: 1780, 224 settings: { 225 slidesToShow: 2 226 } 227 }, 228 { 229 breakpoint: 768, 230 settings: { 231 slidesToShow: 1, 232 centerMode: true 233 } 234 }] 235 }); 236 } 237 238 239 // Script to build slick slider for multiple cards slider 240 if ($('.view-related-projects').length) { 241 var $slider = $('.view-related-projects .view-content'); 242 $slider.slick({ 243 slidesToShow: 4, 244 speed: 400, 245 arrows: true, 246 dots: true, 247 infinite: true, 248 responsive: [{ 249 breakpoint: 1280, 250 settings: { 251 slidesToShow: 2, 252 centerMode: true, 253 } 254 }, 255 { 256 breakpoint: 768, 257 settings: { 258 slidesToShow: 1, 259 centerMode: true, 260 infinite: true, 261 } 262 } 263 ] 264 }); 265 } 266 // Script to build Liaison NES resource slider 267 if ($('.nes-resources-wrapper-slider').length) { 268 var $slider = $('.nes-resources-wrapper-slider .view-content'); 269 $slider.slick({ 270 slidesToShow: 4, 271 speed: 400,
272 arrows: false, 273 dots: true, 274 infinite: true, 275 responsive: [{ 276 breakpoint: 1280, 277 settings: { 278 slidesToShow: 2, 279 centerMode: true, 280 variableWidth: true, 281 } 282 }, 283 { 284 breakpoint: 768, 285 settings: { 286 slidesToShow: 1, 287 centerMode: true, 288 infinite: true, 289 variableWidth: true, 290 } 291 } 292 ] 293 }); 294 } 295 296 297 298 // Scripts related to immunodiagnostics product page search 299 if ($('.page-view-immuno-find-your-solution').length) { 300 301 // Creare un oggetto vuoto che conterrà il conteggio delle ripetizioni 302 var productCount = {}; 303 304 // Trova tutti gli elementi con classe "single-product" e incrementa il conteggio dell'id del prodotto 305 $('.single-product').each(function () { 306 var productId = $(this).attr('class').match(/product-card-(\d+)/)[1]; 307 if (productId in productCount) { 308 productCount[productId]++; 309 } else { 310 productCount[productId] = 1; 311 } 312 }); 313 314 // Trova tutti gli elementi con classe "related-product" e aggiungi la classe "related-repeated" se l'id del prodotto è stato ripetuto 315 $('.related-product').each(function () { 316 var productId = $(this).attr('class').match(/product-card-(\d+)/)[1]; 317 if (productId in productCount && productCount[productId] > 1) { 318 $(this).addClass('related-repeated'); 319 } 320 }); 321 322 // Rimuovi tutti gli elementi con classe "related-repeated" 323 $('.related-repeated').remove(); 324 325 // Seleziona tutte le div con classe "related-product" contenute in ".view-immuno-search-related-products .view-content" 326 var $relatedProducts = $('.view-immuno-search-related-products .view-content .related-product'); 327 328 // Crea una nuova div per contenere le div con classe "related-product" 329 var $newRelatedProductsDiv = $('<div class="related-products-container"></div>'); 330 331 // Aggiungi le div con classe "related-product" alla nuova div 332 $newRelatedProductsDiv.append($relatedProducts); 333 334 // Aggiungi la nuova div all'interno di ".view-immuno-search-related-products .view-content" 335 $('.view-immuno-search-related-products .view-content').empty().append($newRelatedProductsDiv); 336 337 // Nascondi tutte le div con classe "related-product" nella nuova div 338 $newRelatedProductsDiv.find('.related-product').hide(); 339 340 // Mostra le prime 4 div con classe "related-product" nella nuova div 341 $newRelatedProductsDiv.find('.related-product').slice(0, 4).show(); 342 343 // Mostra il pulsante "Load More" solo se ci sono più di 4 elementi nel contenitore di prodotti correlati 344 if ($newRelatedProductsDiv.find('.related-product').length > 4) { 345 // Taglia e inserisci la div con classe "load-more" dopo il contenuto della div con classe "view-immuno-search-related-products" 346 $('.view-immuno-search-related-products .view-content').after($('.load-more')); 347 348 // Aggiungi il click event al pulsante "Load More" 349 $('.load-more a').click(function (e) { 350 e.preventDefault(); 351 352 // Seleziona le div con classe "related-product" non ancora mostrate nella nuova div 353 var $hiddenRelatedProducts = $newRelatedProductsDiv.find('.related-product:hidden'); 354 355 // Mostra le prossime 4 div con classe "related-product" nella nuova div 356 $hiddenRelatedProducts.slice(0, 4).show(); 357 358 // Se non ci sono altre div con classe "related-product" da mostrare nella nuova div, nascondi il pulsante "Load More" 359 if ($hiddenRelatedProducts.length <= 4) { 360 $('.load-more').hide(); 361 } 362 }); 363 364 // Nascondi il pulsante "Load More" all'inizio se tutte le card sono già visibili 365 if ($newRelatedProductsDiv.find('.related-product:hidden').length <= 4) { 366 $('.load-more').hide(); 367 } 368 } 369 370 var activeClientType = $('.facets-control-client-type a.is-active').text().trim(); 371 var hrefValue = '#' + activeClientType; 372 373 $('.single-product .btn').attr('href', function (index, oldHref) { 374 return oldHref + hrefValue; 375 }); 376 377 // Verifica se la nuova div "related-products-container" è vuota e nascondi l'elemento "view-immuno-search-related-products" se lo è 378 if ($newRelatedProductsDiv.is(':empty')) { 379 $('.view-immuno-search-related-products').addClass('hidden'); 380 } 381 } 382 383 // Scripts related product page 384 if ($('.node--type-product').length) { 385 // Scripts related product page tab activation based on search 386 var hashValue = window.location.hash.substr(1); 387 388 if (hashValue === 'a-lab-manager') { 389 $('#pills-laboratorist-tab').addClass('active'); 390 $('#pills-laboratorist').addClass('active'); 391 } else if (hashValue === 'a-clinician') { 392 $('#pills-clinician-tab').addClass('active'); 393 $('#pills-clinician').addClass('active'); 394 } 395 396 } 397 398 // jQuery to manage open or close state for the menu fly inside pruduct hub and product pages 399 $(".diasorin-fly-menu .diasorin-fly-opener").on("click", function () { 400 $(".diasorin-fly-menu").toggleClass("fly-open"); 401 }); 402 403 $('#scroll-top-btn').click(function () { 404 $('html, body').animate({ 405 scrollTop: 0 406 }); 407 return false;
408 }); 409 410 411 $(window).on('scroll', function () { 412 // Scripts related product page 413 if ($('.general-anchor-menu').length) { 414 var scrollPosition = $(window).scrollTop(); 415 $('.general-anchor-menu').each(function () { 416 var elementOffset = $(this).offset().top; 417 if (elementOffset <= scrollPosition) { 418 $(this).addClass('anchor-fixed'); 419 } else { 420 $(this).removeClass('anchor-fixed'); 421 } 422 }); 423 } 424 425 if ($('.memed-anchor-menu').length) { 426 var scrollPosition = $(window).scrollTop(); 427 $('.memed-anchor-menu').each(function () { 428 var elementOffset = $(this).offset().top; 429 if (elementOffset <= scrollPosition) { 430 $(this).addClass('anchor-fixed'); 431 } else { 432 $(this).removeClass('anchor-fixed'); 433 } 434 }); 435 $('.node--type-landing-page .tabs-wrapper #pills-tab.nav-pills .nav-item .nav-link').on('click', function () { 436 $('.memed-anchor-menu').removeClass('anchor-fixed'); 437 }); 438 } 439 }); 440 441 // jQuery to change href and id value for product 442 if ($('.product-client-selection').length) { 443 // Get and rewrite the anchor menu href for clinical and laboratorist sections 444 $('.section-clinical .anchor-menu .anchor-menu-inner a').each(function () { 445 var hrefVal = $(this).attr('href'); 446 $(this).attr('href', hrefVal + 'clinical'); 447 }); 448 $('.section-laboratorist .anchor-menu .anchor-menu-inner a').each(function () { 449 var hrefVal = $(this).attr('href'); 450 $(this).attr('href', hrefVal + 'laboratorist'); 451 }); 452 // Get and rewrite the id for clinical and laboratorist sections 453 $('.section-clinical .anchor-wrapper-item .anchor-item').each(function () { 454 var idVal = $(this).attr('id'); 455 $(this).attr('id', idVal + 'clinical'); 456 }); 457 $('.section-laboratorist .anchor-wrapper-item .anchor-item').each(function () { 458 var idVal = $(this).attr('id'); 459 $(this).attr('id', idVal + 'laboratorist'); 460 }); 461 $('.client-type-selection .nav-link.btn').click(function () { 462 $('.anchor-menu').removeClass('anchor-fixed'); 463 }); 464 465 } 466 467 if ($('.view-test-our-history').length) { 468 $('.view-test-our-history .view-content').slick({ 469 centerMode: true, 470 centerPadding: '20px', 471 slidesToShow: 3, 472 arrows: false, 473 variableWidth: true, 474 focusOnSelect: true, 475 responsive: [{ 476 breakpoint: 1024, 477 settings: { 478 centerMode: true, 479 centerPadding: '40px', 480 slidesToShow: 1, 481 infinite: true, 482 } 483 }] 484 }); 485 } 486 487 // aggiunge le classi alle slide precedente e successiva alla slide corrente 488 function updateAdjacentSlides() { 489 var $slickCurrent = $('.view-test-our-history .slick-current.slick-active.slick-center'); 490 var $prevSlide = $slickCurrent.prev(); 491 var $nextSlide = $slickCurrent.next(); 492 493 $('.slide-active-prev').removeClass('slide-active-prev'); 494 $('.slide-active-next').removeClass('slide-active-next'); 495 496 if ($prevSlide.length) { 497 $prevSlide.addClass('slide-active-prev'); 498 } 499 500 if ($nextSlide.length) { 501 $nextSlide.addClass('slide-active-next'); 502 } 503 } 504 505 // richiamiamo la funzione quando viene cambiata la slide corrente 506 $('.view-test-our-history').on('afterChange', function (event, slick, currentSlide) { 507 updateAdjacentSlides(); 508 }); 509 510 // richiamiamo la funzione anche all'inizio 511 updateAdjacentSlides(); 512 513 514 $(window).on("load", function () { 515 // jQuery to add custom scrollbar to molecular diagnostics ystem/instrument table 516 $(".view-molecular-diagnostics-systems-instruments.view-display-id-block_2 .views-table tbody, .view-id-ltg_microspheres.view-display-id-block_2 .views-table tbody, .view-ltg-systems-instruments.view-display-id-block_2 .views-table tbody").mCustomScrollbar({ 517 axis: "x", 518 theme: "dark", 519 scrollInertia: 0, 520 alwaysShowScrollbar: 2, 521 mouseWheel: false 522 }); 523 524 // jQuery to add custom scrollbar to Bond disclaimer 525 $(".scrollable-disclaimer").mCustomScrollbar({ 526 axis: "y", 527 theme: "dark", 528 scrollInertia: 0, 529 alwaysShowScrollbar: 2, 530 mouseWheel: { 531 scrollAmount: 1000 532 } 533 }); 534 }); 535 536 // jQuery to manage scroll to previous point on page refresh 537 if (window.performance.navigation.type == 1) { 538 return; 539 } 540 541 if ($('#fys-search').length > 0) { 542 var scrollPos = sessionStorage.getItem('scrollPos'); 543 544 if (scrollPos !== null) { 545 $(window).scrollTop(scrollPos); 546 sessionStorage.removeItem('scrollPos'); 547 } 548 549 $(window).on('beforeunload', function () { 550 var scrollPos = $(window).scrollTop(); 551 sessionStorage.setItem('scrollPos', scrollPos); 552 }); 553 } 554 555 556 // jQuery to control the show more module 557 if ($('.read-more-wrapper').length) { 558 $('.readmore-btn').click(function () { 559 $('.more-text').slideToggle(); 560 $('.readmore-btn').toggleClass('open'); 561 }); 562 } 563 564 // jQuery to manage breadcrumbs for responsive 565 var breadcrumbs = $('.breadcrumb-item').find('a'); // Selettore per i breadcrumb 566 567 if ($(window).width() < 400) { 568 breadcrumbs.each(function (index) { 569 if (index !== 0) { 570 var text = $(this).text(); 571 572 if (text.length > 3) { 573 var truncatedText = text.substr(0, 3) + '...'; 574 $(this).text(truncatedText); 575 } 576 } 577 }); 578 } else { 579 // Ripristina il testo completo se la larghezza è superiore al breakpoint 580 breadcrumbs.each(function (index) { 581 if (index !== 0) { 582 var originalText = $(this).data('original-text'); 583 $(this).text(originalText); 584 } 585 }); 586 } 587 588 breadcrumbs.each(function () { 589 var text = $(this).text(); 590 $(this).data('original-text', text); 591 }); 592 593 }); // End of document.ready 594 595 if ($('.pr-redirect-value').length) { 596 var redirectValue = $('.pr-redirect-value').text().trim(); 597 if (redirectValue === 'Investors') { 598 var currentUrl = window.location.href; 599 var baseUrl = currentUrl.split('/').slice(0, 3).join('/'); // Extract base URL 600 var language = currentUrl.split('/')[3]; // Extract language 601 var newUrl = baseUrl + '/' + language + '/node/68'; // Construct new URL 602 window.location.href = newUrl; 603 } else { 604 var currentUrl = window.location.href; 605 var baseUrl = currentUrl.split('/').slice(0, 3).join('/'); // Extract base URL 606 var language = currentUrl.split('/')[3]; // Extract language 607 var newUrl = baseUrl + '/' + language + '/node/118'; // Construct new URL 608 window.location.href = newUrl; 609 } 610 } 611 612 $(window).on("load", function () { 613 614 615 // jQuery to manage year filters that have over 10 years inside and add a class scrollable 616 if ($('.section-filters-year-cat').length) { 617 var yearFacet = $('.section-filters-year-cat ul');
618 var facetItems = yearFacet.find('.facet-item'); 619 620 if (facetItems.length > 10) { 621 yearFacet.addClass('scrollable'); 622 } 623 } 624 625 // PASTING HERE THE VIEW HEADING CUSTOM TEXT TO BE ADDED WHEN RE-ENABLES 626 // // <div class="choice-button-wrapper"> 627 // // <a class="btn full-btn" id="btn-list">All the microspheres</a> 628 // // <a class="btn full-btn" id="btn-table">Quick Comparison</a> 629 // // </div> 630 631 // TO ADD WITH THE FOLLOWING JQUERY 632 // jQuery to manage mdx instrument views switch on button click 633 // if ($('.choice-button-wrapper').length) { 634 // // Selecting button and view using classes 635 // var buttonList = $("#btn-list"); 636 // var buttonTable = $("#btn-table"); 637 // var vistaLista = $(".view-molecular-diagnostics-systems-instruments.view-display-id-block_1 > .view-content, .view-ltg-systems-instruments.view-display-id-block_1 > .view-content, .view-ltg-microspheres.view-display-id-block_1 > .view-content"); 638 // var vistaTabella = $(".view-molecular-diagnostics-systems-instruments.view-display-id-block_2, .view-ltg-systems-instruments.view-display-id-block_2, .view-ltg-microspheres.view-display-id-block_2"); 639 // 640 // // Adding the class "active" to the button at page load 641 // buttonList.addClass("active"); 642 // vistaLista.show(); // Display the first view by default 643 // vistaTabella.hide(); // Hide the second view by default 644 // 645 // // At button click action 646 // buttonList.add(buttonTable).on("click", function() { 647 // // Remove class "active" to both buttons 648 // buttonList.add(buttonTable).removeClass("active"); 649 // 650 // // Add class "active" to the clicked button 651 // $(this).addClass("active"); 652 // 653 // // Verify which button is click and show/hide views accordingly 654 // if (buttonList.hasClass("active")) { 655 // vistaLista.show(); 656 // vistaTabella.hide(); 657 // } else if (buttonTable.hasClass("active")) { 658 // vistaLista.hide(); 659 // vistaTabella.show(); 660 // } 661 // }); 662 // }; 663 664 665 666 if ($('.colored-table').length) { 667 $(".table-module-wrapper .colored-table table tbody").each(function () { 668 var tableColor = $(this).data("number-color"); 669 $(this).find("tr td *").css("border-color", tableColor); 670 }); 671 }; 672 673 // jQuery to manage custom filter visibility for Diasorin Worldwide 674 $(".view-diasorin-facilites .views-exposed-form .form-item-facility-type:nth-child(2) input").click(); 675 676 // jQuery to manage main menu and submenu dropdown item on click opening on click 677 $('.diasorin-main-menu li.menu-item--expanded > span').on('click', function (event) { 678 var clickedMenuItem = $(this).parent(); 679 var subMenu = clickedMenuItem.find('ul.sub-menu'); 680 681 if (subMenu.length > 0) { 682 // Se l'elemento cliccato ha un sottomenu, apri/chiudi il sottomenu 683 subMenu.slideToggle(); 684 } else { 685 // Altrimenti, apri questo elemento e chiudi gli altri sottomenu 686 $('.diasorin-main-menu li.menu-item--expanded > ul.sub-menu').not(subMenu).slideUp(); 687 clickedMenuItem.siblings().removeClass('menu-open'); 688 clickedMenuItem.toggleClass('menu-open'); 689 690 // Add/remove menu-open class on body based on whether any menu item is open 691 if (clickedMenuItem.hasClass('menu-open')) { 692 $('body').addClass('menu-open'); 693 } else { 694 // Check if any other menu items are still open 695 if ($('.diasorin-main-menu li.menu-item--expanded.menu-open').length === 0) { 696 $('body').removeClass('menu-open'); 697 } 698 } 699 } 700 701 event.stopPropagation(); 702 }); 703 704 705 // Aggiungi il gestore di clic originale per aprire e chiudere gli elementi 706 $('.diasorin-main-menu > .menu > .menu-item--expanded > span').on('click', function () { 707 $('.diasorin-main-menu > .menu > .menu-item--expanded .menu-item--expanded').removeClass('menu-open'); 708 }); 709 710 // Aggiungi il gestore di clic originale per aprire e chiudere gli elementi 711 $('.diasorin-megamenu.diasorin-main-menu .menu-item--expanded>.menu-dropdown .menu.menu-level-1>.menu-item > span').on('click', function () { 712 console.log('click'); 713 $('.diasorin-megamenu.diasorin-main-menu .menu-item--expanded>.menu-dropdown .menu.menu-level-1>.menu-item.menu-open>.menu-dropdown .menu-item--expanded').removeClass('menu-open'); 714 }); 715 716 // jQuery to manage the removal of 'menu-open' class on page scroll 717 $(document).on('scroll', function () { 718 $('.diasorin-main-menu:not(.diasorin-megamenu) .menu-item--expanded').removeClass('menu-open'); 719 }); 720 721 722 // jQuery to manage the removal of 'menu-open' class on diasorin-megamenu-close button click 723 $(document).on('click', '.diasorin-megamenu-close', function () { 724 $('.diasorin-main-menu .menu-item--expanded').removeClass('menu-open'); 725 $('body').removeClass('menu-open'); 726 }); 727 728 729 // jQuery to close nested expanded menu items when clicking on level 1 menu items without menu-open class 730 $(document).on('click', '.diasorin-main-menu .menu-item--expanded>.menu-dropdown .menu.menu-level-1>.menu-item>span', function () { 731 console.log('click'); 732 // $('.diasorin-main-menu .menu-item--expanded>.menu-dropdown .menu.menu-level-1>.menu-item.menu-open>.menu-dropdown .menu-item--expanded').removeClass('menu-open'); 733 }); 734 735 736 // jQuery to add close button to global search widget 737 $('body:not(.page-view-global-search) div#page-wrapper .featured-top .diasorin-global-search-bar').append('<button class="search-close"><i class="icon-diasorin-close"></i></button>'); 738 $('body:not(.page-view-memed-global-search) div#page-wrapper .featured-top .diasorin-memed-global-search-bar').append('<button class="search-close"><i class="icon-diasorin-close"></i></button>'); 739 $('body:not(.page-view-nes-resources) div#page-wrapper .featured-top .diasorin-liaison-global-search-bar').append('<button class="search-close"><i class="icon-diasorin-close"></i></button>'); 740 741 742 // jQuery to add "visible" class on click of element ".diasorin-search .search" 743 $('body:not(.page-view-global-search) .diasorin-search .search').on('click', function () { 744 $('div#page-wrapper .featured-top .diasorin-global-search-bar').addClass('visible'); 745 $('body').addClass('search-bar-visible'); 746 }); 747 // jQuery to add "visible" class on click of element ".diasorin-search .search" for memed 748 $('body:not(.page-view-memed-global-search) .memed-global-search-toggle .memed-global-search-icon').on('click', function () { 749 $('div#page-wrapper .featured-top .diasorin-memed-global-search-bar').addClass('visible'); 750 $('body').addClass('search-bar-visible'); 751 }); 752 // jQuery to add "visible" class on click of element ".diasorin-search .search" for Liaison NES 753 $('body:not(.page-view-memed-global-search) .diasorin-main-menu-liaison .memed-global-search-icon, body:not(.page-view-nes-resources) .liaison-global-search-toggle').on('click', function () { 754 $('div#page-wrapper .featured-top .diasorin-liaison-global-search-bar').addClass('visible'); 755 $('body').addClass('search-bar-visible'); 756 }); 757 // jQuery to remove "visible" class on click of element ".search-close" 758 $('body:not(.page-view-global-search) div#page-wrapper .featured-top .diasorin-global-search-bar .search-close').on('click', function () { 759 $('div#page-wrapper .featured-top .diasorin-global-search-bar').removeClass('visible'); 760 $('body').removeClass('search-bar-visible'); 761 }); 762 // jQuery to remove "visible" class on click of element ".search-close" for memed 763 $('body:not(.page-view-memed-global-search) div#page-wrapper .featured-top .diasorin-memed-global-search-bar .search-close').on('click', function () { 764 $('div#page-wrapper .featured-top .diasorin-memed-global-search-bar').removeClass('visible'); 765 $('body').removeClass('search-bar-visible'); 766 }); 767 // jQuery to remove "visible" class on click of element ".search-close" for Liaison NES 768 $('body:not(.page-view-nes-resources) div#page-wrapper .featured-top .diasorin-liaison-global-search-bar .search-close').on('click', function () { 769 $('div#page-wrapper .featured-top .diasorin-liaison-global-search-bar').removeClass('visible'); 770 $('body').removeClass('search-bar-visible'); 771 }); 772 // Seleziona l'elemento del tab attivo 773 // Imposta l'evento di clic per le schede 774 $('.client-type-selection ul li button').on('click', function (e) { 775 e.preventDefault(); // Impedisce il comportamento predefinito del link 776 777 // Ottieni l'ID della scheda corrente dall'attributo "data-href" o "href" del link o del pulsante 778 var currentTab = $(this).data('href'); 779 780 // Esegui lo scorrimento verso l'alto fino al contenuto della scheda corrente 781 $('html, body').animate({ 782 scrollTop: $(currentTab).offset().top 783 }, 500); // Imposta la durata dell'animazione in millisecondi 784 }); 785 786 // Funzione per spostare gli elementi .slick-arrow e .slick-dots in .slider-navigation 787 function ContainerSliderNavigation(containerSelector) { 788 var container = $(containerSelector); 789 790 if (container.find(".slick-slider").length > 0) { 791 792 var arrowsAndDots = container.find(".slick-slider .slick-arrow, .slick-slider .slick-dots"); 793 794 var sliderNavigation = $("<div class='slider-navigation'></div>"); 795 796 arrowsAndDots.appendTo(sliderNavigation); 797 798 container.find(".slick-slider").append(sliderNavigation); 799 } 800 } 801 802 803 // Esegui la funzione per ciascuno dei tre container desiderati 804 ContainerSliderNavigation(".node--type-mdx-instrument"); 805 ContainerSliderNavigation(".node--type-systems"); 806 ContainerSliderNavigation(".node--type-ltg-instruments"); 807 808 809 // jQuery to manage automatic click of first Year facets if not already active 810 const filterYear = $(".section-filters-module ul[data-drupal-facet-alias='year'] .facet-item:first-child a"); 811 if (!filterYear.hasClass('is-active')) { 812 filterYear.click(); 813 } 814 815 816 $(".single-anchor").on('click', function (e) { 817 e.preventDefault(); // Prevent the default click behavior 818 819 var target = $(this).attr('href'); 820 821 // Scroll verso la sezione corrispondente 822 $('html, body').animate({ 823 scrollTop: $(target).offset().top 824 }); 825 }); 826 if (!$(".tabs-wrapper").length) { 827 $(".single-anchor-label").on('click', function (e) { 828 $(this) 829 .addClass('active') // Aggiungi active a quello cliccato 830 .siblings('.single-anchor-label') // Se sono fratelli diretti 831 .removeClass('active'); // Rimuovi active dai fratelli 832 }); 833 } 834 // Managing anchor menu inside tabs 835 if ($(".tabs-wrapper").length) { 836 $(".tabs-wrapper .tab-content .tab-pane.show.active .single-anchor-label").on('click', function (e) { 837 $(this) 838 .addClass('active') // Aggiungi active a quello cliccato 839 .siblings('.single-anchor-label') // Se sono fratelli diretti 840 .removeClass('active'); // Rimuovi active dai fratelli 841 }); 842 843 if ($('.anchor-menu').length) { 844 var offset = 10; 845 var activeAnchor = null; 846 847 $(window).scroll(function () { 848 var position = $(this).scrollTop() + offset; 849 850 $('.tabs-wrapper .tab-content .tab-pane.show.active .single-anchor-label[href^="#"]').each(function () { 851 var anchorId = $(this).attr('href'); 852 var target = $(anchorId).offset(); 853 854 // Check if the target element exists and has a valid offset 855 if (target && target.top !== undefined && position >= target.top) { 856 activeAnchor = anchorId; 857 } 858 }); 859 860 // Remove active class from all links 861 $('.tabs-wrapper .tab-content .tab-pane.show.active .single-anchor-label[href^="#"]').removeClass("active"); 862 863 // Add active class to the currently active link 864 if (activeAnchor) { 865 $('.tabs-wrapper .tab-content .tab-pane.show.active .single-anchor-label[href="' + activeAnchor + '"]').addClass('active'); 866 } 867 }); 868 869 $(function () { 870 $(window).scroll(); 871 }); 872 } 873 } 874 875 if ($(window).width() > 991) { 876 // jQuery to manager active state on immunodiagnostics system assay 877 $(".facets-view-wrapper .js-facets-widget .facet-item a, .system-assay-facets .js-facets-links .facet-item a").on('click', function (e) { 878 e.preventDefault(); // Prevent the default click behavior 879 880 // Check if the clicked element already has the 'is-active' class 881 if (!$(this).hasClass("is-active")) { 882 // Remove 'is-active' class from all elements 883 $(".facets-view-wrapper .js-facets-widget .facet-item a, .system-assay-facets .js-facets-links .facet-item a").removeClass("is-active"); 884 // Trigger click on the element with 'is-active' class 885 $(".facets-view-wrapper .js-facets-widget .facet-item a.is-active, .system-assay-facets .js-facets-links .facet-item a.is-active").click(); 886 // Add 'is-active' class to the clicked element 887 $(this).addClass("is-active"); 888 } 889 }); 890 891 // // jQuery to automatically click the first Taxonomy facet if not already active for system assays menu 892 if ($('.facets-view-wrapper, .system-assay-facets').length > 0) { 893 // Verifica se è presente una query nella URL 894 if (window.location.search.length > 0) { 895 // Se presente, ricarica la pagina senza la query 896 window.location.href = window.location.origin + window.location.pathname; 897 } else { 898 var $firstFacetLink = $('.block-facets-ajax .js-facets-widget .facet-item:first-child a'); 899 900 if (!$firstFacetLink.hasClass('is-active')) { 901 $firstFacetLink.trigger('click'); // Simula il clic sul link 902 } 903 } 904 } 905 }; 906 907 if (window.performance && window.performance.navigation.type === 2) { 908 // La pagina è stata raggiunta tornando indietro nella navigazione 909 910 // Verifica se c'è una query nell'URL 911 if (window.location.search) { 912 // Rimuovi la query e ricarica la pagina 913 var baseUrl = window.location.href.split('?')[0]; 914 window.location.href = baseUrl; 915 } 916 } 917 918 919 }); 920 921 922 923 // Scripts related to Systems main features slideshow 924 if ($('.system-main-features-slide').length) { 925 926 // Script to toggle class "active" if there's a match with the class "media-item-#" and add a default active 927 // select the first "hotspot" and "single-media" elements that shares the same class 928 var $firstHotspot = $(".hotspot").eq(0); 929 var sharedHotspotClass = $firstHotspot.data("shared-class"); 930 var $firstMedia = $(".single-media." + sharedHotspotClass
930).eq(0); 931 932 $(".media-item-1").addClass("active"); 933 $firstHotspot.addClass("active"); 934 $firstMedia.addClass("active"); 935 936 // Adds click event to all "hotspot" elements 937 $(".hotspot").click(function () { 938 var sharedHotspotClass = $(this).data("shared-class"); 939 $(".slick-active .hotspot.active").removeClass("active"); 940 $(this).addClass("active"); 941 $(".slick-active .single-media.active").removeClass("active"); 942 $(".slick-active .single-media." + sharedHotspotClass).addClass("active"); 943 }); 944 945 } 946 947 // Script to redirect to filtered search view page with the selected terms 948 $(document).on('click', '.immuno-search', function () { 949 var dataHref = $(this).data('href'); 950 var language = window.location.pathname.split("/").filter((fragment) => !!fragment).shift(); 951 var currentQuery = window.location.search; 952 var combinedUrl = "/" + language + dataHref + currentQuery; 953 window.location.href = combinedUrl; 954 }); 955 // jQuery to manage dropdown open on click 956 $(document).on('click', '.drop-opener', function () { 957 var $parent = $(this).parent(); 958 959 // Verifica se l'elemento cliccato ha la classe 'drop-open' 960 if (!$parent.hasClass('drop-open')) { 961 // Rimuovi la classe 'drop-open' dagli elementi '.drop-open' 962 $('.drop-open').removeClass('drop-open'); 963 // Aggiungi la classe 'drop-open' all'elemento genitore cliccato 964 $parent.addClass('drop-open'); 965 } else { 966 // Se l'elemento cliccato ha già la classe 'drop-open', rimuovila 967 $parent.removeClass('drop-open'); 968 } 969 }); 970 971 // jQuery to manage reset button for search filters 972 $(document).on('click', '.reset-filters', function () { 973 $('.diasorin-fys-search .facet-active').each(function () { 974 $(this).find('.facets-reset a').click(); 975 }); 976 }); 977 978 979 980 // RESPONSIVE SECTION 981 if ($(window).width() < 1441) { 982 $(document).ready(function () { 983 // Script to get spacer height, divide it by 2 and replace the height value 984 $('.spacer').each(function () { 985 var originalHeight = $(this).height(); 986 var newHeight = originalHeight / 1.5; 987 $(this).height(newHeight); 988 }); 989 990 991 // Script to build slick slider for multiple cards slider 992 if ($('.multi-responsive-slider').length) { 993 $('.multi-responsive-slider .slider-wrapper').slick({ 994 slidesToShow: 2, 995 speed: 400, 996 arrows: true, 997 infinite: false, 998 variableWidth: true, 999 dots: true, 1000 responsive: [{ 1001 breakpoint: 768, 1002 settings: { 1003 slidesToShow: 1, 1004 centerMode: true, 1005 infinite: true, 1006 } 1007 }] 1008 }); 1009 } 1010 }); 1011 }; 1012 1013 if ($(window).width() < 992) { 1014 $(document).ready(function () { 1015 // jQuery to cut system/instrument background video and place it under the text 1016 if ($('.system-hero').length) {
1017 var systemBackgroundVideo = $('.system-hero .col-img.col-video .hero-back-media').detach(); 1018 $('.system-hero .single-row .col-text').append(systemBackgroundVideo); 1019 } 1020 1021 // WARNING: PROBLEMATIC JQUERY: BREAKS FILTER BY DISEASE PAGE LOOPING IT 1022 // jQuery to change facets functionality for mobile immuno 1023 if ($('.custom-facets-block.system-assay-facets, .facets-wrapper').length) { 1024 var $facetItems = $('.js-facets-links .facet-item a'); 1025 var $firstFacetItem = $facetItems.first(); 1026 1027 $facetItems.on('click', function () { 1028 // console.log('click') 1029 var $clickedItem = $(this); 1030 var $clickedContainer = $clickedItem.closest('.facet-item'); 1031 1032 if (!$clickedContainer.hasClass('is-active')) { 1033 $facetItems.closest('.facet-item').removeClass('is-active'); 1034 $clickedContainer.addClass('is-active'); 1035 } 1036 }); 1037 1038 // jQuery to automatically click the first Taxonomy facet if not already active for system assays menu 1039 // Verifica se è presente una query nella URL 1040 if (window.location.search.length > 0) { 1041 // Se presente, ricarica la pagina senza la query 1042 window.location.href = window.location.origin + window.location.pathname; 1043 } else { 1044 var $firstFacetLink = $('.block-facets-ajax .js-facets-widget .facet-item:first-child a'); 1045 1046 if (!$firstFacetLink.hasClass('is-active')) { 1047 $firstFacetLink.trigger('click'); // Simula il clic sul link 1048 } 1049 } 1050 1051 $(document).on('click', '.facets-widget-links', function () { 1052 $(this).toggleClass('is-open'); 1053 }); 1054 1055 } 1056 1057 // BEF radios in .section-immuno-devices-product: dropdown toggle like facets 1058 if ($('.section-immuno-devices-product').length) { 1059 $(document).on('click', '.section-immuno-devices-product .view-filters .form-radios', function (e) { 1060 var $radios = $(this); 1061 var $target = $(e.target); 1062 var $item = $target.closest('.js-form-type-radio'); 1063 1064 // If closed â open 1065 if (!$radios.hasClass('is-open')) { 1066 $radios.addClass('is-open'); 1067 return; 1068 } 1069 1070 // Open: clicking the checked item or its label â just close 1071 if ($item.length && $item.find('input:checked').length) { 1072 $radios.removeClass('is-open'); 1073 return; 1074 } 1075 1076 // Open: clicking outside any item (arrow area) â close 1077 if (!$item.length) { 1078 $radios.removeClass('is-open'); 1079 return; 1080 } 1081 1082 // Open: clicking an unchecked item â select + close (BEF autosubmit fires) 1083 if ($item.length && !$item.find('input:checked').length) { 1084 $item.find('input[type="radio"]').first().prop('checked', true).trigger('change'); 1085 $radios.removeClass('is-open'); 1086 } 1087 }); 1088 1089 // Close when clicking outside 1090 $(document).on('click', function (e) { 1091 if (!$(e.target).closest('.section-immuno-devices-product .view-filters .form-radios').length) { 1092 $('.section-immuno-devices-product .view-filters .form-radios').removeClass('is-open'); 1093 } 1094 }); 1095 } 1096 1097 // jQuery to manage footer navigation as accordion 1098 $(".site-footer__top .region nav.block-menu").click(function () { 1099 if ($(this).hasClass("is-open")) { 1100 $(this).removeClass("is-open"); 1101 } else { 1102 $(".site-footer__top .region nav.block-menu").removeClass("is-open"); 1103 $(this).addClass("is-open"); 1104 } 1105 }); 1106 1107 // jQuery to add slick to immunodiagnostics product card inside solutions 1108 $(".section-hero .multi-grid-4col-wrapper").slick({ 1109 slidesToShow: 1, 1110 slidesToScroll: 1, 1111 dots: true, 1112 centerMode: true, 1113 variableWidth: true, 1114 }); 1115 1116 // Memed video & webinars as slide 1117 $(".memed-video-webinars-card-container .view-content.row").slick({ 1118 slidesToShow: 1, 1119 slidesToScroll: 1, 1120 dots: true, 1121 centerMode: false, 1122 variableWidth: true, 1123 infinite: false, 1124 }); 1125 }); 1126 1127 }; 1128 1129 $(window).on('resize', function () { 1130 if ($(window).width() < 991) { 1131 // Memed video & webinars as slide 1132 $(".memed-video-webinars-card-container .view-content.row").slick({ 1133 slidesToShow: 1, 1134 slidesToScroll: 1, 1135 dots: true, 1136 centerMode: false, 1137 variableWidth: true, 1138 infinite: true, 1139 }); 1140 } else { 1141 $(".memed-video-webinars-card-container .view-content.row").slick('unslick'); 1142 } 1143 }); 1144 1145 // jQuery to add copyToClipboard functionality 1146 if ($('.copy-clipboard').length) { 1147 $(document).on('click', '.copy-btn', function () { 1148 var $btn = $(this); // Cache the button element 1149 var id = $btn.attr('id'); 1150 var text = $('#' + id.replace('btn', 'code')).text(); 1151 copyToClipboard(text); 1152 1153 // Add tooltip-clicked class 1154 $btn.addClass('tooltip-clicked'); 1155 1156 // Remove class after 2 seconds 1157 setTimeout(function () { 1158 $btn.removeClass('tooltip-clicked'); 1159 }, 2000); 1160 }); 1161 1162 function copyToClipboard(text) { 1163 var inputTemp = $('<input>'); 1164 $('body').append(inputTemp); 1165 inputTemp.val(text).select(); 1166 document.execCommand('copy'); 1167 inputTemp.remove(); 1168 } 1169 } 1170 1171 // Verifica se il cookie è impostato correttamente al caricamento della pagina 1172 var bondAcceptCookie = getCookie('bondAccept'); 1173 if (bondAcceptCookie === 'true') { 1174 $('body').addClass('bond-accepted'); 1175 } 1176 1177 $('.bond-disclaimer-btn .full-btn.agree-btn').click(function () { 1178 // Crea il cookie 1179 document.cookie = 'bondAccept=true; path=/'; 1180 1181 // Aggiungi la classe al body 1182 $('body').addClass('bond-accepted'); 1183 1184 // Aggiorna la pagina o esegui altre azioni 1185 location.reload(); // Ricarica la pagina dopo aver impostato il cookie 1186 }); 1187 1188 1189 // Verifica se il cookie è impostato correttamente al caricamento della pagina 1190 var domainSelectCookie = getCookie('domainSelect'); 1191 if (domainSelectCookie === 'true') { 1192 $('body').addClass('domain-selected'); 1193 } 1194 1195 $('.diasorin-product-domain-disclaimer .list-group-item a, .diasorin-memed-domain-redirect-wrapper .diasorin-memed-domain-redirect').click(function () { 1196 // Crea il cookie 1197 document.cookie = 'domainSelect=true; path=/'; 1198 1199 // Aggiungi la classe al body 1200 $('body').addClass('domain-selected'); 1201 1202 // Aggiorna la pagina o esegui altre azioni 1203 location.reload(); // Ricarica la pagina dopo aver impostato il cookie 1204 }); 1205 1206 // Funzione per ottenere il valore di un cookie 1207 function getCookie(name) { 1208 var cookieArr = document.cookie.split(';'); 1209 for (var i = 0; i < cookieArr.length; i++) { 1210 var cookiePair = cookieArr[i].split('='); 1211 var cookieName = cookiePair[0].trim(); 1212 if (cookieName === name) { 1213 return decodeURIComponent(cookiePair[1]); 1214 } 1215 } 1216 return null; 1217 } 1218 1219 1220 1221 Drupal.behaviors.mybehavior = { 1222 attach: function (context, settings) { 1223 // $(".view-diasorin-facilites select, .view-technical-support-mdx select, .view-technical-support-molecular-diagnostics-luminex select, .diasorin-global-search-filters.dgs-sort select").select2({ 1224 $("select").select2({ 1225 minimumResultsForSearch: Infinity 1226 }); 1227 // jQuery to manage year filter scroll 1228 if ($('.facets-year-filter').length) { 1229 var list = $(".section-filters-module .facets-year-filter .facets-year-scroll ul[data-drupal-facet-alias='year'], .view-header .facets-year-filter .result-years-append"); 1230 var leftArrow = $("#left-arrow"); 1231 var rightArrow = $("#right-arrow"); 1232 1233 var baseScrollAmount = 35; 1234 var additionalScrollAmount = 37; 1235 var screenWidthThreshold = 1440; 1236 1237 leftArrow.on("click", function () { 1238 var scrollAmount = $(window).width() > screenWidthThreshold ? additionalScrollAmount : baseScrollAmount; 1239 list.scrollLeft(list.scrollLeft() - scrollAmount); 1240 }); 1241 1242 rightArrow.on("click", function () { 1243 var scrollAmount = $(window).width() > screenWidthThreshold ? additionalScrollAmount : baseScrollAmount; 1244 list.scrollLeft(list.scrollLeft() + scrollAmount); 1245 }); 1246 } 1247 // Get the year facet element. 1248 var yearFacet = $(".section-filters-module ul[data-drupal-facet-alias='year'] .facet-item.facets-reset"); 1249 1250 // When the year facet element is clicked, click the reset button for the category facet after 2000ms, but only if the button does not have the "is-active" class and the facet exists. 1251 yearFacet.on("click", function () { 1252 var categoryFacet = $(".section-filters-module ul[data-drupal-facet-alias='year'] .facet-item.facets-reset a"); 1253 if (!categoryFacet.hasClass("is-active")) { 1254 categoryFacet.click(); 1255 } 1256 }); 1257 1258 1259 /* 1260 * 1261 * Changing the LTG FYS view activation based 1262 * on filter selection after facets block update 1263 */ 1264 // jQuery to manage LTG Finf your solution view activation based on filter selection 1265 // $('.diasorin-ltg-fys .facet-block:nth-child(4), .diasorin-ltg-fys .facet-block:nth-child(5), .diasorin-ltg-fys .facet-block:nth-child(7), .diasorin-ltg-fys .facet-block:nth-child(8), .diasorin-ltg-fys .facet-block:nth-child(9), .diasorin-ltg-fys .facet-block:nth-child(12), .diasorin-ltg-fys .facet-block:nth-child(13), .diasorin-ltg-fys .facet-block:nth-child(14)').each(function() { 1266 // if ($(this).hasClass('facet-active')) { 1267 // $(".view-ltg-fys-search").addClass("ltg-fys-results-visible"); 1268 // } 1269 // }); 1270 $('.diasorin-ltg-fys .content .block-facets-ajax:nth-child(4), .diasorin-ltg-fys .content .block-facets-ajax:nth-child(5), .diasorin-ltg-fys .content .block-facets-ajax:nth-child(7), .diasorin-ltg-fys .content .block-facets-ajax:nth-child(8), .diasorin-ltg-fys .content .block-facets-ajax:nth-child(9), .diasorin-ltg-fys .content .block-facets-ajax:nth-child(12), .diasorin-ltg-fys .content .block-facets-ajax:nth-child(13), .diasorin-ltg-fys .content .block-facets-ajax:nth-child(14)').each(function () { 1271 if ($(this).hasClass('facet-active')) { 1272 $(".view-ltg-fys-search").addClass("ltg-fys-results-visible"); 1273 } 1274 }); 1275 1276 // jQuery to manage page reload on reload page button 1277 $('.reload-page').click(function () { 1278 console.log('reload-page clicked'); 1279 if ($('.reload-page').length > 0) { 1280 var url = window.location.href.split('?')[0]; 1281 window.location.href = url; 1282 } 1283 }); 1284 1285 1286 // jQuery to manage visibility of filters based on Facility type selection 1287 $(document).on('click', '.view-diasorin-facilites .views-exposed-form .form-item-facility-type:nth-child(3) input, .view-diasorin-facilites .views-exposed-form .form-item-facility-type:nth-child(4) input', function () { 1288 $(document).ajaxComplete(function () { 1289 $(".view-diasorin-facilites .views-exposed-form .form-type-select").removeClass("visible"); 1290 $(".view-diasorin-facilites .views-exposed-form .form-type-select.form-item-facility-region").addClass("visible"); 1291 }); 1292 }); 1293 1294 $(document).on('click', '.view-diasorin-facilites .views-exposed-form .form-item-facility-type:nth-child(5) input', function () { 1295 $(document).ajaxComplete(function () { 1296 $(".view-diasorin-facilites .views-exposed-form .form-type-select").addClass("visible"); 1297 }); 1298 }); 1299 1300 $(document).on('click', '.view-diasorin-facilites .views-exposed-form .form-item-facility-type:nth-child(2) input', function () { 1301 $(document).ajaxComplete(function () { 1302 $(".view-diasorin-facilites .views-exposed-form .form-type-select").removeClass("visible"); 1303 }); 1304 }); 1305 1306 // Jquery to reset dropdown values on Facility type selection 1307 $(document).on('click', '.view-diasorin-facilites .views-exposed-form .form-item-facility-type input', function () { 1308 $('.view-diasorin-facilites select').val(null).trigger('change'); 1309 }); 1310 1311 // Find the listed views and check if it has more than one child and add class 1312 var $view = $('.view-mdx-kitsreagents-instruments-card, .view-system-product-cards, .view-ltg-microsphere-instruments-card'); 1313 1314 var numberOfChildren = $view.find('.single-system').length; 1315 1316 if (numberOfChildren > 1) { 1317 $view.addClass('card-two-column'); 1318 } 1319 1320 // Slider latest solutions homepage 1321 $('.hp-latest-solution-slider .view-content').slick({ 1322 centerMode: true, 1323 slidesToShow: 3, 1324 slidesToScroll: 1, 1325 dots: true,
1326 arrows: false, 1327 infinite: true, 1328 variableWidth: true, 1329 focusOnSelect: true, 1330 responsive: [{ 1331 breakpoint: 991, 1332 settings: { 1333 centerMode: true, 1334 centerPadding: '40px', 1335 slidesToShow: 1, 1336 } 1337 }] 1338 }); 1339 1340 // Slider latest solutions homepage 1341 $('.video-webinar-slider .view-content').slick({ 1342 centerMode: true, 1343 slidesToShow: 3, 1344 slidesToScroll: 1, 1345 dots: true, 1346 arrows: false, 1347 infinite: true, 1348 variableWidth: true, 1349 focusOnSelect: true, 1350 responsive: [{ 1351 breakpoint: 991, 1352 settings: { 1353 centerMode: true, 1354 centerPadding: '40px', 1355 slidesToShow: 1, 1356 } 1357 }] 1358 }); 1359 1360 1361 // jQuery to manage anchor menu 1362 if ($('.anchor-menu').length === 1) { 1363 console.log("anchor-menu once"); 1364 var offset = 10; 1365 var activeAnchor = null; 1366 1367 // Smooth scroll to anchor with scrolled header + anchor menu offset 1368 $(document).on('click', '.anchor-menu .anchor-menu-inner a[href^="#"]', function (e) { 1369 var targetId = $(this).attr('href'); 1370 var $target = $(targetId); 1371 if (!$target.length) { return; } 1372 e.preventDefault(); 1373 var $allLinks = $('.anchor-menu .anchor-menu-inner a[href^="#"]'); 1374 var isFirst = $allLinks.first().is($(this)); 1375 var headerHeight = isFirst ? ($('header#header').outerHeight(true) || 0) : 0; 1376 var anchorMenuHeight = isFirst ? ($('.anchor-menu').outerHeight(true) || 0) : 0; 1377 var scrollTo = $target.offset().top - headerHeight - anchorMenuHeight; 1378 $('html, body').animate({ scrollTop: scrollTo }, 400); 1379 }); 1380 1381 $(window).scroll(function () { 1382 var position = $(this).scrollTop() + offset; 1383 1384 $('.anchor-menu .anchor-menu-inner a[href^="#"]').each(function () { 1385 var anchorId = $(this).attr('href'); 1386 var target = $(anchorId).offset(); 1387 1388 // Check if the target element exists and has a valid offset 1389 if (target && target.top !== undefined && position >= target.top) { 1390 activeAnchor = anchorId; 1391 } 1392 }); 1393 1394 // Remove active class from all links 1395 $('.anchor-menu .anchor-menu-inner a[href^="#"]').removeClass("active"); 1396 1397 // Add active class to the currently active link 1398 if (activeAnchor) { 1399 $('.anchor-menu .anchor-menu-inner a[href="' + activeAnchor + '"]').addClass('active'); 1400 } 1401 }); 1402 1403 $(function () { 1404 $(window).scroll(); 1405 }); 1406 } 1407 // jQuery to find every element with the class "file-weight" and remove the decimal 1408 $(".file-weight").each(function () { 1409 // Use a regular expression to remove decimals but keep the suffix 1410 var text = $(this).text().replace(/(\.\d+)\s(\w+)/, '\$2'); 1411 // Set the new text without decimals 1412 $(this).text(text); 1413 }); 1414 }, 1415 1416 }; 1417 1418 // 2026-05-21 Commenting this out to enable the query parameters manager 1419 // $(document).ready(function () { 1420 // // Verificare se esiste l'elemento con la classe ".diasorin-product-domain-disclaimer" 1421 // if ($('.diasorin-product-domain-disclaimer').length > 0) { 1422 // // Per ogni elemento con la classe ".diasorin-product-domain-disclaimer a" 1423 // $('.diasorin-product-domain-disclaimer a').each(function () { 1424 // // Verificare se l'elemento ha un attributo href 1425 // if ($(this).attr('href')) { 1426 // // Ottenere l'URL corrente 1427 // var currentUrl = $(this).attr('href'); 1428 1429 // // Rimuovere la query dalla URL 1430 // var updatedUrl = removeQuery(currentUrl); 1431 1432 // // Aggiornare l'attributo href con la nuova URL 1433 // $(this).attr('href', updatedUrl); 1434 // } 1435 // }); 1436 // } 1437 // }); 1438 1439 $(document).ready(function () { 1440 $('#spb-block-japanese-and-chinese-popup .btn').click(function (e) { 1441 e.preventDefault(); 1442 $('.block-japanese-and-chinese-popup-modal').hide(); 1443 $('body').css({ 'overflow': '', }) 1444 }) 1445 1446 // MEMED VIRAL SCORE 1447 // Commenting this out to enable the cursor on click 1448 // if ($(window).width() > 991) { 1449 // const $barContainer = $('.biomarker-bar-container'); 1450 // const $cursor = $('.custom-cursor'); 1451 1452 // $barContainer.on('mousemove', function(e) { 1453 // if ($(e.target).closest('.score-range').length) { 1454 // return; 1455 // } 1456 1457 // const offset = $barContainer.offset(); 1458 // const x = e.pageX - offset.left; 1459 1460 // $cursor.css({ 1461 // left: (x - 32) + 'px', 1462 // opacity: 1 1463 // }); 1464 // }); 1465 1466 // $barContainer.on('mouseleave', function() { 1467 // // $cursor.css('opacity', 0); 1468 // }); 1469 // $('.score-range').on('mouseenter', function() { 1470 // // $cursor.css('opacity', 0); 1471 // }); 1472 1473 // } else { 1474 // $('.biomarker-bar .bin').on('click', function() { 1475 // const $tooltip = $(this).find('.tooltip'); 1476 1477 // if ($tooltip.css('opacity') === '1') { 1478 // $tooltip.css({ 1479 // // opacity: 0, 1480 // visibility: 'hidden', 1481 // transform: 'translateX(-50%) translateY(10px)' 1482 // }); 1483 // } else { 1484 // $('.biomarker-bar .tooltip').css({ 1485 // // opacity: 0, 1486 // visibility: 'hidden', 1487 // transform: 'translateX(-50%) translateY(10px)' 1488 // }); 1489 1490 // $tooltip.css({ 1491 // // opacity: 1, 1492 // visibility: 'visible', 1493 // transform: 'translateX(-50%) translateY(0)' 1494 // }); 1495 // } 1496 1497 1498 // const $bin = $(this); 1499 // const $cursor = $('.custom-cursor'); 1500 // const $container = $('.biomarker-bar'); 1501 1502 // if ($bin.hasClass('active')) { 1503 // $bin.removeClass('active'); 1504 // $cursor.css({ 1505 // opacity: 0 1506 // }); 1507 // return; 1508 // } 1509 1510 // $('.biomarker-bar .bin').removeClass('active'); 1511 // $bin.addClass('active'); 1512 1513 // const containerOffsetTop = $container.offset().top; 1514 // const binOffsetTop = $bin.offset().top; 1515 1516 // const binHeight = $bin.outerHeight(); 1517 // const cursorHeight = $cursor.outerHeight(); 1518 1519 // const topOffset = binOffsetTop - containerOffsetTop + (binHeight / 2) - (cursorHeight / 2); 1520 1521 // $cursor.css({ 1522 // top: topOffset + 'px', 1523 // opacity: 1 1524 // }); 1525 // }); 1526 // } 1527 1528 // Landing page tab click handling 1529 if ($('body').hasClass('node--type-landing-page')) { 1530 // console.log('landing page tab click handling'); 1531 // Gestione tab 1532 $('[data-target-title]').on('click', function (e) { 1533 e.preventDefault(); 1534 const target = $(this).data('target-title'); 1535 const url = new URL(window.location.href); 1536 url.search = '?' + target; 1537 window.history.pushState({}, '', url); 1538 activateTab(target); 1539 1540 // Add smooth scrolling to the corresponding element 1541 const $targetElement = $('[data-target-title="' + target + '"]'); 1542 if ($targetElement.length) { 1543 $('html, body').animate({ 1544 scrollTop: $targetElement.offset().top - 100 // Offset by 100px to account for any fixed headers 1545 }, 500); 1546 } 1547 }); 1548 1549 const queryString = window.location.search; 1550 if (queryString.startsWith('?')) { 1551 const targetFromUrl = queryString.substring(1).replace(/=$/, ''); 1552 activateTab(targetFromUrl); 1553 1554 // Add smooth scrolling when loading from URL 1555 const $targetElement = $('[data-target-title="' + targetFromUrl + '"]'); 1556 if ($targetElement.length) { 1557 setTimeout(() => { 1558 $('html, body').animate({ 1559 scrollTop: $targetElement.offset().top - 100 1560 }, 500); 1561 }, 100); // Small delay to ensure DOM is ready 1562 } 1563 } 1564 1565 function activateTab(targetValue) { 1566 // Remove active class from all tabs and set aria-selected to fal
1566se 1567 $('[data-target-title]').removeClass('active').attr('aria-selected', 'false'); 1568 1569 // Remove active class from all tab panes 1570 $('.tab-pane').removeClass('active show'); 1571 1572 // Get the target tab 1573 const $tabToActivate = $('[data-target-title="' + targetValue + '"]'); 1574 1575 if ($tabToActivate.length) { 1576 // Add active class to the target tab and set aria-selected to true 1577 $tabToActivate.addClass('active').attr('aria-selected', 'true'); 1578 1579 // Get the target tab pane ID from the data-bs-target attribute 1580 const targetPaneId = $tabToActivate.attr('data-bs-target'); 1581 1582 if (targetPaneId) { 1583 // Add active and show classes to the corresponding tab pane 1584 $(targetPaneId).addClass('active show'); 1585 } 1586 } 1587 1588 if (targetValue === 'liaison-brahms-pct') { 1589 $('#pills-2').trigger('click'); 1590 const url = new URL(window.location.href); 1591 url.hash = ''; 1592 url.search = '?liaison-brahms-pct='; 1593 window.history.pushState({}, '', url); 1594 } else if (targetValue === 'liaison-memed-bv') { 1595 $('#pills-1').trigger('click'); 1596 const url = new URL(window.location.href); 1597 url.hash = ''; 1598 url.search = '?liaison-memed-bv='; 1599 window.history.pushState({}, '', url); 1600 } 1601 } 1602 1603 // Gestione tab cliccando su loghi 1604 $('#braham-pct-path-image').on('click', function (e) { 1605 e.preventDefault(); 1606 const $targetTab = $('[data-target-title="liaison-brahms-pct"]'); 1607 // console.log('target tab', $targetTab); 1608 $targetTab.trigger('click'); 1609 // console.log('braham pct path image clicked'); 1610 const url = new URL(window.location.href); 1611 url.hash = ''; 1612 url.search = '?liaison-brahms-pct='; 1613 window.history.pushState({}, '', url); 1614 1615 // Add smooth scrolling 1616 if ($targetTab.length) { 1617 $('html, body').animate({ 1618 scrollTop: $targetTab.offset().top - 100 1619 }, 500); 1620 } 1621 }); 1622 $('#liaison-memed-bv-path-image').on('click', function (e) { 1623 e.preventDefault(); 1624 const $targetTab = $('[data-target-title="liaison-memed-bv"]'); 1625 $targetTab.trigger('click'); 1626 const url = new URL(window.location.href); 1627 url.hash = ''; 1628 url.search = '?liaison-memed-bv='; 1629 window.history.pushState({}, '', url); 1630 1631 // Add smooth scrolling 1632 if ($targetTab.length) { 1633 $('html, body').animate({ 1634 scrollTop: $targetTab.offset().top - 100 1635 }, 500); 1636 } 1637 }); 1638 1639 1640 } 1641 // MEMED VIRAL SCORE ON ACTIVE 1642 $(document).on('click', '#memed-viral-score-container .bin', function () { 1643 if (!$(this).hasClass('active')) { 1644 $('#memed-viral-score-container .bin').removeClass('active'); 1645 $(this).addClass('active'); 1646 } 1647 }); 1648 1649 1650 1651 }) 1652 // disable wrong active event menu item 1653 $(document).ready(function () { 1654 let eventMenuItem = $('.turn-off-main-navigation-highlight'); 1655 if (!($(eventMenuItem).hasClass('is-active') || $(eventMenuItem).hasClass('active'))) return; 1656 $('.diasorin-main-menu .menu-item--active-trail').removeClass('menu-item--active-trail'); 1657 }) 1658 1659 // Funzione per rimuovere la query dalla URL 1660 function removeQuery(url) { 1661 // Ottenere l'indice del carattere "?" 1662 var index = url.indexOf('?'); 1663 1664 // Se presente, restituire la parte della stringa prima del "?", altrimenti restituire la stringa originale 1665 return index !== -1 ? url.substring(0, index) : url; 1666 } 1667 1668 $(document).ready(function () { 1669 // Verifica se esiste un elemento con la classe "webform-submission-form" 1670 if ($('.webform-submission-form').length > 0) { 1671 1672 // Nascondi l'elemento con classe "interested-label" all'inizio 1673 $('.interested-label').css('display', 'none'); 1674 1675 // Funzione per controllare la visibilità di tutte le div "interested-control-field" 1676 var checkVisibility = function () { 1677 var visibleCount = 0; 1678 $('div.interested-control-field').each(function () { 1679 if ($(this).css('display') != 'none') { 1680 visibleCount++; 1681 } 1682 }); 1683 1684 // Se nessuna div è visibile, nascondi "interested-label" 1685 if (visibleCount === 0) { 1686 $('.interested-label').css('display', 'none'); 1687 } else { 1688 // Altrimenti, mostra "interested-label" 1689 $('.interested-label').css('display', 'block'); 1690 } 1691 }; 1692 1693 // Creazione di un observer per monitorare i cambiamenti nelle div 1694 var observer = new MutationObserver(function (mutations) { 1695 mutations.forEach(function (mutation) { 1696 checkVisibility(); 1697 }); 1698 }); 1699 1700 // Configurazione dell'observer: in questo caso, osserva i camb
1700iamenti di attributi e bambini 1701 var config = { attributes: true, childList: true, subtree: true }; 1702 1703 // Applica l'observer a tutte le div con classe "interested-control-field" 1704 $('div.interested-control-field').each(function () { 1705 observer.observe(this, config); 1706 }); 1707 1708 // Esegui il controllo iniziale 1709 checkVisibility(); 1710 } 1711 }); 1712 1713 // Filtri pagina Partner 1714 // Event delegation sul document perchè quando si clicca sul pagination, cambia id del form 1715 $(document).ready(function () { 1716 $(document).on('click', '.listing-partners .view-header .mobile-main-filter-collapse', function () { 1717 $('.listing-partners .view-header #block-diasorin-theme-exposed-filter-partners').slideToggle(); 1718 }); 1719 }); 1720 1721 Drupal.behaviors.fixAjaxLoader = { 1722 attach: function (context, settings) { 1723 $(document).ajaxComplete(function () { 1724 $('.ajax-progress-fullscreen').fadeOut(300); 1725 }); 1726 } 1727 }; 1728 1729 /** 1730 * Immuno devices product filters: click already-selected radio â select "All" 1731 * (toggle filter off). Works with BEF autosubmit via change/click on All. 1732 */ 1733 Drupal.behaviors.immunoDevicesProductFilterToggle = { 1734 attach: function (context) { 1735 once('immuno-devices-filter-toggle', 'body', context).forEach(function () { 1736 // On page load: click second radio in each filter group. 1737 $('.section-immuno-devices-product .view-filters .form-radios').each(function () { 1738 var $second = $(this).find('.js-form-type-radio:nth-child(2) input[type="radio"]').first(); 1739 if ($second.length && !$second.prop('checked')) { 1740 $second.prop('checked', true).trigger('change').trigger('click'); 1741 } 1742 }); 1743 1744 // Track which radio was checked BEFORE the click (mousedown fires first) 1745 $(document).on('mousedown', '.section-immuno-devices-product .view-filters .form-radios .js-form-type-radio', function () { 1746 if ($(window).width() < 992) { return; } 1747 var $radio = $(this).find('input[type="radio"]').first(); 1748 $(this).data('was-checked', $radio.prop('checked')); 1749 }); 1750 1751 $(document).on('click', '.section-immuno-devices-product .view-filters .form-radios .js-form-type-radio', function (e) { 1752 // On mobile the dropdown manages open/close â skip "click All" logic 1753 if ($(window).width() < 992) { 1754 return; 1755 } 1756 var $item = $(this); 1757 var $radio = $item.find('input[type="radio"]').first(); 1758 if (!$radio.length || $radio.val() === 'All') { 1759 return; 1760 } 1761 // Only trigger "All" if this radio was already checked before the click 1762 if (!$item.data('was-checked')) { 1763 return; 1764 } 1765 e.preventDefault(); 1766 e.stopPropagation(); 1767 var name = $radio.attr('name'); 1768 var $all = $item.closest('.form-radios').find('input[type="radio"][name="' + name + '"][value="All"]').first(); 1769 if ($all.length) { 1770 $all.prop('checked', true).trigger('change').trigger('click'); 1771 } 1772 }); 1773 }); 1774 } 1775 }; 1776 1777 // Al click sul open preview, va ad inserire il valore nel local storage 1778 $(document).ready(function () { 1779 $(document).on('click', '.white-papers-list-container #btn-download-wptn-file', function () { 1780 // $('#btn-download-wptn-file').on('click', function () { 1781 let fileUrl = $(this).attr('url-file'); 1782 localStorage.setItem('downloadUrl', fileUrl); 1783 }); 1784 1785 // $('.ui-dialog.ui-corner-all.ui-widget.ui-widget-content.ui-front.webform-confirmation-modal').on('dialogopen', function () { 1786 // // Trova il link all'interno del modale con l'id 'prova_campo' 1787 // var link = $(this).find('a').attr('href'); // Ottieni l'URL dal link nel div 1788 1789 // if (link) { 1790 // // Triggera il download del file 1791 // var downloadLink = $('<a>') 1792 // .attr('href', link) 1793 // .attr('download', '') // Opzionale, forza il download se il file è su un server 1794 // .appendTo('body'); 1795 1796 // // Simula il click sul link per avviare il download 1797 // downloadLink[0].click(); 1798 1799 // // Rimuovi il link invisibile dopo il download 1800 // downloadLink.remove(); 1801 // } 1802 // }); 1803 1804 }); 1805 1806 // Chiusura del form al click sulla x 1807 $(document).on('click', '.whitepapers-webform-modal [id^="edit-wptn-form-close-button"]', function () { 1808 $('.whitepapers-webform-modal').hide(); 1809 $('.ui-widget-overlay.ui-front').show(); 1810 $('.ui-dialog.single-video-popup.single-document-popup').show(); 1811 // $('html').css('overflow','scroll'); 1812 // $('html').css('padding-right','0'); 1813 // $('body').css('overflow','unset'); 1814 }) 1815 1816 // // Al click sul primo download now, nascondo l'attuale modal e apro quello con il form 1817 // $(document).on('click', '#download-now-first-modal', function (e) { 1818 // // e.preventDefault(); 1819 // 1820 // // Inserisco l'url del file nel val dell'input nascosto che poi andrà passato all'ultimo form tramite l'html completo di drupal 1821 // let savedUrl = localStorage.getItem('downloadUrl'); 1822 // if (savedUrl && !$('[id^="webform-submission-whitepaper-download"] input[data-drupal-selector="edit-download-url"]').val()) { 1823 // $('input[data-drupal-selector="edit-download-url"]').val(savedUrl); 1824 // } 1825 // 1826 // // Nascondo l'attuale modal 1827 // $('.ui-widget-overlay.ui-front').hide(); 1828 // $('.ui-dialog.single-video-popup.single-document-popup').hide(); 1829 // 1830 // // Mostro il modale con il form 1831 // $('.whitepapers-webform-modal').css('display','block'); 1832 // }); 1833 1834 // Click al pulsante del primo download now, mostra il form 1835 $(document).on('click', '#download-now-first-modal', function (e) { 1836 e.preventDefault(); 1837 1838 $('.wptn-pdf-modal .view-header .wptn-modal-pdf-title').css('display', 'none'); 1839 $('.wptn-pdf-modal .view-content.row .views-field.views-field-wptn-file').css('display', 'none'); 1840 $('.wptn-pdf-modal .view-footer').css('display', 'none'); 1841 1842 $('.wptn-pdf-modal .wptn-second-modal-pdf-header').css('display', 'block'); 1843 $('.wptn-pdf-modal .view-content.row .views-field.views-field-nothing-1').css('display', 'block'); 1844 $('.ui-dialog.single-video-popup.single-document-popup').addClass('diasorin-hubspot-form'); 1845 1846 1847 }); 1848 1849 // Alla submit dell'hubspot form nel modale whitepapers, mostra l'ultimo messaggio di ringraziamento e download 1850 $(document).on('submit', '#hubspot-form-container form', function (event) { 1851 $('#hubspot-form-container form').css('visibility', 'hidden'); 1852 1853 // Timeout per evitare glitch grafico 1854 setTimeout(function () { 1855 // Se la submit è andata bene 1856 if ($('#hubspot-form-container .hs-error-msgs:visible').length === 0) { 1857 $('#hubspot-form-container form').css('display', 'none'); 1858 $('.ui-dialog.single-video-popup.single-document-popup').addClass('diasorin-hubspot-confirmation'); 1859 $('.wptn-pdf-modal .wptn-second-modal-pdf-header').css('display', 'none'); 1860 // let savedUrl = localStorage.getItem('downloadUrl'); 1861 // window.location.href = savedUrl; 1862 1863 // var link = localStorage.getItem('downloadUrl'); 1864 1865 // if (link) {
1866 // // Triggera il download del file 1867 // var downloadLink = $('<a>') 1868 // .attr('href', link) 1869 // .attr('download', '') // Opzionale, forza il download se il file è su un server 1870 // .appendTo('body'); 1871 1872 // // Simula il click sul link per avviare il download 1873 // downloadLink[0].click(); 1874 1875 // // Rimuovi il link invisibile dopo il download 1876 // downloadLink.remove(); 1877 // } 1878 1879 } else { 1880 // Se la submit non è andata bene 1881 $('#hubspot-form-container form').css('visibility', 'visible'); 1882 } 1883 }, 500); 1884 1885 }); 1886 1887 1888 // Funzioni per caricare l'hubspot form 1889 $(document).ready(function () { 1890 // Seleziona solo gli script all'interno della div con la classe .hubspot-form 1891 var scriptContent = $(".hubspot-form").html(); 1892 1893 // Verifico se ci sono script da eseguire 1894 if (scriptContent) { 1895 // Creo un nuovo elemento <script> e inserisci il contenuto al suo interno 1896 var scriptElement = $("<script></script>").html(scriptContent); 1897 1898 // Aggiungo lo script all'interno della stessa div .hubspot-form 1899 $(".hubspot-form").append(scriptElement); 1900 } 1901 }); 1902 1903 // Funzione per caricare il form di Hubspot 1904 Drupal.behaviors.hubspotFormLoader = { 1905 attach: function (context, settings) { 1906 // Verifico che drupalSettings.hubspot_form sia disponibile, altrimenti mi causa un errore al caricamento della pagina 1907 var hubspotSettings = drupalSettings.hubspot_form || {}; 1908 var portalId = hubspotSettings.portalId; 1909 var formId = hubspotSettings.formId; 1910 1911 if (!portalId || !formId) { 1912 // console.log("HubSpot: portalId o formId non trovati, attendo..."); 1913 return; // Non procedere se non ci sono dati 1914 } 1915 1916 // Attendi che hbspt sia disponibile prima di inizializzare il form 1917 var checkHubspotLoaded = setInterval(function () { 1918 if (typeof hbspt !== "undefined") { 1919 // console.log("HubSpot disponibile, inizializzo il form..."); 1920 clearInterval(checkHubspotLoaded); 1921 1922 hbspt.forms.create({ 1923 portalId: portalId, 1924 formId: formId, 1925 target: "#hubspot-form-container" 1926 }); 1927 } 1928 }, 500); 1929 } 1930 }; 1931 1932 /* Custom script for protected pages btn style */ 1933 $(document).ready(function () { 1934 if ($('.protected-pages-enter-password').length) { 1935 // Get the input element and its value 1936 var $input = $('.protected-pages-enter-password #edit-protected-page-enter-password #edit-submit'); 1937 var inputValue = $input.val(); 1938 1939 // Create the new HTML structure 1940 var newHtml = '<div class="protected-pages-submit-btn btn full-btn">' + 1941 '<input data-drupal-selector="edit-submit" type="submit" id="edit-submit" name="op"></input>' + 1942 '<span>' + inputValue + '</span>' + 1943 '<i class="icon-diasorin-arrow"></i>' + 1944 '</div>'; 1945 1946 // Replace the input with the new HTML 1947 $input.replaceWith(newHtml); 1948 } 1949 }); 1950 if ($('body').hasClass('bacterialviral')) { 1951 $(document).on('click', '[data-target-title="liaison-brahms-pct"], [data-target-title="liaison-memed-bv"]', function () { 1952 var $slider = $('.slider'); 1953 1954 if ($slider.hasClass('slick-initialized')) { 1955 $slider.slick('unslick'); 1956 } 1957 1958 $slider.slick({ 1959 dots: true, 1960 infinite: true, 1961 speed: 300, 1962 slidesToScroll: 1, 1963 }); 1964 }); 1965 } 1966 $(document).ready(function () { 1967 if ($('body').hasClass('bacterialviral')) { 1968 if (window.innerWidth <= 991.98) { 1969 $('.slider-mobile').slick({ 1970 dots: true, 1971 slidesToScroll: 1, 1972 slidesToShow: 1, 1973 touchThreshold: 100, 1974 draggable: true, 1975 focusOnSelect: true, 1976 // variableWidth: true, 1977 1978 }); 1979 } 1980 } 1981 }); 1982 1983 if ($('.single-blog-post').length && window.innerWidth >= 1441) { 1984 function setFixedWidth() { 1985 var $sidebar = $('.single-blog-header-right'); 1986 var $scrollableContainer = $('.scrollable-container'); 1987 1988 if ($sidebar.length && $scrollableContainer.length) { 1989 var sidebarOffset = $sidebar.offset(); 1990 var sidebarWidth = $sidebar.outerWidth(); 1991 var sidebarPadding = parseInt($sidebar.css('padding-left')) + parseInt($sidebar.css('padding-right')); 1992 var sidebarInnerWidth = sidebarWidth - sidebarPadding; 1993 1994 $scrollableContainer.css({ 1995 width: sidebarInnerWidth + 'px', 1996 left: (sidebarOffset.left + parseInt($sidebar.css('padding-left'))) + 'px' 1997 }); 1998 } 1999 } 2000 2001 // Call on load and resize 2002 $(window).on('load resize', setFixedWidth); 2003 2004 // On scroll 2005 $(window).on('scroll', function () { 2006 var currentScrollTop = $(this).scrollTop();
2007 var viewportHeight = $(window).height(); 2008 var viewportBottom = currentScrollTop + viewportHeight; 2009 2010 var $sidebar = $('.single-blog-header-right'); 2011 var $scrollableContainer = $('.scrollable-container'); 2012 2013 var sidebarBottom = $sidebar.offset().top + $sidebar.outerHeight(); 2014 var scrollableContainerBottom = $scrollableContainer.offset().top + $scrollableContainer.outerHeight(); 2015 var sidebarTop = $sidebar.offset().top; 2016 var scrollableContainerTop = $scrollableContainer.offset().top; 2017 2018 // Track scroll direction 2019 var scrollUp = currentScrollTop < (window.lastScrollTop || 0); 2020 window.lastScrollTop = currentScrollTop; 2021 2022 // Add sidebar-scrollup class when scrolling up until scrollable-container reaches the top of single-blog-header-right 2023 if (scrollUp && scrollableContainerTop > sidebarTop && !$scrollableContainer.hasClass('sidebar-scrollup')) { 2024 $scrollableContainer.addClass('sidebar-scrollup'); 2025 } else if (!scrollUp || scrollableContainerTop <= sidebarTop) { 2026 $scrollableContainer.removeClass('sidebar-scrollup'); 2027 } 2028 2029 // Add sidebar-bottom class when scrollable-container reaches the bottom of single-blog-header-right 2030 if (scrollableContainerBottom >= sidebarBottom && !$scrollableContainer.hasClass('sidebar-bottom')) { 2031 $scrollableContainer.addClass('sidebar-bottom'); 2032 } 2033 2034 // Remove sidebar-bottom class when scrolling up and the entire scrollable-container is visible in the viewport with 130px offset 2035 if (scrollUp && (scrollableContainerTop - 270) >= currentScrollTop && scrollableContainerBottom <= viewportBottom && $scrollableContainer.hasClass('sidebar-bottom')) { 2036 $scrollableContainer.removeClass('sidebar-bottom'); 2037 } 2038 }); 2039 2040 // Initial check 2041 $(window).trigger('scroll'); 2042 } 2043 2044 2045 $(document).ready(function () { 2046 // jQuery to execute on pages with body class "bacterialviral" 2047 if ($('body').hasClass('bacterialviral')) { 2048 $(".diasorin-mmenu-container .diasorin-mm-main-menu ul > .menu-item--expanded .menu-dropdown-0 .menu > .menu-item a:not(.diasorin-mmenu-back)").on("click", function () { 2049 $(".diasorin-mmenu-button").trigger("click"); 2050 }); 2051 } 2052 2053 // jQuery to add body class "bacterialviral" to webform confirmation page 2054 if ($('.bacterialviral-confirmation').length > 0) { 2055 $('body').addClass('bacterialviral'); 2056 } 2057 2058 // jQuery to show more content of the html table when the button is clicked 2059 $(document).on('click', '.html-table-wrapper .btn-html-closer', function () { 2060 $(this).closest('.html-table-wrapper').removeClass('html-table-closed'); 2061 }); 2062 2063 // jQuery to replace ® symbol with <sup>®</sup> in breadcrumb items whenever it occurs 2064 $('.breadcrumb .breadcrumb-item').each(function () { 2065 var $item = $(this); 2066 var text = $item.html(); 2067 if (text && text.indexOf('®') !== -1) { 2068 text = text.replace(/®(?!<\/sup>)/g, '<sup>®</sup>'); 2069 $item.html(text); 2070 } 2071 }); 2072 2073 // Check if the .our-blog-cards-container element exists in the DOM 2074 if ($('.our-blog-cards-container').length > 0) { 2075 $('.our-blog-cards-container .bef-links li a').each(function () { 2076 var $this = $(this); 2077 var html = $this.html(); 2078 if (html && html.indexOf('®') !== -1) { 2079 // Replace all occurrences of plain ® with <sup>®</sup>, avoiding already superscripted 2080 html = html.replace(/®(?!<\/sup>)/g, '<sup>®</sup>'); 2081 $this.html(html); 2082 } 2083 }); 2084 } 2085 2086 // Accordion open via anchor in URL, only if accordion-item exists in the page 2087 if ($('.accordion-item').length > 0) { 2088 var urlHash = window.location.hash; 2089 if (urlHash) { 2090 // If the product-domain disclaimer popup exists, append the current hash 2091 // to its domain-switch links (preserving protocol/host/path/query). 2092 var $domainDisclaimer = $('.diasorin-product-domain-disclaimer'); 2093 if ($domainDisclaimer.length > 0) { 2094 $domainDisclaimer.find('li.list-group-item a[href]').each(function () { 2095 var $link = $(this); 2096 var href = $link.attr('href'); 2097 if (!href) { 2098 return; 2099 } 2100 2101 try { 2102 var parsedUrl = new URL(href, window.location.origin); 2103 parsedUrl.hash = urlHash; 2104 $link.attr('href', parsedUrl.toString()); 2105 } catch (e) { 2106 // Fallback for unexpected/invalid URLs. 2107 $link.attr('href', href.split('#')[0] + urlHash); 2108 } 2109 }); 2110 } 2111 2112 // Remove leading '#' and decode in case of URL encoding 2113 var anchorId = decodeURIComponent(urlHash.substring(1)); 2114 // Find accordion item that matches this heading id 2115 var $accordionItem = $('.accordion-item[data-heading-id="' + anchorId + '"]'); 2116 if ($accordionItem.length > 0) { 2117 // Find the collapse element within this accordion 2118 var $collapse = $accordionItem.find('.accordion-collapse'); 2119 if ($collapse.length > 0 && !$collapse.hasClass('show')) { 2120 // Add "show" class to expand it and set button aria-expanded to true 2121 $collapse.addClass('show'); 2122 $accordionItem.find('.accordion-header .accordion-heading').attr('aria-expanded', 'true'); 2123 } 2124 // Scroll to the opened accordion for user 2125 var accordionTop = $accordionItem.offset().top; 2126 $('html, body').animate({ 2127 // Offset for sticky header height (112px) 2128 scrollTop: Math.max(0, accordionTop - 112) 2129 }); 2130 } 2131 } 2132 } 2133 2134 2135 if (window.innerWidth < 992) { 2136 $('.feature-highlight-wrapper .tab-content').slick({ 2137 centerMode: true, 2138 slidesToShow: 1, 2139 slidesToScroll: 1, 2140 dots: true,
2141 arrows: false, 2142 infinite: false, 2143 variableWidth: true, 2144 focusOnSelect: true, 2145 centerPadding: '40px' 2146 }); 2147 2148 // Wrap .nes-section-handson .row .col-sm-4 elements inside .nes-section-handson-slider on mobile 2149 if ($('.nes-section-handson .row .col-sm-4').length > 0) { 2150 var $handsonRow = $('.nes-section-handson .row'); 2151 // Check if .nes-section-handson-slider already exists to avoid multiple wrapping 2152 if ($handsonRow.find('.nes-section-handson-slider').length === 0) { 2153 var $cols = $handsonRow.find('.col-sm-4'); 2154 // Detach all the .col-sm-4 divs 2155 var $detachedCols = $cols.detach(); 2156 // Create the wrapper div 2157 var $sliderDiv = $('<div class="nes-section-handson-slider"></div>'); 2158 // Append the col-sm-4 divs to it 2159 $sliderDiv.append($detachedCols); 2160 // Find .region--top within the row 2161 var $regionTop = $handsonRow.find('.region--top').first(); 2162 if ($regionTop.length > 0) { 2163 // Insert the slider after .region--top 2164 $regionTop.after($sliderDiv); 2165 } else { 2166 // Fallback: append to row if region--top is not found 2167 $handsonRow.append($sliderDiv); 2168 } 2169 } 2170 } 2171 if ($('.nes-section-handson-slider').length > 0) { 2172 $('.nes-section-handson-slider').slick({ 2173 centerMode: true, 2174 slidesToShow: 1, 2175 slidesToScroll: 1, 2176 dots: false, 2177 arrows: false, 2178 infinite: false, 2179 variableWidth: true, 2180 focusOnSelect: true, 2181 centerPadding: '40px' 2182 }); 2183 } 2184 } 2185 2186 if ($('#edit-privacy-statement--description').length > 0) { 2187 var htmlLang = $('html').attr('lang'); 2188 if (htmlLang === 'it') { 2189 $('#edit-privacy-statement--description').html( 2190 '<a href="/it/diasorin-global-privacy-policy" target="_blank">Informativa sulla privacy</a>*<br>' + 2191 'Il sottoscritto conferma che lâinformativa fornita ai sensi del D.lgs. 196/2003 è stata letta e accettata.' 2192 ); 2193 } else { 2194 var privacyHref = '/diasorin-global-privacy-policy'; // default 2195 if (htmlLang === 'en') { 2196 privacyHref = '/en/diasorin-global-privacy-policy'; 2197 } else if (htmlLang === 'zh-hans') { 2198 privacyHref = '/zh/diasorin-global-privacy-policy'; 2199 } else if (htmlLang === 'ja') { 2200 privacyHref = '/jp/diasorin-global-privacy-policy'; 2201 } 2202 $('#edit-privacy-statement--description').html( 2203 '<a href="' + privacyHref + '" target="_blank">Privacy Statement</a>*<br>' + 2204 'The Undersigned Confirms That The Information. Provided Pursuant To Leg. Decree No. 196/2003 Has Been Read And Accepted.' 2205 ); 2206 } 2207 } 2208 2209 }); 2210 2211 // Check for "diasorin-global-search-results" in the DOM 2212 if ($('.diasorin-global-search-results').length > 0) { 2213 // Check if a div with class "view-empty" is visible 2214 console.log('view-empty:visible'); 2215 if ($('.diasorin-global-search-results .view-empty:visible').length > 0) { 2216 console.log('gs-results-none'); 2217 $('body').addClass('gs-results-none'); 2218 } 2219 } 2220 2221 $(document).ready(function () { 2222 // Listen for the Bootstrap collapse events 2223 $('#scamAlertContent').on('show.bs.collapse', function () { 2224 // Finds the parent card and adds the class when expanding 2225 $(this).closest('.scam-alert-card').addClass('card-expanded'); 2226 }).on('hide.bs.collapse', function () { 2227 // Finds the parent card and removes the class when collapsing 2228 $(this).closest('.scam-alert-card').removeClass('card-expanded'); 2229 }); 2230 }); 2231 2232 Drupal.behaviors.textTooltipPosition = { 2233 attach: function (context) { 2234 once('text-tooltip-position-inner', '.simple-text.has-title-tooltip', context).forEach(function (el) { 2235 var $wrapper = $(el); 2236 var $tooltip = $wrapper.children('.card-title-tooltip'); 2237 var $lastTextBlock = $wrapper.children('p, h1, h2, h3, h4, h5, h6').last(); 2238 2239 if ($tooltip.length && $lastTextBlock.length) { 2240 $lastTextBlock.find('> br:last-child').remove(); 2241 $lastTextBlock.append($tooltip); 2242 } 2243 }); 2244 } 2245 }; 2246 2247})(jQuery, Drupal, drupalSettings);
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.