Compare commits
3 Commits
c17b36ae8d
...
ad108e5c8d
Author | SHA1 | Date | |
---|---|---|---|
ad108e5c8d | |||
a2b3b189c4 | |||
7ad17b3b30 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
public
|
||||
static/processed_images
|
||||
Makefile
|
||||
*.swp
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
input {
|
||||
padding: .6em 1em;
|
||||
font-family: inherit;
|
||||
font-size: 1em;
|
||||
background: #fff;
|
||||
border: 1px solid $border;
|
||||
|
@ -19,23 +19,17 @@
|
||||
<script>
|
||||
let input = document.getElementById("input");
|
||||
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[i].dataset.title = articles[i].dataset.title.normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
||||
}
|
||||
articles.forEach(article => article.dataset.title = article.dataset.title.normalize("NFD").replace(/\p{Diacritic}/gu, ""));
|
||||
|
||||
function filter_name(str) {
|
||||
str = str.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
||||
|
||||
if (str.length==0) {
|
||||
for (let i=0; i<articles.length; i++) {
|
||||
articles[i].style.display = "flex";
|
||||
}
|
||||
articles.forEach(article => article.style.display = "flex");
|
||||
} else {
|
||||
for (let i=0; i<articles.length; i++) {
|
||||
articles[i].style.display = !articles[i].dataset.title.includes(str) ? "none" : "flex";
|
||||
}
|
||||
articles.forEach(article => article.style.display = article.dataset.title.indexOf(str.toLowerCase()) === -1 ? "none" : "flex");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user