1
0
em.0x45.cz/static/js/search.js
2022-09-30 22:05:25 +02:00

17 lines
470 B
JavaScript

function filter_name(str)
{
if (str.length == 0) {
for (let i = 0; i < articles.length; i++) {
articles[i].style.display = "block";
}
} else {
str = str.toLowerCase();
for (let i = 0; i < articles.length; i++) {
articles[i].style.display = !articles[i].dataset.title.includes(str) ? "none" : "block";
}
}
}
let articles = document.getElementsByTagName("article");
let search = document.getElementById("search");
search.style.display = "inline-block";