Skip to content

Commit

Permalink
feat: make search case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikael Olausson committed Apr 16, 2021
1 parent 0c737fe commit 76cba5e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions public/js/avrodoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,20 @@ function AvroDoc(input_schemata) {
}

function search(text, showNamespace) {
text = text.toLowerCase()
console.log("Calling search", text, showNamespace);
var schemas = $(".schema").map(function(index, e){
var el = $(e);
return {name: el.data("schema"), element: el, namespaceElement: el.parent()};
});
schemas.each(function(index, schema) {
if (schema.namespaceElement.data("schemas").includes(text) || schema.namespaceElement.data("namespace").includes(text)) {
if (schema.namespaceElement.data("schemas").toLowerCase().includes(text)
|| schema.namespaceElement.data("namespace").toLowerCase().includes(text)) {
schema.namespaceElement.show();

if (showNamespace) {
schema.element.show();
} else if (schema.name.includes(text)) {
} else if (schema.name.toLowerCase().includes(text)) {
schema.element.show();
} else {
schema.element.hide();
Expand Down

0 comments on commit 76cba5e

Please sign in to comment.