1$(function(){ 2 const target = document.querySelector('#article-menu'); 3 if (target) { 4 const 5 output = document.createDocumentFragment(), 6 headers = document.querySelectorAll('.text-block h2, .text-block h3, .text-block h4'), 7 wrapper = document.createElement('div'), 8 title = document.createElement('div'), 9 ol = document.createElement('ul') 10 wrapper.classList.add('article-contents'); 11 title.classList.add('article-contents__title'); 12 title.classList.add('h4'); 13 title.textContent = 'Ðглавление:'; 14 output.appendChild(wrapper); 15 wrapper.appendChild(title); 16 wrapper.appendChild(ol); 17 ol.classList.add('article-contents__nav'); 18 headers.forEach(function(item, index) { 19 const li = document.createElement('li'), 20 link = document.createElement('a'); 21 22 if (item.id === '') { 23 item.id = 'id-' + index; 24 } 25 26 link.setAttribute('data-id', item.id); 27 link.href = location.href.split('#')[0] + '#' + item.id; 28 link.textContent = item.textContent; 29 li.appendChild(link); 30 ol.appendChild(li); 31 }); 32 target.append(output); 33 34 $(document).on('click', '.article-contents li a', function(e) { 35 e.preventDefault(); 36 const id = $(this).data('id'); 37 $("html, body").animate({ 38 scrollTop: $(`#${id}`).offset().top - 100 39 }, { 40 duration: 370, 41 easing: "linear" 42 }); 43 }); 44 } 45});
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.