1(function() { 2 var addClassToNumbers; 3 4 addClassToNumbers = function(parentClass, numberClass) { 5 var element, elements, html, i, len, newHtml, regex, results; 6 elements = document.querySelectorAll(`.${parentClass}`); 7 regex = /\b\d{1,3}(?:,\d{3})*(?:\.\d+)?\b/g; 8 results = []; 9 for (i = 0, len = elements.length; i < len; i++) { 10 element = elements[i]; 11 html = element.innerHTML; 12 newHtml = html.replace(regex, function(match) { 13 return `<span class='${numberClass}'>${match}</span>`; 14 }); 15 results.push(element.innerHTML = newHtml); 16 } 17 return results; 18 }; 19 20 // Usage 21 addClassToNumbers("topten", "number"); 22 23}).call(this);
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.