https://www.ipvc.pt/wp-content/themes/gsk-site/js/skill/main.js?ver=939506b7a8c476454494858d591f6aac
1(function ($) { 2 // $('.main-menu-desktop > .menu-item').mouseover(function () { 3 // $(this).addClass('active'); 4 // }).mouseout(function () { 5 // $(this).removeClass('active'); 6 // }); 7 8 /** 9 * ================================================================================== 10 * MENU MOBILE 11 * ================================================================================== 12 */ 13 /** 14 * Menu Mobile Foundation 15 * Colocar o nome do menu selecionado quando se abre um submenu 16 */ 17 $(".menu-mobile .main-menu-mobile .menu-item-has-children").each(function () { 18 var $sub = $(this).find("ul:first"); 19 var $aParent = $(this).find("a:first"); 20 21 var $clone = $aParent.clone(); 22 $clone.removeAttr("href"); 23 var $newLi = $clone.wrap("<li></li>"); 24 25 $clone 26 .prependTo($sub) 27 .wrap('<li class="hide-for-xlarge nameForControl"></li>'); 28 }); 29 30 $(document).foundation(); 31 32 /** 33 * Menu Mobile Foundation Drilldown 34 */ 35 if ($(".main-menu-mobile").length > 0) { 36 var elem = new Foundation.Drilldown($(".main-menu-mobile"), { 37 backButton: 38 '<li class="js-drilldown-back backButtonMobile H5SecondaryNeutralLeft">' + 39 menuParams.backLabel + 40 "</li>", 41 closeOnClick: false, 42 autoHeight: true, 43 animateHeight: true, 44 animationDuration: 500, 45 animationEasing: "swing", 46 "data-scroll-top": true, 47 }); 48 49 // ARIA and Roles attribute type for accessibility 50 // role="menuitem" only in <a></a> 51 // role="menubar" and role="group" are not for menus, must be removed 52 // aria-haspopup not in <li></li>, only in <a></a> when has a <ul></ul> at the same level 53 54 $("#ulMenuMobile").removeAttr("aria-multiselectable"); 55 56 //remove role from <ul></ul> 57 $('#gsk-header-menu-mobile ul').each(function () { 58 $(this).removeAttr('role'); 59 }); 60 61 $('#gsk-header-menu-mobile li').each(function () { 62 $(this).removeAttr('role'); 63 }); 64 65 $('#ulMenuMobile li a').each(function () { 66 $(this).removeAttr('role'); 67 }); 68 69 $( 70 ".header-menu-mobile .menu-mobile .menu-mobile-items>.menu-mobile-items__left >.is-drilldown" 71 ).attr("style", ""); 72 } 73 74 $( 75 ".header-menu-mobile .menu-mobile .menu-mobile-items .menu-mobile-items__quick-accesses" 76 ).on("click", function () { 77 $( 78 ".header-menu-mobile .menu-mobile .menu-mobile-items .menu-mobile-quick-accesses" 79 ).addClass("menu-mobile-quick-accesses-show"); 80 }); 81 82 $( 83 ".header-menu-mobile .menu-mobile .menu-mobile-items .menu-mobile-quick-accesses .menu-mobile-quick-accesses-backmenu" 84 ).on("click", function () { 85 $( 86 ".header-menu-mobile .menu-mobile .menu-mobile-items .menu-mobile-quick-accesses" 87 ).removeClass("menu-mobile-quick-accesses-show"); 88 }); 89 90 // fix height problem in safari 91 setTimeout(function () { $('.is-drilldown').height($('.is-drilldown .main-menu-mobile').height()); }, 1000); 92 93 $( '.main-menu-mobile' ).on( 'open.zf.drilldown', function( e ) { 94 $( '.is-drilldown' ).height( $( '.is-drilldown' ).find( '.is-active' ).not( '.is-closing' ).last().height() ); 95 }); 96 97 $( '.main-menu-mobile' ).on( 'hide.zf.drilldown', function( e ) { 98 if ( $( '.is-drilldown' ).find( '.is-active' ).length == 1 ) { 99 $( '.is-drilldown' ).height( $( '.is-drilldown .main-menu-mobile' ).height() ); 100 } 101 }); 102 103 $('.main-menu-mobile').on('open.zf.drilldown hide.zf.drilldown closed.zf.drilldown', function (event) { 104 var animationDuration = 500, 105 animationEasing = 'swing', 106 scrollPos = $(this).offset().top; 107 108 // 1- retirar toda a css adiionada aos items onde vamos entrar, e adcionar css onde estamos a sair 109 $('.main-menu-mobile .is-active:not(.is-active.is-closing)').children().css("display", ""); 110 $('.main-menu-mobile .is-active:not(.is-active.is-closing)').parent().siblings().css("display", "none"); 111 $('.main-menu-mobile > .menu-item > .is-drilldown').attr('style', ''); 112 if ($('.main-menu-mobile .is-active:not(.is-active.is-closing)').length < 1) { 113 // Cobrir o caso do 1 nivel do menu 114 if (event.type != "open") { 115 $(this).children().css("display", ""); 116 } 117 } 118 $('.main-menu-mobile .is-active').stop(true).animate({ 119 scrollTop: scrollPos 120 }, animationDuration, animationEasing); 121 }); 122 123 /** 124 * Menu Mobile
125 * Open Menu only 126 */ 127 var openMenuTimeout = null; 128 $(".header-menu-mobile__hamburguer").on("click", function () { 129 // console.log( 'menu' ); 130 131 if ( 132 !$(".header-section-menu-mobile-open").hasClass( 133 "header-section-menu-mobile-open--visible" 134 ) 135 ) { 136 $(".header-section-menu-mobile-open").addClass( 137 "header-section-menu-mobile-open--visible" 138 ); 139 } 140 141 if (!$(".menu-mobile").hasClass("header-menu-mobile--open")) { 142 $(".menu-mobile").addClass("header-menu-mobile--open"); 143 $("body").addClass("disable-scroll"); 144 } 145 }); 146 147 /** 148 * ================================================================================== 149 * ACCESSIBILITY 150 * ================================================================================== 151 */ 152 $("#accessibilityBtn").on("click", function () { 153 $(".wahout.aicon_link").click(); 154 $("#accessibilityBtn").addClass("checked"); 155 close_menu_mobile(); 156 }); 157 158 $(".close_container.wahout").on("click", function () { 159 $("#accessibilityBtn").removeClass("checked"); 160 }); 161 /** 162 * Menu Mobile 163 * Close Menu only 164 */ 165 function close_menu_mobile() { 166 if ( 167 $(".header-section-menu-mobile-open").hasClass( 168 "header-section-menu-mobile-open--visible" 169 ) 170 ) { 171 $(".header-section-menu-mobile-open").removeClass( 172 "header-section-menu-mobile-open--visible" 173 ); 174 } 175 176 if ($(".menu-mobile").hasClass("header-menu-mobile--open")) { 177 $(".menu-mobile").removeClass("header-menu-mobile--open"); 178 $('[aria-expanded="true"]').attr("aria-expanded", false); 179 // enableScroll(); 180 181 $("body").removeClass("preventScroll"); 182 183 openMenuTimeout = window.setTimeout(function () { 184 $(".main-menu-mobile").foundation("_hideAll"); 185 }, 500); 186 $(".header-menu-mobile__hamburguer #menu-hamburguer").removeClass( 187 "is-active" 188 ); 189 } 190 } 191 $(".header-section-menu-mobile-open__close-mobile").on("click", function () { 192 close_menu_mobile(); 193 194 if ( 195 $( 196 ".header-menu-mobile .menu-mobile .menu-mobile-items .menu-mobile-quick-accesses" 197 ).hasClass("menu-mobile-quick-accesses-show") 198 ) { 199 $( 200 ".header-menu-mobile .menu-mobile .menu-mobile-items .menu-mobile-quick-accesses" 201 ).removeClass("menu-mobile-quick-accesses-show"); 202 } 203 }); 204 205 /** 206 * Menu Desktop 207 * Close Menu Button 208 * 209 */ 210 $( 211 ".header-section .header-section-inner .nav-menu-l1 .nav-menu-l1__wrapper>ul li" 212 ).mouseenter(function () { 213 if ($(this).hasClass("menu-item-has-children") &&window.innerWidth > 1200) { 214 window.menuItem = this; 215 $(this).addClass("menu-item-hover"); 216 $(".header-section .header-section-inner .header-section-menu-mobile-open .header-section-menu-mobile-open__close-mobile").addClass("header-section-menu-mobile-open__close-mobile-hide-large"); 217 $(".header-section .header-section-inner .header-section-menu-mobile-open").css("pointer-events", "none"); 218 } 219 }); 220 221 $( 222 ".header-section .header-section-inner .nav-menu-l1 .nav-menu-l1__wrapper>ul li" 223 ).mouseleave(function () { 224 if ( 225 $(this).hasClass("menu-item-has-children") && window.innerWidth > 1200) { 226 $(this).removeClass("menu-item-hover"); 227 $(".header-section .header-section-inner .header-section-menu-mobile-open .header-section-menu-mobile-open__close-mobile").removeClass("header-section-menu-mobile-open__close-mobile-hide-large"); 228 $(".header-section .header-section-inner .header-section-menu-mobile-open").css("pointer-events", "auto"); 229 } 230 }); 231 232 $( 233 ".header-section .header-section-inner .nav-menu-l1 .nav-menu-l1__wrapper>ul>.menu-item-has-children>.sub-menu>li>.header-section-menu-desktop-open__close" 234 ).on("click", function () { 235 $( 236 ".header-section .header-section-inner .header-section-menu-mobile-open .table .table-cell .header-section-menu-mobile-open__close-mobile" 237 ).addClass("header-section-menu-mobile-open__close-mobile-hide-large"); 238 $(window.menuItem).removeClass("menu-item-hover"); 239 }); 240 241 242 /** 243 * Menu Desktop 244 * Open/closes menu item children on tab 245 * 246 */ 247 $('.btn-open-children').on('click', function () { 248 249 const $parentLi = $(this).closest('li'); 250 251 // Add hover class to current item 252 $parentLi.addClass('menu-item-hover'); 253 254 // Disable main content 255 $('main').attr('inert', ''); // Prevents focus and clicks 256 $('main').attr('aria-hidden', 'true'); // Hides from screen readers 257 258 }); 259
260 // Remove class when focus leaves the list item 261 $('#gsk-header-menu-large li').on('focusout', function (e) { 262 263 const $this = $(this); 264 265 // Use setTimeout to check if the new focused element is still inside this <li> 266 setTimeout(() => { 267 if (!$this.has(document.activeElement).length) { 268 $this.removeClass('menu-item-hover'); 269 $('main').removeAttr('inert'); 270 $('main').removeAttr('aria-hidden'); 271 } 272 }, 10); 273 274 }); 275 276 277 //remove button, when <li> doesn't has submenu 278 $('.btn-open-children').each(function() { 279 if (!$(this).parent().hasClass('menu-item-has-children')) { 280 $(this).remove(); 281 } 282 }); 283 284 // $('.accessibility_icon').on('click', function () { 285 // close_menu_mobile(); 286 // }); 287 288 // $('.header-menu-mobile__search').on('click', function () { 289 // close_menu_mobile(); 290 // }); 291 292 //calcula a altura do menu 293 $(window).load(function () { 294 if ($(window).width() >= 1023) { 295 //com filho aberto 296 $menu_flag = $(".menu-pane-content"); 297 298 $ul_height_child_flag = $(".menu-pane-content ul .current-menu-ancestor ul "); 299 $ul_height_child = $(".menu-pane-content ul .current-menu-ancestor ul ").outerHeight(); 300 301 $("#content-full").css("margin-top", `calc(${$ul_height_child}px)`); 302 303 //fix when parent menu has 2 or more lines 304 $ul_height_parent = $("#menu-main-menu-2").outerHeight(); 305 306 $(".menu-pane-content ul .current-menu-ancestor ul ").css("margin-top", `calc(${$ul_height_parent}px)`); 307 308 309 if ($menu_flag.length == 1) { 310 //com filho por abrir 311 $ul_height = $(".menu-pane-content ul .current_page_item ul ").outerHeight(); 312 $ul_height_flag = $(".menu-pane-content ul .current_page_item ul "); 313 314 //fix when parent menu has 2 or more lines 315 $ul_height_flag.css("margin-top", `calc(${$ul_height_parent}px)`); 316 317 if ($ul_height_flag.length == 0 && $ul_height_child_flag.length == 0) { 318 $("#content-full").css("margin-top", `calc(0px)`); 319 320 } else { 321 $("#content-full").css("margin-top", `calc(${$ul_height}px)`); 322 } 323 } 324 } 325 }); 326 /** 327 * Loader screen 328 */ 329 $(window).load(function () { 330 $(".loader-screen").fadeOut(function () { 331 $(this).remove(); 332 $("body").css("overflow", "auto"); 333 $("body").css("padding-right", "0"); 334 }); 335 }); 336 337 /** 338 * ================================================================================== 339 * SOCIAL 340 * ================================================================================== 341 */ 342 343 var popupSizeW = 560; 344 var popupSizeH = 560; 345 var theFacebookShareUrl = "http://www.facebook.com/sharer.php?u="; 346 var theTwitterShareUrl = "http://twitter.com/share?url="; 347 var theLinkedInShareUrl = 348 "http://www.linkedin.com/shareArticle?mini=true&url="; 349 var urlShare = window.location.href; 350 urlShare = encodeURIComponent(urlShare); 351 352 $(".facebook-share").on("click", function () { 353 window.open( 354 theFacebookShareUrl + urlShare, 355 "sharer", 356 "toolbar=0,status=0,width=" + popupSizeW + ",height=" + popupSizeH 357 ); 358 }); 359 360 $(".twitter-share").on("click", function () { 361 window.open( 362 theTwitterShareUrl + urlShare, 363 "sharer", 364 "toolbar=0,status=0,width=" + popupSizeW + ",height=" + popupSizeH 365 ); 366 }); 367 368 $(".linkedin-share").on("click", function () { 369 window.open( 370 theLinkedInShareUrl + urlShare, 371 "sharer", 372 "toolbar=0,status=0,width=" + popupSizeW + ",height=" + popupSizeH 373 ); 374 }); 375 376 //RSS 377 378 //ISSUU 379 380 /** 381 * Switch tabs 382 */ 383 384 //scroll 385 if ($(".soc-share-001")[0]) { 386 const $allTabs = $( 387 ".soc-share-001>.soc-share-001_popup .soc-share-001_socials >ul" 388 ); 389 const $tabLi = $( 390 ".soc-share-001>.soc-share-001_popup .soc-share-001_socials >ul >li" 391 ); 392 393 let scroll = new IScroll( 394 ".soc-share-001>.soc-share-001_popup .soc-share-001_socials", 395 { 396 scrollX: true, 397 scrollY: false, 398 momentum: true, 399 click: true, 400 } 401 ); 402 403 tabsData = "5"; 404 //set tabs width 405 406 if (typeof tabsData == "undefined") { 407 throw new Error("Missing data!"); 408 } 409
410 let scrollWidth = scroll.wrapperWidth; 411 412 function setTabWidth() { 413 let scrollParentWidth = $allTabs.parent().parent().width(); 414 415 let totalTabs = tabsData.total_tabs; 416 417 if (scrollWidth < scrollParentWidth) { 418 let liWidth = scrollParentWidth / totalTabs; 419 420 $tabLi.css("width", liWidth); 421 } 422 } 423 424 setTabWidth(); 425 426 $(window).resize(function () { 427 setTabWidth(); 428 }); 429 430 function copyText() { 431 var copyText = document.getElementById("soc-share-001_input"); 432 copyText.select(); 433 copyText.setSelectionRange(0, 99999); 434 document.execCommand("copy"); 435 } 436 $(".soc-share-001_copy-button-title").click(function () { 437 copyText(); 438 }); 439 440 $(".soc-share-001_button").click(function (e) { 441 $(".soc-share-001").css("visibility", "visible"); 442 $("html").css("position", "fixed"); 443 }); 444 445 // var elem = document.getElementById("soc-share-001_elements"); 446 var soc = document.getElementById("soc-share-001"); 447 window.onclick = function (event) { 448 if (event.target == soc) { 449 soc.style.display = "none"; 450 } 451 }; 452 453 $(".soc-share-001_close").click(function () { 454 $(".soc-share-001").css("visibility", "hidden"); 455 $("html").css("position", "relative"); 456 }); 457 458 //close popup share with escape key 459 $(document).on("keydown", function (e) { 460 if (e.keyCode === 27) { 461 // ESC 462 soc.style.display = "none"; 463 } 464 }); 465 } 466 467 /** 468 * Manual translations select 469 */ 470 var manualTranslateSelect = document.getElementById( 471 "qtranxs_select_qtranslate-chooser" 472 ); 473 474 if (manualTranslateSelect != null) { 475 document.getElementById( 476 "qtranxs_select_qtranslate-chooser" 477 ).options[0].text = "PT"; 478 document.getElementById( 479 "qtranxs_select_qtranslate-chooser" 480 ).options[1].text = "EN"; 481 } 482 483 /** 484 * ================================================================================== 485 * header top info select 486 * Accessibility fix 487 * ================================================================================== 488 */ 489 490 //remove role 'none' 491 let headerTopInfoLI = document.querySelectorAll( 492 ".header-section-top-info >nav ul li" 493 ); 494 headerTopInfoLI.forEach(function (elem) { 495 $(elem).removeAttr("aria-label"); 496 $(elem).removeAttr("aria-haspopup"); 497 }); 498 499 /** 500 * ================================================================================== 501 * Breadcrumbs 502 * ================================================================================== 503 */ 504 505 //enable clik on last span parent 506 var lastSpanParent = $("#breadcrumbs span").last(); 507 $(lastSpanParent).parent().css("pointer-events", "auto"); 508 509 /** 510 * ================================================================================== 511 * SEARCH 512 * ================================================================================== 513 */ 514 // open 515 $(".search-icon").on("click", function () { 516 disableScroll(); 517 OpenModalSearch003(); 518 519 setTimeout(function () { 520 close_menu_mobile(); 521 }, 300); 522 $("body").css("overflow", "hidden"); 523 524 }); 525 526 // close 527 $(".search-003 .search-003__close").on("click", function () { 528 enableScroll(); 529 CloseModalSearch003() 530 $(".search-wrap").addClass("search-wrap--hidden"); 531 $("body").css("overflow", "auto"); 532 533 $('.search-003 .search-003__form > form input[type="text"]').val(""); 534 // $( '.search-003 .search-003__form' ).removeClass( 'with-content' ); 535 }); 536 537 // Carregar no ESC para fechar pesquisa 538 $(document).keyup(function (e) { 539 if ( 540 e.key === "Escape" && 541 !$("search-wrap").hasClass("search-wrap--hidden") 542 ) { 543 $(".search-003 .search-003__close").click(); 544 } 545 }); 546 547 /** 548 * ================================================================================== 549 * printfriendly -> Acessibility 550 * ================================================================================== 551 */ 552 $('.printfriendly.pf-button a') 553 .attr('aria-label', 'Imprimar esta página') 554 .find('img') 555 .attr({ 556 alt: '', 557 'aria-hidden': 'true' 558 });
559 560 561 /** 562 * ================================================================================== 563 * Translations 564 * ================================================================================== 565 */ 566 567 $(document).ready(function () { 568 // Load Google Translate API 569 const script = document.createElement('script'); 570 script.src = 'https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit'; 571 script.async = true; 572 document.head.appendChild(script); 573 574 // Initialize Google Translate 575 window.googleTranslateElementInit = function () { 576 new google.translate.TranslateElement({ 577 pageLanguage: 'pt', 578 includedLanguages: 'pt,en', 579 layout: google.translate.TranslateElement.InlineLayout.SIMPLE 580 }, 'google_translate_elementTWO'); 581 }; 582 583 // Read cookie 584 function getGoogleTranslateCookie() { 585 const match = document.cookie.match(/(?:^|; )googtrans=([^;]*)/); 586 return match ? match[1] : null; 587 } 588 589 const selects = document.querySelectorAll('.translation-element'); 590 591 selects.forEach(select => { 592 593 const cookie = getGoogleTranslateCookie(); 594 if (cookie) { 595 const parts = cookie.split('/'); 596 const activeLang = parts[2]; 597 598 if (activeLang) { 599 select.value = activeLang; 600 601 const observer = new MutationObserver(() => { 602 603 const gtIframe = document.querySelector('iframe.skiptranslate'); 604 if (gtIframe && !gtIframe.hasAttribute('aria-hidden')) { 605 gtIframe.setAttribute('aria-hidden', 'true'); 606 } 607 608 const gtEl = document.querySelector('#goog-gt-vt'); 609 if (gtEl && !gtEl.hasAttribute('aria-hidden')) { 610 gtEl.setAttribute('aria-hidden', 'true'); 611 } 612 }); 613 614 observer.observe(document.body, { 615 childList: true, 616 subtree: true 617 }); 618 } 619 } 620 621 select.addEventListener('change', function () { 622 const lang = this.value; 623 if (!lang) return; 624 625 // Clean cookies 626 document.cookie = 'googtrans=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/'; 627 document.cookie = 'googtrans=; expires=Thu, 01 Jan 1970 00:00:00 UTC; domain=.ipvc.dev.skillmind.pt; path=/'; 628 629 // Set new language 630 document.cookie = 'googtrans=/pt/' + lang + '; path=/'; 631 632 location.reload(); 633 }); 634 }); 635 636 // Fix body top because of Google Translate Iframe 637 const fixBodyTop = () => { 638 document.body.style.top = '0px'; 639 }; 640 641 const observer = new MutationObserver(() => { 642 if (document.body.style.top !== '0px') { 643 fixBodyTop(); 644 } 645 }); 646 647 observer.observe(document.body, { attributes: true, attributeFilter: ['style'] }); 648 649 }); 650 651 652})(jQuery); 653 654/** 655 * ================================================================================== 656 * Accessibility Header Menu - Mutation Observer to monitor class changes in nested ULs 657 * Sets aria-hidden and aria-expanded true/false accordingly 658 * ================================================================================== 659 */ 660 661(function () { 662 663 const root = document.getElementById('gsk-header-menu-large'); 664 if (!root) return; 665 666 const targetNode = document.getElementById('gsk-header-menu-large'); 667 668 const config = { 669 attributes: true, // Detect attribute changes (including 'class') 670 subtree: true, // Look for changes in all descendants (nested elements) 671 attributeFilter: ['class'] // Only observe changes to the 'class' attribute 672 }; 673 674 const callback = function (mutationsList, observer) { 675 676 for (const mutation of mutationsList) { 677 678 if (mutation.type === 'attributes' && mutation.attributeName === 'class') { 679 680 const targetElement = mutation.target; 681 682 if (targetElement.classList.contains('menu-item-hover')) { 683 684 // const parentElem = targetElement.parentElement; 685 686 const btnElem = targetElement.querySelectorAll(':scope > button'); 687 688 btnElem.forEach(element => { 689 690 element.setAttribute('aria-expanded', 'true'); 691 692 }); 693 694 const submenuElem = targetElement.querySelectorAll(':scope > ul'); 695 696 697 submenuElem.forEach(element => { 698 699 element.setAttribute('aria-hidden', 'false'); 700 701 }); 702 703 } else { 704 705 // const parentElem = targetElement.parentElement; 706 707 const btnElem = targetElement.querySelectorAll(':scope > button'); 708 709 btnElem.forEach(element => { 710 711 element.setAttribute('aria-expanded', 'false'); 712 713 }); 714 715 const submenuElem = targetElement.querySelectorAll(':scope > ul'); 716 717 718 submenuElem.forEach(element => { 719 720 element.setAttribute('aria-hidden', 'true'); 721 722 }); 723 724 } 725 } 726 } 727 }; 728 729 const observer = new MutationObserver(callback); 730 observer.observe(targetNode, config); 731 732})(); 733 734/**
735 * ================================================================================== 736 * Accessibility Mobile Menu - Mutation Observer to monitor class changes in nested ULs 737 * Sets aria-hidden and aria-expanded true/false accordingly 738 * ================================================================================== 739 */ 740 741(function () { 742 743 const root = document.getElementById('gsk-header-menu-mobile'); 744 if (!root) return; 745 746 const targetNodeMob = document.getElementById('gsk-header-menu-mobile'); 747 748 const callbackMob = function (mutationsList) { 749 750 for (const { target, type, attributeName } of mutationsList) { 751 const classList = target.classList; 752 const isActive = classList.contains('visible'); 753 754 // 1. Handle aria-hidden updates 755 if (isActive) { 756 757 target.setAttribute('aria-hidden', 'false'); 758 759 const ulParentMob = target.closest('ul')?.parentElement?.closest('ul'); 760 ulParentMob?.setAttribute('aria-hidden', 'false'); 761 } 762 763 if (classList.contains('main-menu-mobile')) { 764 target.querySelectorAll('[aria-hidden="true"]') 765 .forEach(el => el.setAttribute('aria-hidden', 'false')); 766 } 767 768 // 2. Handle aria-expanded updates 769 if (type === 'attributes' && attributeName === 'class') { 770 771 const parentLi = target.parentElement; 772 if (!parentLi) continue; 773 774 // Remove nonâstandard aria-expanded from <li> 775 parentLi.removeAttribute('aria-expanded'); 776 777 // Only proceed if this <li> contains a direct <ul> 778 const hasDirectChildUl = parentLi.querySelector(':scope > ul') !== null; 779 if (!hasDirectChildUl) continue; 780 781 const linkHref = parentLi.querySelector('a'); 782 if (!linkHref) continue; 783 784 // Determine expanded state based on active classes 785 const isExpanded = 786 classList.contains('is-active') || 787 parentLi.classList.contains('is-active'); 788 789 linkHref.setAttribute('aria-expanded', isExpanded ? 'true' : 'false'); 790 } 791 792 } 793 }; 794 795 const observerMob = new MutationObserver(callbackMob); 796 if (targetNodeMob) { 797 observerMob.observe(targetNodeMob, { 798 attributes: true, 799 subtree: true, 800 attributeFilter: ['class'] 801 }); 802 } 803 804 805})(); 806 807 808/** 809 * ================================================================================== 810 * Accessibility - sets global search modal 811 * ================================================================================== 812 */ 813function OpenModalSearch003() { 814 815 const modal = document.getElementById("searchModal003"); 816 817 if (!modal) { 818 return; 819 } 820 821 modal.removeAttribute("inert"); 822 modal.classList.remove("search-wrap--hidden"); 823 824 825 if (typeof modal.showModal === "function" && !modal.open) { 826 modal.showModal(); 827 828 $('#s003').focus(); 829 } 830} 831 832function CloseModalSearch003() { 833 const modal = document.getElementById('searchModal003'); 834 modal.setAttribute("inert", ""); 835 modal.classList.add('search-wrap--hidden'); 836 const searchOpenButton = document.getElementById('searchModal003'); 837 searchOpenButton.focus(); 838 modal.close(); 839} 840 841/** 842 * ================================================================================== 843 * Accessibility - cookie yes plugin 844 * ================================================================================== 845 */ 846 847 function moveRevisitBtn() { 848 const revisitBtn = document.querySelector('.cky-btn-revisit-wrapper'); 849 const skipLink = document.querySelector('#accessibilityGoMainContent'); 850 851 if (revisitBtn && skipLink) { 852 skipLink.insertAdjacentElement('afterend', revisitBtn); 853 return true; 854 } 855 return false; 856 } 857 858 function fixAccessibilityCookies() { 859 const title = document.querySelector('.cky-title'); 860 const prefTitle = document.querySelector('.cky-preference-title'); 861 862 if (title?.getAttribute('aria-level') === '1') { 863 title.removeAttribute('aria-level'); 864 title.removeAttribute('role'); 865 } 866 867 if (prefTitle?.getAttribute('aria-level') === '1') { 868 prefTitle.removeAttribute('aria-level'); 869 prefTitle.removeAttribute('role'); 870 } 871 } 872 873 function moveRevisitBtn(revisitBtn) { 874 const skipLink = document.querySelector('#accessibilityGoMainContent'); 875 876 if (revisitBtn && skipLink) { 877 skipLink.insertAdjacentElement('afterend', revisitBtn); 878 return true; 879 } 880 return false; 881 } 882 if (!moveRevisitBtn()) { 883 const observer = new MutationObserver(() => { 884 if (moveRevisitBtn()) { 885 clearTimeout(failsafe); 886 observer.disconnect(); 887 }}); 888 889 const failsafe = setTimeout(() => observer.disconnect(), 30000); 890 891 observer.observe(document.body, { childList: true, subtree: true });
892 } 893 894 function initFixesCookies() { 895 896 fixAccessibilityCookies(); 897 898 const consent = document.querySelector('.cky-consent-container'); 899 if (consent !== null) {moveRevisitBtn(consent);} 900 901 const overlay = document.querySelector('.cky-overlay'); 902 if ( overlay !== null) { moveRevisitBtn(overlay); overlay.style.zIndex = '9999999'; } 903 904 const modal = document.querySelector('.cky-modal'); 905 if ( modal !== null) { moveRevisitBtn(modal); } 906 907 } 908 909 document.addEventListener("DOMContentLoaded", function () { 910 let attempts = 0; 911 912 const interval = setInterval(() => { 913 const el = document.querySelector('.cky-consent-bar'); 914 915 if (el !== null) { 916 initFixesCookies(); 917 918 clearInterval(interval); 919 return; 920 } 921 922 attempts++; 923 924 if (attempts > 20) { 925 clearInterval(interval); 926 } 927 }, 500); 928 929 });
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.