1/** 2 * @file 3 * Handles display of accessibility statement link 4 */ 5 6(function ($) { 7 Drupal.behaviors.accessibilityStatement = { 8 attach: function (context, settings) { 9 // Function to handle resizing and showing/hiding the accessibility statement link 10 function handleAccessibilityStatement() { 11 // Check if the dataLayer variable is defined and if drupalCountry is available 12 if (typeof dataLayer !== 'undefined' && dataLayer[0].drupalCountry) { 13 var country = dataLayer[0].drupalCountry; 14 var language = dataLayer[0].drupalLanguage; 15 var browserWidth = window.innerWidth; 16 17 // Replace text for FR translation 18 if((country === 'US' || country === 'CA') && language == 'fr') { 19 $('.accessibility-statement-link').text('Déclaration d\'accessibilité').attr('title', 'Déclaration d\'accessibilité'); 20 } 21 22 // Show accessibility statement link for US and CA only 23 // We're checking browser width as the mobile version is a different section 24 if ((country === 'US' || country === 'CA') && browserWidth >= 1024) { 25 $('.accessibility-statement-link.desktop').show(); 26 $('.accessibility-statement-link.mobile').hide(); 27 } else if((country === 'US' || country === 'CA') && browserWidth < 1024) { 28 $('.accessibility-statement-link.mobile').css('display', 'block'); 29 $('.accessibility-statement-link.desktop').hide(); 30 } else { 31 $('.accessibility-statement-link').hide(); 32 } 33 } 34 } 35 // Call handleAccessibilityStatement on page load 36 $(document).ready(function() { 37 handleAccessibilityStatement(); 38 }); 39 40 // Add event listener for resize event to call handleAccessibilityStatement on browser resize 41 $(window).resize(function() { 42 handleAccessibilityStatement(); 43 }); 44 45 // Handles Accessibility Statement dropdown behavior for mobile 46 function handleMobileAccessibilityLink() { 47 var browserWidth = window.innerWidth; 48 if (browserWidth <= 1024) { 49 $('.accessibility-nav-menu .accessibility-dropdown-trigger').unbind().on('click', function(e){ 50 e.stopPropagation(); 51 $(this).parents().next('#accessibity-dropdown-content').slideToggle(); 52 $(this).parents().closest('.accessibility-nav-menu').toggleClass('open'); 53 return false; 54 }); 55 } 56 } 57 handleMobileAccessibilityLink(); 58 } 59 }; 60 })(jQuery);
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.