taxongraph-view/search-taxon-graph.js @ 3406fef9
1 |
$(function(){ |
---|---|
2 |
|
3 |
$('#search-input').on("input", function(){ |
4 |
let text = $( this ).val(); |
5 |
if(text.length > 3){ |
6 |
let regex = new RegExp(text); |
7 |
let nodes = cy.filter( function(element, i){ |
8 |
return element.isNode() && element.data("label").match(regex) !== null; |
9 |
});
|
10 |
nodes.select(); |
11 |
cy.fit(nodes); |
12 |
} else { |
13 |
cy.collection().select(); |
14 |
cy.fit(); |
15 |
}
|
16 |
|
17 |
});
|
18 |
});
|