1
0
em.0x45.cz/static/js/search.js
2024-10-07 20:55:08 +02:00

12 lines
394 B
JavaScript

function filter_name(str)
{
if (str.length == 0) {
articles.forEach(article => article.style.display = "block");
} else {
articles.forEach(article => article.style.display = article.dataset.title.indexOf(str.toLowerCase()) === -1 ? "none" : "block");
}
}
let articles = Array.from(document.querySelectorAll("article"));
document.querySelector("#search").style.display = "inline-block";