1(function() { 2 const navElem = document.getElementById('siteNav'); 3 if (navElem) { 4 const toggle = navElem.querySelector('.nav__toggle'); 5 if (toggle) { 6 toggle.addEventListener('click', function(e) { 7 e.stopPropagation(); 8 const isActive = navElem.classList.toggle('nav_active'); 9 toggle.setAttribute('aria-expanded', String(isActive)); 10 }); 11 document.addEventListener('click', function(e) { 12 if (!navElem.contains(e.target)) { 13 navElem.classList.remove('nav_active'); 14 toggle.setAttribute('aria-expanded', 'false'); 15 } 16 }); 17 } 18 } 19 20 const langElem = document.querySelector('.language'); 21 if (langElem) { 22 const languagesData = langElem.dataset.languages; 23 const currentLang = langElem.dataset.currentLang; 24 const currentPath = langElem.dataset.currentPath; 25 26 if (languagesData) { 27 const languages = JSON.parse(decodeURIComponent(languagesData)); 28 const list = langElem.querySelector('.language__list'); 29 if (list && languages.length > 0) {
30 languages.forEach(function(l) { 31 const a = document.createElement('a'); 32 a.className = 'language__title' + (l.code === currentLang ? ' language__title_selected' : ''); 33 a.href = l.code === 'en' ? currentPath : '/' + l.code + currentPath; 34 a.textContent = l.name; 35 list.appendChild(a); 36 }); 37 } 38 } 39 40 document.addEventListener('click', function(e) { 41 if (!langElem.contains(e.target)) { 42 langElem.classList.remove('language_active'); 43 } else { 44 langElem.classList.toggle('language_active'); 45 } 46 }); 47 } 48 49 const popup = document.getElementById('termsPopup'); 50 const termsLink = document.getElementById('termsLink'); 51 const closeBtn = document.getElementById('termsClose'); 52 const termsContent = document.getElementById('termsContent'); 53 let termsLoaded = false; 54 55 if (popup && termsLink && termsContent) { 56 function openPopup(e) { 57 e.preventDefault(); 58 popup.classList.add('popup_visible'); 59 document.body.style.overflow = 'hidden'; 60 61 if (!termsLoaded) { 62 fetch('/terms') 63 .then(r => r.text()) 64 .then(html => { 65 const doc = new DOMParser().parseFromString(html, 'text/html'); 66 const content = doc.body.innerHTML; 67 termsContent.innerHTML = content; 68 termsLoaded = true; 69 }); 70 } 71 } 72 73 function closePopup() { 74 popup.classList.remove('popup_visible'); 75 document.body.style.overflow = ''; 76 } 77 78 termsLink.addEventListener('click', openPopup); 79 if (closeBtn) closeBtn.addEventListener('click', closePopup); 80 popup.addEventListener('click', function(e) { 81 if (e.target === popup) closePopup(); 82 }); 83 document.addEventListener('keydown', function(e) { 84 if (e.key === 'Escape' && popup.classList.contains('popup_visible')) { 85 closePopup(); 86 } 87 }); 88 } 89})();
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.