diff --git a/site/assets/companies-table.js b/site/assets/companies-table.js index 22b5fb12..9b271482 100644 --- a/site/assets/companies-table.js +++ b/site/assets/companies-table.js @@ -17,9 +17,19 @@ function setupSearch() { searchExplanation.id = 'search-explanation'; searchExplanation.innerHTML = ( 'Use the text box above to search all of our company data.' + + ' You can also ' + + 'search for incomplete company profiles.' ); table.parentNode.insertBefore( searchExplanation, table ); + document.getElementById( 'search-incomplete' ) + .addEventListener( 'click', function( event ) { + event.preventDefault(); + searchInput.value = '_incomplete'; + initializeSearch(); + updateSearch(); + } ); + var searchLoading = false; var searchData = null; var searchIndex = null; @@ -155,7 +165,7 @@ function setupSearch() { } ); } - searchInput.addEventListener( 'focus', function() { + function initializeSearch() { if ( searchData || searchLoading ) { return; } @@ -189,7 +199,9 @@ function setupSearch() { }; xhr.send(); - } ); + } + + searchInput.addEventListener( 'focus', initializeSearch ); searchInput.addEventListener( 'keyup', function() { if ( updateTimeout ) {