1(() => { 2 'use strict'; 3 4 const element = document.querySelector(".globalheader"); 5 const geoipDisabled = document.body.dataset.geoipDisabled === 'true'; 6 7 let retries = 0; 8 window.visitorCountry = ''; 9 10 if (geoipDisabled) { 11 // GeoIP is disabled for this site; skip the external API call entirely. 12 // Dispatch the event immediately so downstream components don't hang waiting. 13 window.dispatchEvent(new CustomEvent('geoip-detected')); 14 } else { 15 const checkLibrary = setInterval(() => { 16 17 if (typeof geoip2 !== 'undefined') { 18 clearInterval(checkLibrary); 19 20 geoip2.country((response) => { 21 window.visitorCountry = response.country.iso_code.toLowerCase(); 22 if (window.visitorCountry !== 'us') { 23 document.body.classList.add('hide-restricted-content'); 24 } 25 else { 26 document.body.classList.remove('hide-restricted-content'); 27 } 28 29 // the components the data is ready 30 window.dispatchEvent(new CustomEvent('geoip-detected')); 31 }, (err) => { 32 console.error("GeoIP API error:", err); 33 window.visitorCountry = 'error'; 34 window.dispatchEvent(new CustomEvent('geoip-detected')); 35 }); 36 37 } else if (retries >= 20) { 38 clearInterval(checkLibrary); 39 window.visitorCountry = 'timeout'; 40 window.dispatchEvent(new CustomEvent('geoip-detected')); 41 } 42 retries++; 43 }, 500); 44 } // end geoipDisabled else 45 46 47 const initializeAudienceLocationDisplay = () => { 48 49 if (!element) return; 50 51 const isEditModeComponent = document.body.classList.contains('is-edit-mode-page'); 52 if (!isEditModeComponent) { 53 54 const labelSelector = '.globalheader__local-settings-btn__label'; 55 let attempts = 0; 56 57 const checkPreferences = setInterval(() => { 58 attempts++; 59 const labelElement = document.querySelector(labelSelector); 60 const prefExists = window.LamCountryPreferences && typeof window.LamCountryPreferences.get === 'function'; 61 62 if (prefExists && labelElement) { 63 const preferencesObj = window.LamCountryPreferences.get(); 64 65 if (preferencesObj) { 66 const { audience, location } = preferencesObj || {}; 67 68 if (audience && location) { 69 labelElement.innerHTML = `<span>${audience}</span> <span>|</span> <span>${location}</span> <span class="icon-chevron-down" data-chevron-icon></span>`; 70 clearInterval(checkPreferences); 71 } 72 73 } 74 } 75 if (attempts > 20) { 76 clearInterval(checkPreferences); 77 } 78 }, 250); 79 } 80 }; 81 82 83 const performNavHiding = () => { 84 if (!element) return; 85 86 const navOption = element.querySelector('[data-syz-hide-handler]'); 87 const provider = (navOption && navOption.dataset.syzHideHandler) 88 || document.body.dataset.clientCountryProvider; 89 const visitorCountry = (window.visitorCountry || '').toLowerCase(); 90 91 if (provider === 'Frontend') { 92 93 const targetTitle = "Lazard US Systematic Small Cap Equity ETF"; 94 const targetPath = "featured/us-systematic-small-cap-equity-etf"; 95 96 const isConfirmedNonUS = visitorCountry !== '' && 97 visitorCountry !== 'us' && 98 visitorCountry !== 'error' && 99 visitorCountry !== 'timeout'; 100 101 if (isConfirmedNonUS) { 102 const allNavLinks = element.querySelectorAll('.globalheader__nav__link a'); 103 104 allNavLinks.forEach(link => { 105 106 const href = link.getAttribute('href') || ''; 107 const title = link.textContent.trim(); 108 if (href.includes(targetPath) || title.includes(targetTitle)) { 109 110 // Identify the container (either the <li> or the Card <a>) 111 const container = link.closest('.globalheader__nav__link'); 112 113 if (container) { 114 container.style.setProperty('display', 'none', 'important'); 115 container.setAttribute('aria-hidden', 'true'); 116 } 117 } 118 }); 119 } 120 } 121}; 122 123 // Execution: Run on the geo-detection event 124 window.addEventListener('geoip-detected', performNavHiding); 125 126 initializeAudienceLocationDisplay() 127 128 129})();
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.