Compare commits

...

3 Commits

Author SHA1 Message Date
ad108e5c8d Oprava font-family u vyhledávání
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-12 15:01:41 +01:00
a2b3b189c4 Optimalizace vyhledávání 2022-12-12 15:01:41 +01:00
7ad17b3b30 Clean .gitignore 2022-12-12 15:01:41 +01:00
3 changed files with 5 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
public public
static/processed_images static/processed_images
Makefile
*.swp *.swp

View File

@ -6,6 +6,7 @@
input { input {
padding: .6em 1em; padding: .6em 1em;
font-family: inherit;
font-size: 1em; font-size: 1em;
background: #fff; background: #fff;
border: 1px solid $border; border: 1px solid $border;

View File

@ -19,23 +19,17 @@
<script> <script>
let input = document.getElementById("input"); let input = document.getElementById("input");
input.oninput = function() { filter_name(input.value) }; input.oninput = function() { filter_name(input.value) };
let articles = document.getElementsByTagName("article"); let articles = Array.from(document.getElementsByTagName("article"));
for (let i=0; i<articles.length; i++) { articles.forEach(article => article.dataset.title = article.dataset.title.normalize("NFD").replace(/\p{Diacritic}/gu, ""));
articles[i].dataset.title = articles[i].dataset.title.normalize("NFD").replace(/\p{Diacritic}/gu, "");
}
function filter_name(str) { function filter_name(str) {
str = str.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, ""); str = str.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
if (str.length==0) { if (str.length==0) {
for (let i=0; i<articles.length; i++) { articles.forEach(article => article.style.display = "flex");
articles[i].style.display = "flex";
}
} else { } else {
for (let i=0; i<articles.length; i++) { articles.forEach(article => article.style.display = article.dataset.title.indexOf(str.toLowerCase()) === -1 ? "none" : "flex");
articles[i].style.display = !articles[i].dataset.title.includes(str) ? "none" : "flex";
}
} }
} }
</script> </script>