1(function () { 2 function nodeListToArray(nodeList) { 3 return Array.prototype.slice.call(nodeList); 4 } 5 6 function sel(selector) { 7 return nodeListToArray(document.querySelectorAll(selector)); 8 } 9 10 function pageForms() { 11 return sel("form"); 12 } 13 14 function inputsWithError(forms) { 15 var arrOfFormInputs = forms.map(function (form) { 16 var inputs = nodeListToArray(form.querySelectorAll('[data-error]')); 17 18 return inputs; 19 }); 20 21 return Array.prototype.concat.apply([], arrOfFormInputs); 22 } 23 24 function transformInputs(inputs) { 25 inputs.forEach(function (input) { 26 var errorContainer = document.createElement("div"); 27 errorContainer.classList.add("jquery-validate-error"); 28 errorContainer.classList.add("help-block"); 29 errorContainer.textContent = input.getAttribute("data-error"); 30 errorContainer.setAttribute("for", input.id); 31 32 input.parentElement.parentElement.classList.add("has-error"); 33 input.parentElement.appendChild(errorContainer); 34 }); 35 } 36 37 // main 38 transformInputs( 39 inputsWithError(pageForms()) 40 ); 41}());
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.