1/** 2 * @file 3 * Hologic theme scripts. 4 */ 5 6var Hologic = Hologic || {}; 7 8/** 9 * Scrolls the document to the said position. 10 * 11 * @param options 12 * Object specifying various options. 13 * 14 * "x" position 15 * "y" position 16 */ 17Hologic.scrollTo = function(options) { 18 // Compute vertical and horizontal adjustments, if any. 19 // Example: Fixed elements, etc. 20 var xFix = 0; 21 var yFix = 0 22 - 15 // To ensure some gap between the top and the element. 23 - jQuery('#navbar').height() 24 - jQuery('#toolbar-bar').height(); 25 // Determine final x and y offsets. 26 var x = parseInt(options.x) + xFix; 27 var y = parseInt(options.y) + yFix; 28 // Perform the scroll. 29 window.scrollTo(x, y); 30}; 31 32/** 33 * Mobile menu behaviour fallback for old Browsers. 34 */ 35function openNav() { 36 document.getElementById("pageCanvas").classList.add("navbar-opened"); 37} 38 39function closeNav() { 40 document.getElementById("pageCanvas").classList.remove("navbar-opened", "navbar-subnav-opened"); 41} 42 43function backToTopLevel() { 44 document.getElementById("pageCanvas").classList.remove("navbar-subnav-opened"); 45} 46 47function toggleOverlay(status1, status2){ 48 if (status1 || status2) { 49 document.getElementById("overlay-mobile").classList.add("full-overlay"); 50 } else { 51 document.getElementById("overlay-mobile").classList.remove("full-overlay"); 52 } 53} 54 55(function ($, Drupal, drupalSettings, once) { 56 57 'use strict'; 58 59 /** 60 * Somehow Bootstrap dropdowns stopped working. Here is a workaround: 61 * https://stackoverflow.com/questions/22383547/bootstrap-dropdown-menu-is-not-working 62 */ 63 $(document).ready(function() { 64 $(".dropdown-toggle").dropdown().on('click', function() { 65 $(this).parent().addClass('open'); 66 document.getElementById("pageCanvas").classList.add("navbar-subnav-opened"); 67 }) 68 }); 69 70 /** 71 * Mobile Dropdown items are exandable and clickable one expanded 72 */ 73 $('.dropdown a.dropdown-toggle').on('click', function(e) { 74 if($(this).parent().hasClass('open')) { 75 location.assign($(this).attr('href')); 76 } 77 }); 78 79 /** 80 * Hide secured resourcs if user is not connected 81 */ 82 if ($(".secured-title").length) { 83 $(".secured-title").closest(".secured-resources").find("h3").addClass("hidden"); 84 $(".secured-title").next().addClass("hidden"); 85 } 86 87 /** 88 * Apply img as a background image for featured post in blog page 89 */ 90 function featuredPostBgImg() { 91 $(".has-bg-img").each(function () { 92 var imgSrc = $(this).find("img.bg").attr("src"); 93 $(this).attr("style", "background-image: url(" + imgSrc + ")"); 94 $(this).find("img.bg").hide(); 95 }) 96 } 97 98 /** 99 * Create a custom dropdown according select options 100 */ 101 function selectToDropdown() { 102 if ($('.path-package-inserts').length) { 103 var select = $('.select-wrapper select'); 104 select.each(function() { 105 106 // Create the dropdown 107 $(this).closest('.select-wrapper').append('<div class="custom-select-wrapper"><span class="select-value"></span><ul class="custom-select"></ul></div>'); 108 var options = $(this).find("option"); 109 var selectedOptions = $(this).find("option:selected").text(); 110 111 if (selectedOptions == "") { 112 selectedOptions = $(this).find("option").first().text(); 113 } 114 115 options.each(function() { 116 var li = $(this).text(); 117 var liValue = $(this).val(); 118 $(this).closest('.select-wrapper').find('.select-value').text(selectedOptions); 119 $(this).closest('.select-wrapper').find('ul').append('<li value='+ liValue +'>'+ li +'</li>'); 120 }) 121 }) 122 123 displayCustomDropdown(); 124 slideUpCustomSelect(); 125 } 126 } 127 128 /** 129 * Display the custom dropdown menu 130 */ 131 function displayCustomDropdown() { 132 var customSelect = $('.select-value'); 133 customSelect.each(function () { 134 $(this).on('click', function () { 135 136 $(this).closest('.form--inline').find('.form-item').each(function() { 137 $(this).find('.custom-select').stop().slideUp().removeClass('expanded'); 138 }); 139 140 var ul = $(this).next('ul'); 141 ul.stop().slideToggle().toggleClass('expanded'); 142 $('body').toggleClass('display-select'); 143 144 ul.find('li').on('click', function () { 145 ul.stop().slideUp().removeClass('expanded'); 146 var liText = $(this).text(); 147 var valLi = $(this).attr('value'); 148 var selectOptions = $(this).closest('.select-wrapper').find('select option'); 149 selectOptions.removeAttr('selected'); 150 $(this).closest('.custom-select-wrapper').find('.select-value').text(liText); 151 152 selectOptions.each(function () { 153 if ($(this).val() == valLi) { 154 $(this).attr('selected', 'selected') 155 } 156 }) 157 158 // Set new url according to division 159 var fullUrl = location.href; 160 var urlWithParam = getTextAfterCarac(fullUrl, '?'); 161 var urlWithCombine = ""; 162 163 if (urlWithParam != undefined) { 164 if (urlWithParam.indexOf("portfolio") !== -1) { 165 if (urlWithParam.indexOf("combine") !== -1) { 166 urlWithCombine = getTextAfterCarac(urlWithParam, '&'); 167 } 168 } else if (urlWithParam.indexOf("combine") !== -1) { 169 urlWithCombine = urlWithParam; 170 } 171 } 172
173 if ($(this).closest(".js-form-item").hasClass("js-form-item-division")) { 174 if (valLi == "All") { 175 location.href = "/package-inserts/"; 176 } else { 177 location.href = "/package-inserts/" + valLi; 178 } 179 } else { 180 var url = location.pathname; 181 if (valLi == "All") { 182 location.href = url; 183 } else { 184 if (urlWithParam != undefined) { 185 if (urlWithCombine != "") { 186 location.href = url + "?portfolio=" + valLi + "&" + urlWithCombine; 187 } else { 188 location.href = url + "?portfolio=" + valLi; 189 } 190 } 191 else { 192 location.href = url + "?portfolio=" + valLi 193 } 194 } 195 } 196 }) 197 }) 198 }) 199 } 200 201 function customPackageInsertSearchForm() { 202 var search = $(".js-form-item-combine"); 203 204 if(search.length) { 205 var form = search.closest("form"); 206 var btnSubmit = search.find(".js-form-submit"); 207 208 form.on('submit', function(e) { 209 e.preventDefault(); 210 var val = search.find("input").val(); 211 var url = location.pathname; 212 var fullUrl = location.href; 213 var urlParam = getTextAfterCarac(fullUrl, '?'); 214 if (urlParam != undefined) { 215 urlParam = urlParam.indexOf("combine") >= 0 ? getTextBeforeCarac(urlParam, '&') : urlParam; 216 } 217 if (val.length >Â 0) { 218 if (urlParam != undefined) { 219 location.href = url + "?" + urlParam + "&combine=" + val; 220 } else { 221 location.href = url + "?combine=" + val; 222 } 223 } else { 224 if (urlParam != undefined) { 225 location.href = url + "?" + urlParam; 226 } else { 227 location.href = url; 228 } 229 } 230 }) 231 } 232 } 233 234 /** 235 /* Select division according to pathname 236 */ 237 function selectOptionAccordingUrl() { 238 239 var url = window.location.pathname; 240 var lastSegment = url.substr(url.lastIndexOf("/") + 1); 241 var selectDivsion = $('.js-form-item-division'); 242 243 if (selectDivsion.length) { 244 245 var select = selectDivsion.find('select'); 246 var customSelect = selectDivsion.find('.select-value'); 247 var selectOptions = select.find('option'); 248 selectOptions.removeAttr('selected'); 249 250 selectOptions.each(function () { 251 252 if (lastSegment == $(this).val()) { 253 $(this).attr('selected', 'selected'); 254 var selectText = $(this).text(); 255 customSelect.text(selectText); 256 } 257 }) 258 } 259 } 260 261 /** 262 * Slide up custom select 263 */ 264 function slideUpCustomSelect() { 265 266 $('.form-type-textfield').on('click', function(event) { 267 event.stopPropagation(); 268 $(this).closest('.form--inline').find('.form-item').each(function () { 269 $(this).find('.custom-select').stop().slideUp().removeClass('expanded'); 270 }); 271 }) 272 273 // Slide up custom select if clicked outside the select container 274 $('body').on('click', function(e) { 275 var target = $(e.target); 276 if (!target.is('.select-value')) { 277 $('.custom-select').stop().slideUp().removeClass('expanded'); 278 } 279 }) 280 } 281 282 /** 283 * Add background image to main slider 284 */ 285 function sliderImg() { 286 var slideShow = $('#block-views-block-node-partials-block-home-slideshow'); 287 var slideShowProductPage = $('.views_slideshow_cycle_main'); 288 var slider = ""; 289 slider = slideShow.length ? $('#block-views-block-node-partials-block-home-slideshow') : $('.views_slideshow_cycle_main'); 290 291 if (slider.length) { 292 if (!$("body").hasClass("page-node-type-product")) { 293 294 slider.find('.views_slideshow_cycle_slide').each(function() { 295 296 var backgroundImg = $(this).find('.views-row'); 297 var imgBig = $(this).find('picture source').first().attr('srcset'); 298 var imgTablet = $(this).find('picture source:nth-child(2)').attr('srcset'); 299 var imgMobile = $(this).find('picture source').last().attr('srcset'); 300 301 imgBig = getTextBeforeCarac(imgBig, '?'); 302 imgTablet = getTextBeforeCarac(imgTablet, '?'); 303 imgMobile = getTextBeforeCarac(imgMobile, '?'); 304 305 if($(window).width() > 991) { 306 backgroundImg.attr('style', 'background-image: url('+imgBig+')'); 307 } else if ($(window).width() > 420 && $(window).width() < 992) { 308 backgroundImg.attr('style', 'background-image: url(' + imgTablet + ')'); 309 } else { 310 backgroundImg.attr('style', 'background-image: url(' + imgMobile + ')'); 311 } 312 }) 313 } 314 } 315 } 316 317 function productHeaderImg() { 318 var productHeader = $('.header-products'); 319 var trigger = false;
320 if (productHeader.length) { 321 322 var imgBig = productHeader.find('picture source').first().attr('srcset'); 323 var imgTablet = productHeader.find('picture source:nth-child(2)').attr('srcset'); 324 var imgMobile = productHeader.find('picture source').last().attr('srcset'); 325 326 imgBig = getTextBeforeCarac(imgBig, '?'); 327 imgTablet = getTextBeforeCarac(imgTablet, '?'); 328 imgMobile = getTextBeforeCarac(imgMobile, '?'); 329 330 if ($(window).width() > 991) { 331 productHeader.attr('style', 'background-image: url(' + imgBig + ')'); 332 } else if ($(window).width() > 420 && $(window).width() < 992) { 333 productHeader.attr('style', 'background-image: url(' + imgTablet + ')'); 334 } else { 335 productHeader.attr('style', 'background-image: url(' + imgMobile + ')'); 336 } 337 } 338 } 339 340 function productBannerVideo() { 341 if ($('.page-node-type-product').length) { 342 343 if ($('.youtube-container').length) { 344 345 $('.youtube-container').closest(".view--slideshow").addClass("has-banner-video"); 346 347 var bannerVideo = $('.views-field-field-product-banner-video-image'); 348 349 if (bannerVideo.find('picture source').length) { 350 351 var imgBig = bannerVideo.find('picture source').first().attr('srcset'); 352 var imgTablet = bannerVideo.find('picture source:nth-child(2)').attr('srcset'); 353 var imgMobile = bannerVideo.find('picture source').last().attr('srcset'); 354 355 imgBig = getTextBeforeCarac(imgBig, '?'); 356 imgTablet = getTextBeforeCarac(imgTablet, '?'); 357 imgMobile = getTextBeforeCarac(imgMobile, '?'); 358 359 if ($(window).width() > 991) { 360 bannerVideo.closest('.views-row').attr('style', 'background-image: url(' + imgBig + ')'); 361 } else if ($(window).width() > 420 && $(window).width() < 992) { 362 bannerVideo.closest('.views-row').attr('style', 'background-image: url(' + imgTablet + ')'); 363 } else { 364 bannerVideo.closest('.views-row').attr('style', 'background-image: url(' + imgMobile + ')'); 365 } 366 } else { 367 $('.youtube-container').show(); 368 $('.field-slide-description').hide(); 369 } 370 } 371 } 372 } 373 374 375 /** 376 * Get text before specific caracter 377 */ 378 function getTextBeforeCarac(string, carac) { 379 if(string == undefined){ 380 return string; 381 }else{ 382 return string.substr(0, string.indexOf(carac)); 383 } 384 } 385 386 /** 387 * Get text after specific caracter 388 */ 389 function getTextAfterCarac(string, carac) { 390 return string.split(carac)[1]; 391 } 392 393 /** 394 * Package insert tabs 395 */ 396 function packageInsertTab() { 397 var packageInsertPage = $('.page-node-type-package-insert'); 398 399 if (packageInsertPage.length) { 400 var tabLink = packageInsertPage.find('article .nav-tabs a'); 401 402 403 tabLink.on('click', function () { 404 $(this).closest('.nav-tabs').find('a').removeClass('active'); 405 $(this).addClass('active'); 406 407 hidePackageInsertContent($(this)); 408 409 return false; 410 }) 411 } 412 } 413 414 /** 415 * Remove active class added I don't know from where ! 416 */ 417 function fixMysteriousClassOnTab() { 418 var packageInsertPage = $('.page-node-type-package-insert'); 419 420 if (packageInsertPage.length) { 421 var tabLink = packageInsertPage.find('article .nav-tabs a'); 422 tabLink.removeClass('active') 423 tabLink.first().addClass('active'); 424 425 hidePackageInsertContent(tabLink.first()); 426 } 427 } 428 429/** 430 * Remove duplicate title on single package insert 431 */ 432 function removeDuplicateTitle() { 433 var packageInsertPage = $('.page-node-type-package-insert'); 434 435 if (packageInsertPage.length) { 436 packageInsertPage.find("article.package-insert > h2").remove(); 437 } 438 } 439 440 /** 441 * Display the package Insert content according the tab 442 */ 443 function hidePackageInsertContent(tab) { 444 if (tab.hasClass('active') && tab.text().toLowerCase() == 'usa') { 445 $('.paragraph--type--package-insert-us').show(); 446 $('.paragraph--type--package-insert-worldwide').hide(); 447 } else { 448 $('.paragraph--type--package-insert-us').hide(); 449 $('.paragraph--type--package-insert-worldwide').show(); 450 } 451 } 452 453 /** 454 * Change slide according nav tab clicked 455 */ 456 function produtTabClick() { 457 var tabActivate = $('.field--name-field-want-slider-on-tab-click'); 458 var slideShow = $('.views_slideshow_cycle_main'); 459 var slide = slideShow.find('.views_slideshow_cycle_slide'); 460 var slideWidth = slide.attr('') 461 462 if (tabActivate.length) { 463 if (tabActivate.find('.field--item').text() == 'yes') { 464 var tabs = $('.main-container .nav-tabs li'); 465 tabs.each(function() { 466 $(this).on('click', function () { 467 468 var index = $(this).index(); 469 470 slide.each(function() { 471 var slideIndex = $(this).index(); 472 473 if(index == slideIndex) { 474 slide.addClass('views_slideshow_cycle_hidden').css('z-index', '3'); 475 $(this).show().removeClass('views_slideshow_cycle_hidden').css('z-index', '4'); 476 477 slide.not($(this)).animate({ 478 opacity: '0' 479 }, 700); 480 481 $(this).animate({ 482 opacity: '1' 483 }, 700); 484 } 485 }) 486 }) 487 }) 488 } 489 } 490 } 491 492 /**
493 * Add the anchor to url on single product page 494 */ 495 function addHashToUrl() { 496 if ($(".page-node-type-product").length) { 497 $(".nav-tabs a").on("click", function () { 498 window.location.hash = $(this).attr("href"); 499 500 // Add smoothscroll when clicking on a tab 501 if ($(".field--name-field-tabs .tab-content").length) { 502 $("html, body").animate({ 503 scrollTop: $(".field--name-field-tabs .tab-content").offset().top - $("#navbar").outerHeight(true) 504 }, 400); 505 } 506 }) 507 508 } 509 } 510 511 /** 512 * Display the right panel according the hash url on single product page 513 */ 514 function displayTabAccordingHash() { 515 if ($(".page-node-type-product").length) { 516 var hashUrl = window.location.hash; 517 var cleanHashUrl = hashUrl.replace("#", ""); 518 var tabPanel = $(".tab-content .tab-pane"); 519 var tabLinks = $(".nav-tabs a"); 520 521 if (hashUrl != "") { 522 tabLinks.on("click", function() { 523 tabLinks.removeClass("active") 524 }) 525 526 tabLinks.closest("li").removeClass("active"); 527 tabLinks.each(function() { 528 if ($(this).attr("href") == hashUrl) { 529 $(this).closest("li").addClass("active"); 530 } 531 }) 532 533 tabPanel.removeClass("in active"); 534 tabPanel.each(function() { 535 if ($(this).attr("id") == cleanHashUrl) { 536 $(this).addClass("in active"); 537 } 538 }) 539 } 540 } 541 } 542 543 function clearField() { 544 var input = $(".path-hologic-products, .page-node-type-product-division").find(".form-autocomplete"); 545 if(input.length) { 546 input.closest(".js-form-item").append("<span class='clear-form'></span>"); 547 548 $(document).on("click", ".clear-form", function () { 549 var $input = $(this).closest(".js-form-item").find("input"); 550 $input.val(""); 551 }) 552 } 553 } 554 555 // - - - Add hidden class to empty table on package insert page - - - 556 function packageInsertTitleTableFix() { 557 var packageInsertTable = $(".pi-table"); 558 559 if (packageInsertTable.length) { 560 561 packageInsertTable.each(function() { 562 var row = $(this).find("tr:nth-child(2)"); 563 if (!row.has("td").length) { 564 $(this).addClass("hidden"); 565 } 566 }) 567 } 568 } 569 570 // - - - Hide empty div on career page to fix the layout - - - 571 function hideEmptyDivOnCareerPage() { 572 if ($("body").hasClass("page-node-3")) { 573 var $fields = $(".page_layout_3_column_grid .views-field"); 574 575 $fields.each(function() { 576 if ($(this).is("[class*=views-field-nothing-]")) { 577 $(this).remove(); 578 } 579 }) 580 } 581 } 582 583 // - - - Add a smooth scroll to jump to the next section on homepage - - - 584 function smoothScroll() { 585 $(".btn-to-scroll-down a").on("click", function () { 586 var $page = $(this).attr("href"); 587 $("html, body").animate({ 588 scrollTop: $($page).offset().top - 120 // -120 because of the sticky header 589 }, 400); 590 return false; 591 }) 592 } 593 594 // - - - CAREER STORIES - CLCK ON THUMBNAIL TO PLY YOUTUBE VIDEO 595 function careerStoriesYoutubeClick(){ 596 $('body').on('click', '.youtube-thumbnail img', function (){ 597 var iframe = $(this).parents('.youtube-ctn').find('iframe'); 598 iframe[0].src += "&autoplay=1"; 599 $(this).parent().remove(); 600 }); 601 } 602 603 // - - - Click on thumbnail to play youtube video in content page 604 function youtubePlayVideoOnThumbnailClick() { 605 $('.products-division__content-wrapper .video-wrapper img').on('click', function () { 606 var iframe = $(this).closest('.video-wrapper').find('iframe'); 607 iframe[0].src += "&autoplay=1"; 608 $(this).hide().closest('.video-wrapper').addClass("playing"); 609 }); 610 } 611 612 // - - - Add new class to main slider if autoplay video field is not empty - - - 613 function autoPlayVideoMute() { 614 if ($(".has-autoplay-video iframe").length) { 615 var $iframe = $(".has-autoplay-video iframe"); 616 var src = $iframe.attr("src").replace(/&autoplay=\d/, ''); 617 src += '&autoplay=1&mute=1'; 618 $iframe.attr('src', src); 619 } 620 } 621
622 // - - - Add attr playsinline to video html5 tag to autoplay video on IOS if autoplay is enable on their mobile and show video it's fully loaded - - - 623 function addPlayinlineForIos() { 624 if ($(".has-autoplay-video").length) { 625 $(".has-autoplay-video").find("video").attr("playsinline", ""); 626 627 var promise = document.querySelector('video').play(); 628 629 if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) { 630 $(".has-autoplay-video").find(".views-row.slide--type-image").addClass("loaded"); 631 $(".views-field-field-html-video-tag-1").show(); 632 } else { 633 if (promise !== undefined) { 634 // Auto-play started 635 // Show video 636 $(".has-autoplay-video").find(".views-row.slide--type-image").addClass("loaded"); 637 $(".views-field-field-html-video-tag-1").show(); 638 } 639 } 640 } 641 } 642 643 function hidePurpleBarForVideoHeroBanner() { 644 // if ($("body").hasClass("path-frontpage")) { 645 $(".js-custom-youtube-play-trigger").on("click", function() { 646 $(this).closest(".block-views-blocknode-partials-block-home-slideshow").addClass("has-playing-video"); 647 }) 648 // } 649 } 650 651 function adjustHeroBannerHeightForHomepageIfHasVideo() { 652 // if ($("body").hasClass("path-frontpage")) { 653 if ($("#views_slideshow_cycle_main_node_partials-block_home_slideshow .slide--type-video").length) { 654 $("#views_slideshow_cycle_main_node_partials-block_home_slideshow").addClass("is-video-banner"); 655 $(".region-highlighted").addClass("is-video-banner"); 656 } 657 } 658 // } 659 660 function checkIfHasCovidHeader() { 661 if ($("#block-covid19header").length) { 662 $("#block-views-block-node-partials-block-home-slideshow").addClass("has-covid-header"); 663 } 664 } 665 666 function addSocialLinkInMainNavTargetBlank() { 667 if ($(".nav-block-socials").length) { 668 $(".nav-block-socials .field--item a").attr("target", "_blank"); 669 } 670 } 671 672 function openPopoverLink() { 673 $("popover a").on("click", function() { 674 console.log("click pop") 675 if ($(this).attr("target") != undefined) { 676 window.open($(this).attr("href"), '_blank'); 677 } else { 678 window.location.href = $(this).attr("href"); 679 } 680 }) 681 } 682 683 function closePopoverOnBodyClick() { 684 $("body").on("click", function(event) { 685 if ($("body").hasClass("corporate-page-template")) { 686 if ((!$(event.target).closest('.footnote').length && !$(event.target).is('.footnote')) && (!$(event.target).closest('.reference-in-content').length && !$(event.target).is('.reference-in-content'))) { 687 if (!$(event.target).closest('.popover').length && !$(event.target).is('.popover')) { 688 $(".popover").remove(); 689 } 690 } 691 } 692 }) 693 } 694 695 // Show only specific Reference in popover 696 function showOnlySpecificRefInPopover() { 697 $(".reference-in-content").on("click", function() { 698 699 // Get all classes from clicked reference 700 var refClasses = $(this).attr("class").split(/\s+/); 701 var refClass = ""; 702 703 // Get the ref-id class 704 for (var i = 0; i < refClasses.length; i++) { 705 if (refClasses[i].startsWith("ref-id")) { 706 refClass = refClasses[i]; 707 } 708 } 709 710 // Display the correct refs-wrapper div in the tooltip 711 if (refClass != "") { 712 $(document).on('DOMNodeInserted', function (e) { 713 $(document).find(".popover .popover-content .refs-wrapper").each(function () { 714 if ($(this).hasClass(refClass)) { 715 $(this).show(); 716 } else { 717 $(this).hide() 718 } 719 }) 720 }) 721 } else { 722 $(document).on('DOMNodeInserted', function (e) { 723 $(document).find(".popover .popover-content .refs-wrapper").hide(); 724 $(document).find(".popover .popover-content > p").show(); 725 }) 726 } 727 728 // Hide previous popover 729 if ($("body").hasClass("corporate-page-template")) { 730 if ($(document).find(".popover").length == 1) { 731 $(document).find(".popover").first().remove(); 732 } 733 } 734 }) 735 } 736 737 // Add playsinline attr on home header slideshow video to make it work on mobile 738 function addHomepageBannerVideo() {
739 if ($(".js-hero-banner-video-src").length) { 740 console.log("yep") 741 $(".js-hero-banner-video-src").each(function () { 742 var videoSrc = $(this).data("src"); 743 console.log("video ", videoSrc) 744 if (videoSrc != "") { 745 $(this).closest(".views-row").addClass("has-video").append('<video class="hero-banner-video" preload="auto" autoplay loop muted playsinline><source src="' + videoSrc + '"></video>'); 746 } 747 }) 748 } 749 } 750 751 showOnlySpecificRefInPopover(); 752 customPackageInsertSearchForm(); 753 sliderImg(); 754 packageInsertTab(); 755 selectOptionAccordingUrl(); 756 produtTabClick(); 757 addHashToUrl(); 758 displayTabAccordingHash(); 759 hideEmptyDivOnCareerPage(); 760 smoothScroll(); 761 autoPlayVideoMute(); 762 featuredPostBgImg(); 763 youtubePlayVideoOnThumbnailClick(); 764 closePopoverOnBodyClick(); 765 removeDuplicateTitle(); 766 767 $(window).on('load', function() { 768 addHomepageBannerVideo(); 769 hidePurpleBarForVideoHeroBanner(); 770 adjustHeroBannerHeightForHomepageIfHasVideo(); 771 checkIfHasCovidHeader(); 772 clearField(); 773 fixMysteriousClassOnTab(); 774 packageInsertTitleTableFix(); 775 selectToDropdown(); 776 addPlayinlineForIos(); 777 sliderImg(); 778 // generateIframe(); 779 // createYTIframe(); 780 // onYouTubeIframeAPIReady(); 781 782 setTimeout(function() { 783 productHeaderImg(); 784 productBannerVideo(); 785 careerStoriesYoutubeClick(); 786 }, 100); 787 }) 788 789 $(window).on('resize', function() { 790 sliderImg(); 791 productHeaderImg(); 792 productBannerVideo(); 793 }) 794 795 /** 796 * Mobile Toggle Behaviour 797 * 798 * @type {Drupal~behavior} 799 */ 800 Drupal.behaviors.mobileToggle = { 801 attach: function(context, drupalSettings) { 802 var open = undefined; 803 var overlayOpen = undefined; 804 $('#navbar .navbar-toggle').click(function(e) { 805 if(open == undefined){ 806 open = true; 807 openNav(); 808 toggleOverlay(open, overlayOpen); 809 }else{ open = undefined; 810 closeNav(); 811 toggleOverlay(open, overlayOpen); 812 } 813 }); 814 $('[id^="block-search-toggle"] .custom-toggle-trigger').click(function(e) { 815 e.preventDefault(); 816 e.stopPropagation(); 817 var $trigger = $(this); 818 var $search = $('.navbar .block-custom-global-search-block'); 819 820 if ($search.hasClass('in')) { 821 822 // Collapse (animate up) 823 $search 824 .css('height', $search[0].scrollHeight + 'px') 825 .removeClass('collapse in') 826 .addClass('collapsing'); 827 828 // Force reflow 829 $search[0].offsetHeight; 830 831 $search.css('height', '0'); 832 833 overlayOpen = undefined; 834 toggleOverlay(open, overlayOpen); 835 836 setTimeout(function() { 837 $search 838 .removeClass('collapsing') 839 .addClass('collapse') 840 .css('height', ''); 841 }, 350); 842 843 } 844 else { 845 846 // Expand (animate down) 847 $search 848 .removeClass('collapse') 849 .addClass('collapsing') 850 .css({ 851 height: 0, 852 display: 'block' 853 }); 854 855 // Force reflow 856 $search[0].offsetHeight; 857 858 $search.css('height', $search[0].scrollHeight + 'px'); 859 overlayOpen = true; 860 toggleOverlay(open, overlayOpen); 861 862 setTimeout(function() { 863 $search 864 .removeClass('collapsing') 865 .addClass('collapse in') 866 .css({ 867 height: '', 868 display: '' 869 }); 870 var $input = $('.custom-global-search-form input[data-drupal-selector="edit-k"]'); 871 if ($input.length) { 872 $input.focus(); 873 } 874 }, 350); 875 } 876 }); 877 $('#overlay-mobile').click(function(e) { 878 var search_toggle = overlayOpen; 879 open = undefined; 880 overlayOpen = undefined; 881 closeNav(); 882 toggleOverlay(open, overlayOpen); 883 if(search_toggle){ 884 $('#block-search-toggle .custom-toggle-trigger').click(); 885 } 886 }); 887 888 // Remove the subnav controls when user clicks outside which will close the submenu. 889 $('body').on('click', function (e) { 890 if (!$('li.dropdown').is(e.target) 891 && $('li.dropdown').has(e.target).length === 0 892 && $('.open').has(e.target).length === 0 893 && document.getElementById("pageCanvas") 894 ) { 895 document.getElementById("pageCanvas").classList.remove('navbar-subnav-opened') 896 } 897 }); 898 } 899 }; 900 901 /** 902 * Dropdown toggle behavior. 903 * 904 * @type {Drupal~behavior} 905 */ 906 Drupal.behaviors.hologic_dropdown = { 907 attach: function(context, drupalSettings) {
908 var $navi = $('#block-hologic-main-menu'); 909 $(once('hologic-dropdown-toggle', $navi)).each(function() { 910 var $item = $(this); 911 var $link = $item.find('> a.dropdown-toggle'); 912 // Show dropdown on mouse enter. 913 $item.mouseenter(function() { 914 if ('true' !== $link.attr('aria-expanded')) { 915 $link.next('.dropdown-menu').show(); 916 $link.attr('aria-expanded', true); 917 } 918 }); 919 // Hide dropdown on mouse leave. 920 $item.mouseleave(function() { 921 if ('true' === $link.attr('aria-expanded')) { 922 $link.next('.dropdown-menu').hide(); 923 $link.attr('aria-expanded', false); 924 } 925 }); 926 // Open linked page normally on click. 927 $link.click(function(e) { 928 e.stopImmediatePropagation(); 929 return true; 930 }); 931 }); 932 } 933 }; 934 935 /** 936 * Site selector behavior. 937 * 938 * @type {Drupal~behavior} 939 */ 940 Drupal.behaviors.hologic_site_selector = { 941 attach: function(context, drupalSettings) { 942 $(once('hologic-site-selector', '#block-siteselector')) 943 .each(function() { 944 var $block = $(this); 945 var $mySidenav = $block.closest('#mySidenav'); 946 var $toggle = $block.find('.dropdown-toggle'); 947 948 // Scroll page to the top when site selector menu is opened on Mobile. 949 if ($mySidenav.length) { 950 $toggle.on('click', () => $mySidenav.animate({scrollTop: 0}, 200)); 951 } 952 953 // Make links open in a new window. 954 $block.find('.dropdown-menu a').attr('target', '_blank'); 955 }); 956 } 957 }; 958 959 /** 960 * Equalize heights of certain elements within a specified parent. 961 * 962 * @type {Drupal-behavior} 963 */ 964 Drupal.behaviors.hologic_height_equalization = { 965 attach: function(context, drupalSettings) { 966 $(once('hologic-height-equalization', 'html', context)) 967 .on('load resize', function() { 968 clearTimeout($.data(this, 'hologicHeightEqualizationTimer')); 969 $.data(this, 'hologicHeightEqualizationTimer', setTimeout(function() { 970 var entries = [ 971 { 972 wrapper: '.page_layout_4_column_content_box', 973 childSelector: '.box-wrapper' 974 }, 975 { 976 wrapper: '.view-display-id-block_global_featured_1 .slick-track', 977 childSelector: '.slick-slide' 978 }, 979 { 980 wrapper: '.view-display-id-block .slick-track', 981 childSelector: '.slick-slide' 982 }, 983 { 984 wrapper: '.view-display-id-block_1 .slick-track', 985 childSelector: '.slick-slide' 986 }, 987 { 988 wrapper: '.page_layout_3_column_grid', 989 childSelector: '.col-md-4' 990 }, 991 { 992 wrapper: '#block-support-page-3-column-grid .field--name-field-boxes', 993 childSelector: '> .field--item' 994 }, 995 { 996 wrapper: '.view--product-teasers .view-content', 997 childSelector: '.views-row' 998 } 999 ]; 1000 for (var i in entries) { 1001 var entry = entries[i]; 1002 // See if all images inside the wrapper are loaded. 1003 var loaded = true; 1004 $(entry.wrapper).find('img').each(function() { 1005 if (!this.complete) { 1006 loaded = false; 1007 } 1008 }); 1009 // If not loaded then wait for the images to load. 1010 if (!loaded) { 1011 // console.log('Waiting for images to load inside "' + entry.wrapper + '".'); 1012 // var args = arguments; 1013 // setTimeout(function() { 1014 // args.callee.apply(this, args); 1015 // }, 100); 1016 // return; 1017 } 1018 // For every wrapper, apply the height of the tallest child 1019 // to all children to keep things well-aligned. 1020 $(entry.wrapper).each(function() { 1021 var $children = $(entry.wrapper).find(entry.childSelector); 1022 // Remove previously applied height. 1023 $children.height('').removeClass('hologic-height-equalized'); 1024 var children = $children.get(); 1025 var rowOffset; 1026 var rowItems = []; 1027 var rowHeight = 0; 1028 for (var childIndex in children) { 1029 childIndex = parseInt(childIndex); 1030 var $child = $(children[childIndex]); 1031 var $nextChild = $(children[childIndex + 1]); 1032 // Collect items for the current row. 1033 rowHeight = Math.max(rowHeight, $child.outerHeight()); 1034 rowOffset = $child.offset().top; 1035 rowItems.push($child[0]); 1036 // If this is a new row or the last row, then apply height to 1037 // the current set of items. 1038 var rowChanged = (childIndex + 1 == children.length) 1039 || $nextChild.offset().top != rowOffset; 1040 if (rowChanged) { 1041 for (var rowIndex in rowItems) { 1042 var $rowItem = $(rowItems[rowIndex]); 1043 var vPadding = $rowItem.outerHeight() - $rowItem.height(); 1044 $rowItem.height(rowHeight - vPadding).addClass('hologic-height-equalized'); 1045 } 1046 // Reset row height and row items. 1047 rowHeight = 0; 1048 rowItems = []; 1049 } 1050 // console.log('Item ' + childIndex + '; Row changed: ' + rowChanged + '; Height applied: ' + rowHeight); 1051 } 1052 }); 1053 } 1054 }, 100)); 1055 }).trigger('resize'); 1056 } 1057 }; 1058 1059 /** 1060 * Social links behavior. 1061 * 1062 * @type {Drupal~behavior} 1063 */ 1064 Drupal.behaviors.hologic_social_icons = { 1065 attach: function(context, drupalSettings) { 1066 $(context).find('.block-social-icons .paragraph--type--icon-link a') 1067 .attr('target', '_blank'); 1068 } 1069 }; 1070 1071 /** 1072 * Social links behavior. 1073 * 1074 * @type {Drupal~behavior} 1075 */ 1076 Drupal.behaviors.hologic_quote_ribbon = { 1077 attach: function(context, drupalSettings) { 1078 $(once('hologic-quote-ribbon', '.field--name-body', context)).each(function() { 1079 $("blockquote").wrap( "<div class='quote-blue-ribbon'></div>" ); 1080 }); 1081 } 1082 }; 1083 1084 /** 1085 * Page layout customizations. 1086 * 1087 * @type {Drupal~behavior} 1088 */ 1089 Drupal.behaviors.hologic_page_layout = { 1090 attach: function (context, drupalSettings) { 1091 $(once('hologic-page-layout', '.view-page-layout', context)).each(function() { 1092 var $this = $(this); 1093 // Hide empty page layouts. 1094 if ($this.text().trim().length == 0) { 1095 $this.addClass('hidden'); 1096 } 1097 }); 1098 } 1099 }; 1100 1101 /** 1102 * Clickable YouTube Thumbnails. 1103 * 1104 * @type {Drupal~behavior} 1105 */ 1106 Drupal.behaviors.hologic_youtube_play_trigger = { 1107 attach: function(context, drupalSettings) { 1108 var entries = [ 1109 '.paragraph--type--video-with-thumb', 1110 '.js-custom-youtube-play-trigger', 1111 '.has-banner-video' 1112 ]; 1113 $(once('hologic-youtube-play-trigger', entries.join(', '), context)) 1114 .click(function(e) { 1115 // Determine the "realm" in which the thumbnail and the video exist. 1116 var $container = $(this); 1117 // Find the YouTube video "iframe". 1118 var $iframe = $container.find('iframe'); 1119 // Use "autoplay" to start playing the video. 1120 var src = $iframe.attr('src').replace(/&autoplay=\d/, ''); 1121 src += '&autoplay=1'; 1122 $iframe.attr('src', src);
1123 // Add "youtube-video-playing" class to the container. 1124 // Do a delay so that the YouTube "iframe" can reload. 1125 // Using the YouTube Iframe API might make things smoother. 1126 setTimeout(function() { 1127 $container.addClass('youtube-playing'); 1128 // Trigger resize event to resize YouTube iframe in case it was "hidden". 1129 $(window).trigger('resize'); 1130 }, 250); 1131 }); 1132 } 1133 }; 1134 1135 /** 1136 * Responsive YouTube embeds. 1137 * 1138 * @type {Drupal~behavior} 1139 */ 1140 /* Drupal.behaviors.hologic_responsive_youtube_iframe = { 1141 attach: function(context, drupalSettings) { 1142 $(window) 1143 .once('hologic-responsive-youtube-iframe') 1144 .on('resize', function() { 1145 clearTimeout($.data(this, 'hologicResponsiveYouTubeIframeTimer')); 1146 $.data(this, 'hologicResponsiveYouTubeIframeTimer', setTimeout(function() { 1147 // Define selectors to get YouTube "iframe" elements. 1148 // For this to work, the immediate parent of the "iframe" must be assigned a width and height; 1149 var selectors = [ 1150 '.region-highlighted .slide--type-video', 1151 // '.paragraph--type--video-with-thumb .field--type-youtube' 1152 ]; 1153 // Look for YouTube "iframe" elements and do the magic. 1154 $(context).find(selectors.join(', ')).each(function() { 1155 var $parent = $(this); 1156 var $iframe = $parent.find('iframe');
1157 // Prepare CSS object containing CSS adjustments required to make 1158 // the iframe fit into it's parent like "background-size: cover". 1159 var adjust = { 1160 'width': '', 1161 'height': '', 1162 marginTop: '', 1163 marginLeft: '' 1164 }; 1165 // Reset styles applied previously. 1166 $iframe.css(adjust); 1167 // Assume video aspect ratio to be 16:9. 1168 var aR = 16 / 9; 1169 // Determine target dimensions. 1170 var tW = $parent.width(); 1171 var tH = tW / aR; 1172 1173 // If a vertical adjustment is required. 1174 if (tH > $parent.height()) { 1175 // Determine the height required to make the video fit to width. 1176 adjust.width = tW; 1177 adjust.height = tH; 1178 // Align the "iframe" vertically within the parent. 1179 var vDiff = adjust.height - $parent.height(); 1180 if (vDiff > 0) { 1181 adjust.marginTop = 0 - (vDiff / 2); 1182 } 1183 } 1184 // If a horizontal adjustment is required. 1185 else if (tH < $parent.height()) { 1186 adjust.height = $parent.height(); 1187 adjust.width = $parent.height() * aR; 1188 // Align the "iframe" horizontally within the parent. 1189 var hDiff = adjust.width - $parent.width(); 1190 if (hDiff > 0) { 1191 // TODO: We do not center the video horizontally because it cuts off the YouTube logo. 1192 // adjust.marginLeft = 0 - (hDiff / 2); 1193 adjust.marginLeft = 0 - (hDiff); 1194 } 1195 } 1196 // Apply CSS adjustments computed above. 1197 $iframe.css(adjust); 1198 }); 1199 }, 100)); 1200 }).trigger('resize'); 1201 } 1202 }; */ 1203 1204 /** 1205 * Initializes accordion views. 1206 * 1207 * @type {Drupal~behavior} 1208 */ 1209 Drupal.behaviors.hologic_view_accordion = { 1210 attach: function(context, drupalSettings) { 1211 $(once('hologic-view-accordion', '.view--accordion', context)) 1212 .each(function() { 1213 // Initialize each group in the view as a collapsible. 1214 var $groups = $(this).find('.view-grouping'); 1215 $groups.each(function() { 1216 var $header = $(this).find('.view-grouping-header'); 1217 var $content = $(this).find('.view-grouping-content'); 1218 var header_id = $header.text().trim().toLowerCase().replace(/\W/g, '-').replace(/-+/g, '-'); 1219 var content_id = header_id + '-content'; 1220 $header.attr({ 1221 'id': header_id, 1222 'data-target': '#' + content_id, 1223 'data-toggle': 'collapse', 1224 'area-expanded': 'false' 1225 }).addClass('collapsed'); 1226 $content.attr({ 1227 'id': content_id, 1228 }).addClass('collapse'); 1229 }); 1230 1231 // Expand accordions if indicated in the URL hash. 1232 var hash = window.location.hash; 1233 if (hash.length > 1) { 1234 var headerId = '#view-grouping--' + window.location.hash.substr(1); 1235 var $header = $groups.find(headerId).closest('.view-grouping-header'); 1236 if (1 == $header.length) { 1237 // TODO: Why do we need a timeout? 1238 setTimeout(function() { 1239 $header.trigger('click'); 1240 Hologic.scrollTo({ 1241 x: 0, 1242 y: $header.offset().top 1243 }) 1244 }, 250); 1245 } 1246 } 1247 }); 1248 } 1249 }; 1250 1251 1252 /** 1253 * Initializes custom popovers. 1254 * 1255 * For every ".js-custom-popover-trigger" found inside a ".views-row", 1256 * the script searches for a ".js-custom-popover-content" and shows the 1257 * content as a popover for the trigger. If the popover is expected to 1258 * contain markup, it MUST not be a part of a views output rewrite cause 1259 * the rewrite removes many types of HTML tags. 1260 * 1261 * @type {Drupal~behavior} 1262 */ 1263 Drupal.behaviors.hologic_popover = { 1264 attach: function(context, drupalSettings) { 1265 var entries = [ 1266 { 1267 wrapper: '.views-row', 1268 trigger: '.js-custom-popover-trigger', 1269 content: '.js-custom-popover-content' 1270 }, 1271 { 1272 wrapper: '.paragraph--type--tooltip', 1273 trigger: '.field--name-field-title', 1274 content: '.field--name-field-body' 1275 }, 1276 { 1277 wrapper: '.timeline__wrapper', 1278 trigger: '.reference-in-content', 1279 content: '.paragraph--type--tooltip .field--name-field-body' 1280 } 1281 ]; 1282 for (var i in entries) { 1283 var entry = entries[i]; 1284 $(once('hologic-popover', entry.wrapper + ' ' + entry.trigger,
1284context)) 1285 .each(function() { 1286 // Prepare the elements and confirm they exist. 1287 var $trigger = $(this); 1288 var $popover = $trigger.closest(entry.wrapper).find(entry.content); 1289 if (1 !== $popover.length) { 1290 throw('Missing popover content.'); 1291 } 1292 1293 // Initialize popover! 1294 $trigger.popover({ 1295 content: $popover.html(), 1296 html: true, 1297 placement: 'top', 1298 trigger: $("body").hasClass("corporate-page-template") ? 'click' : 'hover focus' 1299 }); 1300 }); 1301 1302 } 1303 } 1304 }; 1305 1306 /** 1307 * Creates DOM elements to be styled as white corners. 1308 * 1309 * @type {Drupal~behavior} 1310 */ 1311 Drupal.behaviors.hologic_video_corners = { 1312 attach: function(context, drupalSettings) { 1313 var entries = [ 1314 '.paragraph--type--video-with-thumb .field--type-image' 1315 ]; 1316 $(once('hologic-video-corners', entries.join(', '), context)) 1317 .each(function() { 1318 var $this = $(this); 1319 var corners = ['tl', 'tr', 'bl', 'br']; 1320 for (var i in corners) { 1321 $this.prepend('<span class="corner corner-' + corners[i] + '"/>'); 1322 } 1323 }); 1324 } 1325 }; 1326 1327 /** 1328 * Duplicates certain UL elements as SELECT elements. 1329 * 1330 * @type {Drupal~behavior} 1331 */ 1332 Drupal.behaviors.hologic_dropdown_jumper = { 1333 attach: function(context, drupalSettings) { 1334 var entries = [ 1335 { 1336 wrapper: '.block-facet--links ul.item-list__links', 1337 textSelector: '.facet-item__value', 1338 activeCallback: function(link) { 1339 return $(link).hasClass('is-active'); 1340 } 1341 } 1342 ]; 1343 for (var i in entries) { 1344 var entry = entries[i]; 1345 $(once('hologic-dropdown-jumper', entry.wrapper, context )) 1346 .each(function() { 1347 var $list = $(this); 1348 // Convert the list into a SELECT element. 1349 var $select = $('<select class="form-select hologic-jumper" />'); 1350 $list.find('li a').each(function() { 1351 var $link = $(this); 1352 // Determine and prepare link text. 1353 var text = $link.text(); 1354 if (entry.textSelector && $link.find(entry.textSelector).length > 0) { 1355 text = $link.find(entry.textSelector).text(); 1356 } 1357 text = text.trim(); 1358 // Build an "option" for the link. 1359 var $option = $('<option value="' + $link.attr('href') + '">' 1360 + text.trim() 1361 + '</option>' 1362 ); 1363 // Higlight selected option based on window location. 1364 if (entry.activeCallback($link[0])) { 1365 $option.attr('selected', 'selected'); 1366 } 1367 $select.append($option); 1368 }); 1369 $list.after($select); 1370 // When the selection changes, redirect to the selected link. 1371 $select.change(function() { 1372 window.location = $(this).val(); 1373 }); 1374 }); 1375 } 1376 } 1377 }; 1378 1379 /** 1380 * Mark active links. 1381 * 1382 * @type {Drupal~behavior} 1383 */ 1384 Drupal.behaviors.hologic_active_links = { 1385 attach: function (context, drupalSettings) { 1386 // Determine window location. 1387 var wHref = window.location.href; 1388 if (window.location.search.length > 0) { 1389 wHref = window.location.search; 1390 } 1391 1392 // Find non-active anchor tags. 1393 $(once('hologic-active-links', $('a').not('.active'), context)) 1394 .each(function() { 1395 // Mark the anchor as active, if applicable. 1396 if (this.href == wHref) { 1397 jQuery(this).addClass('active'); 1398 } 1399 }); 1400 } 1401 }; 1402 1403 function isIE() { 1404 if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) { 1405 jQuery(".slick--view--product-related .slick__slide").addClass("isIe"); 1406 } 1407 } 1408 1409 isIE(); 1410 1411})(jQuery, Drupal, drupalSettings, once); 1412 1413(function($, Drupal, drupalSettings, once){ 1414 "use strict"; 1415 1416 Drupal.behaviors.resizeTrademark = { 1417 1418 attach: function (context, settings) { 1419 $(once('coh-component', '.coh-component', context)).each(function() { 1420 if($(this).hasClass('coh-heading')){ 1421 $(this).html(function(i, html) { 1422 return html.replaceAll("®", '<span class="sup">®
1422</span>'); 1423 }); 1424 } 1425 }); 1426 } 1427 }; 1428 1429 Drupal.behaviors.tabsSlick = { 1430 attach: function (context, settings) { 1431 $(once('hologic-tabs-slick', 'a[data-toggle="tab"]')).each(function() { 1432 $(this).on('shown.bs.tab', function (e) { 1433 $('.slick-initialized', $("" + $(e.target).attr('href'))).slick('refresh'); 1434 }); 1435 }); 1436 } 1437 }; 1438 1439 Drupal.behaviors.OpenPDFNewTab = { 1440 attach: function (context, settings) { 1441 $(document).ready(function() { 1442 // Open PDF In New Window 1443 $(once('hologic-pdfs', 'a[href$=".pdf"]', context)).each(function() { 1444 $(this).attr('target', '_blank'); 1445 }); 1446 }); 1447 } 1448 }; 1449 1450 Drupal.behaviors.clipboard = { 1451 attach: function (context, settings) { 1452 new ClipboardJS('.clipboard'); 1453 1454 $(once('hologic-clipboard', '.clipboard', context)).each(function() { 1455 var text = $(this).text(); 1456 1457 $(this).on('click', function () { 1458 $(this).text(Drupal.t("Copied to clipboard")); 1459 }); 1460 1461 $(this).hover( 1462 function() { 1463 var $this = $(this); 1464 $this.text(Drupal.t("Copy value")); 1465 $this.css({"color": "#af3db2", "cursor": "pointer"}); 1466 }, 1467 function() { 1468 var $this = $(this); 1469 $this.removeAttr('style'); 1470 $this.text(text); 1471 } 1472 ); 1473 }); 1474 } 1475 }; 1476 1477 Drupal.behaviors.HideFeedbackButton = { 1478 attach: function (context) { 1479 $(once('hide-feedback-button', '#website-feedback-modal-button', context)).remove(); 1480 } 1481 }; 1482 1483 Drupal.behaviors.randomImages = { 1484 attach: function (context, settings) { 1485 $(once('random-images', '.random-images-container', context)).each(function() { 1486 1487 var images = $(this).find('img.cvent-random-image'); 1488 1489 if (images.length !== 0) { 1490 // Get random image index 1491 var index = Math.floor(Math.random() * (images.length)); 1492 1493 // lookup for the find images and hide the other 1494 for (var i=0; i<images.length; i++) { 1495 // If the index is different, remove it 1496 if (i !== index) { 1497 $(images[i]).remove(); 1498 } 1499 } 1500 } 1501 }); 1502 } 1503 }; 1504 1505})(jQuery, Drupal, drupalSettings, once); 1506
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.