Skip to content

Commit

Permalink
Merge pull request #26 from micronaut-projects/search
Browse files Browse the repository at this point in the history
Add basic search/filtering
  • Loading branch information
melix authored Apr 26, 2023
2 parents c268e98 + d91ebff commit b464e8f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions buildSrc/src/main/resources/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,29 @@
}
showImage(document.getElementsByClassName("item")[0], "build-order.png");

// Basic filtering with no ui... just type things
let search = '';
function filter(text) {
Array.from(document.getElementsByClassName("item")).forEach(li => {
const cell = li.getElementsByTagName("td");
if (cell.length === 0) {
// Not a module...
} else if (cell[0].innerText.includes(text) || text === null) {
// make li visible
li.style.display = "block";
} else {
li.style.display = "none";
}
});
}
document.addEventListener("keydown", event => {
if (event.keyCode >= 65 && event.keyCode <= 90) {
search = (search == null ? '' : search) + event.key;
} else {
search = null;
}
filter(search);
});
</script>
</body>
</html>

0 comments on commit b464e8f

Please sign in to comment.