1document.addEventListener('DOMContentLoaded', function() { 2 var editor = document.querySelector('.ct-app'); 3 4 createFootnotesDecorators(); 5 6 if(editor) { 7 document.addEventListener('click', function() { 8 createFootnotesDecorators(); 9 }); 10 11 document.addEventListener('keydown', function() { 12 createFootnotesDecorators(); 13 }); 14 15 document.addEventListener('keyup', function() { 16 createFootnotesDecorators(); 17 }); 18 } 19}); 20 21function createFootnotesDecorators() { 22 var foonotes = document.querySelectorAll('.footnote'); 23 var contentMarks = document.querySelectorAll('.content-mark'); 24 var counter = 1; 25 var itemWidth = 10; 26 var defaultDotsCount = 1; 27 28 Array.prototype.forEach.call(foonotes, function(item) { 29 var foonoteMark = item.querySelector('.footnote__mark'); 30 var nextSibling = item.nextElementSibling; 31 32 if(!foonoteMark) { 33 var span = document.createElement('span'); 34 35 span.classList.add('footnote__mark'); 36 span.style.width = (itemWidth * counter) + 'px'; 37 item.insertBefore(span, item.firstChild); 38 39 if(nextSibling && nextSibling.classList.contains('footnote')) { 40 counter++; 41 } else { 42 counter = 1; 43 } 44 } else { 45 var span = item.querySelector('.footnote__mark'); 46 47 span.style.width = (itemWidth * counter) + 'px'; 48 item.insertBefore(span, item.firstChild); 49 50 if(nextSibling && nextSibling.classList.contains('footnote')) { 51 counter++; 52 } else { 53 counter = 1; 54 } 55 } 56 }); 57 58 Array.prototype.forEach.call(contentMarks, function(item) { 59 var dots = parseInt(item.dataset.dotsCount) || defaultDotsCount; 60 item.style.width = itemWidth * dots + 'px'; 61 }); 62};
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.