1jQuery(document).ready(oxygen_init_toc); 2function oxygen_init_toc($) { 3 4 5 $('.oxy-table-of-contents').each(function(i, oxyToc){ 6 7 var toc = $(oxyToc), 8 tocID = toc.attr('ID'), 9 inner = toc.children('.oxy-table-of-contents_inner'), 10 dropdownIcon = inner.data('dropdown'), 11 contentSelector = inner.data('content'), 12 contextIcon = inner.data('context-icon'), 13 headingSelector = inner.data('headings'); 14 15 // For removing the focus styles on the headings. 16 $(contentSelector).attr('data-toc-container',tocID); 17 18 19 // context icon 20 inner.find('.oxy-table-of-contents_link').prepend('<span class=\"oxy-table-of-contents_context-icon\"><svg><use xlink:href=\"#' + dropdownIcon + '\"></use></svg></span>'); 21 22 23 // If icon 24 if (typeof dropdownIcon !== 'undefined') { 25 26 inner.find('.oxy-table-of-contents_list').prev('.oxy-table-of-contents_link').append('<span class=\"oxy-table-of-contents_dropdown-icon\"><svg><use xlink:href=\"#' + dropdownIcon + '\"></use></svg></span>') 27 28 }; 29 30 31 $(this).children('.oxy-table-of-contents_title').on( 'click', function(e) { 32 33 if (!$('body').hasClass('.oxygen-builder-body')) { 34 35 toc.toggleClass('oxy-table-of-contents_toggled'); 36 37 inner.slideToggle(inner.data('animation-duration')); 38 39 } 40 } ); 41 42 43 // Add ID's dynamically for headings inside content. 44 if ( true === inner.data('autoid') ) { 45 46 let headingsArray = headingSelector.split(','); 47 let contentHeadingSelector = headingsArray.map(i => contentSelector + ' ' + i); 48 let contentHeadingSelectors = $(contentHeadingSelector.join(", ")); 49 50 let tocIDNumbers = tocID.replace(/[^0-9]/g,''); 51 52 let currentIDs = []; 53 54 $.each(contentHeadingSelectors , function(index, val) { 55 56 if (!val.hasAttribute("id")) { 57 58 if ( 'text' !== inner.data('autoid-type') ) { 59 60 $(val).attr('id', inner.data('prefix') + tocIDNumbers + '-' + index); 61 62 } else { 63 64 let headingText = val.innerText.toLowerCase().replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '').replace(/ +/g, '-'); 65 66 if ( !currentIDs.includes(headingText) ) { 67 val.setAttribute('id', headingText ); 68 currentIDs.push(headingText); 69 } else { 70 71 let newID = headingText + '-' + (currentIDs.filter((v) => ( 72 v === headingText)).length 73 ); 74 val.setAttribute('id', newID); 75 currentIDs.push(headingText) 76 77 } 78 79 80 } 81 82 } 83 84 }); 85 86 } 87 88 // Add Links dynamically for headings inside content. 89 if ( true === inner.data('autolink') ) { 90 91 let headingsArray = headingSelector.split(','); 92 let contentHeadingSelector = headingsArray.map(i => contentSelector + ' ' + i); 93 let contentHeadingSelectors = $(contentHeadingSelector.join(", ")); 94 let linkIcon = inner.data('linkicon'); 95 96 $.each(contentHeadingSelectors , function(index, val) { 97 98 let id = $(val).attr('id'); 99 let link = '#' + id; 100 $(val).addClass('oxy-tbc-copy-link'); 101 102 if ($('html').attr('ng-app') == 'CTFrontendBuilder') return; 103 104 if (!$(val).has( ".oxy-tbc-copy-id" ).length) { 105 $(val).append( "<button class='oxy-tbc-copy-id'><svg class=\"oxy-table-of-contents_heading-icon\"><use xlink:href=\"#" + linkIcon + "\"></use></svg></button>" ); 106 } 107 108 }); 109 110 111 function copyIDToClipboard(element) { 112 var $temp = $("<input>"); 113 $("body").append($temp); 114 $temp.val(element).select(); 115 document.execCommand("copy"); 116 $temp.remove(); 117 } 118 119 120 $( contentSelector ).on( "click", ".oxy-tbc-copy-id", function() { 121 122 let hashID = window.location.origin + window.location.pathname + '#' + $(this).closest('.oxy-tbc-copy-link').attr('id'); 123 copyIDToClipboard(hashID); 124 125 }); 126 127 } 128 129 if ( $(inner.data('content')).length ) { 130 131 tocbot.init({ 132 tocSelector: '#' + tocID + ' .oxy-table-of-contents_inner', 133 contentSelector: inner.data('content'), 134 headingSelector: inner.data('headings'), 135 ignoreSelector: inner.data('ignore'), 136 collapseDepth: 6 - inner.data('collapse'), 137 scrollSmooth: inner.data('scroll'), 138 scrollSmoothDuration: inner.data('scroll-duration'), 139 scrollSmoothOffset: 0 - inner.data('scroll-offset'), 140 headingsOffset: inner.data('scroll-offset'), 141 hasInnerContainers: true, 142 throttleTimeout: 20, 143 positionFixedSelector: ('scroll' === inner.data('positioning')) ? '#' + tocID : null, 144 positionFixedClass: 'oxy-table-of-contents_fixed', 145 listClass: 'oxy-table-of-contents_list', 146 listItemClass: 'oxy-table-of-contents_list-item', 147 linkClass: 'oxy-table-of-contents_link', 148 includeHtml: false, 149 150 }); 151 152 } else { 153 tocbot.destroy(); 154 } 155 156 //add context area 157 inner.find('.oxy-table-of-contents_link').prepend('<span class="oxy-table-of-contents_context-icon"><svg class=""><use xlink:href="#' + contextIcon + '"></use></svg></span>'); 158 159 }); 160 161}
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.