1jQuery(document).ready(function ($) { 2 table_of_content(); 3 4 function table_of_content() { 5 if(jQuery('.table_of_content_body ul li').length <= 0) { 6 var header = jQuery('.post-text').find(':header:not("h1"):not(".ct")'); 7 var table_of_content = jQuery('.table_of_content_body ul'); 8 header.each(function () { 9 var _this = jQuery(this); 10 if (!_this.attr('id')) { 11 var id = _this.text().replace(/[^A-Z0-9]/ig, "_"); 12 _this.attr('id', id); 13 } 14 var tag = _this.prop('tagName'); 15 if (tag) { 16 if (tag === 'H2') { 17 table_of_content.append("<li><a href='#" + _this.attr('id') + "'>" + _this.text().replace('⦠','') + "</a></li>"); 18 } else { 19 table_of_content.append("<li class='child_li'><a href='#" + _this.attr('id') + "'>" + _this.text().replace('⦠','') + "</a></li>"); 20 } 21 } 22 }); 23 24 window.addEventListener('scroll', function() { 25 header.each(function() { 26 var _this = jQuery(this); 27 if (isScrolledIntoView(_this)) { 28 var id = _this.attr('id'); 29 table_of_content.find('li a').removeClass('active'); 30 table_of_content.find('li a[href="#'+id+'"]').addClass('active'); 31 } 32 }); 33 }); 34 35 function isScrolledIntoView(elem) { 36 var docViewTop = jQuery(window).scrollTop(); 37 var docViewBottom = docViewTop + jQuery(window).height(); 38 39 var elemTop = jQuery(elem).offset().top + 290; 40 var elemBottom = elemTop + jQuery(elem).height(); 41 42 return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); 43 } 44 } 45 } 46 47 jQuery('.nsbp-hero-content .table_of_content_section .table_of_content_head').on('click', function () { 48 jQuery(this).toggleClass('sp-hide'); 49 }); 50});
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.