1((function(){ 2 if (!Element.prototype.matches) { 3 Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 4 } 5 var findAncestor = function(el, selector) { 6 while ((el = el.parentElement) && !((el.matches || el.matchesSelector).call(el, selector))) {} 7 return el; 8 }; 9 10 var fields = document.querySelectorAll('input[name="searchfield"][data-search-input]'); 11 Array.prototype.forEach.call(fields, function(field) { 12 var form = findAncestor(field, 'form[data-simplesearch-form]'), 13 min = field.getAttribute('data-min') || false, 14 location = field.getAttribute('data-search-input'), 15 separator = field.getAttribute('data-search-separator'); 16 17 if (min) { 18 var invalid = field.getAttribute('data-search-invalid'); 19 field.addEventListener('keydown', function() { 20 field.setCustomValidity(field.value.length >= min ? '' : invalid); 21 }); 22 } 23 24 form.addEventListener('submit', function(event) { 25 event.preventDefault(); 26 27 if (field.checkValidity()) { 28 window.location.href = location + separator + field.value; 29 } 30 }); 31 }); 32})());
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.