1
0
em.0x45.cz/static/js/search.js

17 lines
470 B
JavaScript
Raw Normal View History

2021-12-04 22:10:40 +01:00
function filter_name(str)
{
if (str.length == 0) {
for (let i = 0; i < articles.length; i++) {
articles[i].style.display = "block";
}
} else {
2022-09-30 19:19:59 +02:00
str = str.toLowerCase();
2021-12-04 22:10:40 +01:00
for (let i = 0; i < articles.length; i++) {
2022-09-30 19:19:59 +02:00
articles[i].style.display = !articles[i].dataset.title.includes(str) ? "none" : "block";
2021-12-04 22:10:40 +01:00
}
}
}
let articles = document.getElementsByTagName("article");
let search = document.getElementById("search");
search.style.display = "inline-block";