Compare commits
No commits in common. "ad108e5c8db3740eaff5582217e51bc888ae2b42" and "c17b36ae8d3c362cfd7f72b5d142d9be0eb32fef" have entirely different histories.
ad108e5c8d
...
c17b36ae8d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
public
|
public
|
||||||
static/processed_images
|
static/processed_images
|
||||||
|
Makefile
|
||||||
*.swp
|
*.swp
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
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;
|
||||||
|
@ -19,17 +19,23 @@
|
|||||||
<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 = Array.from(document.getElementsByTagName("article"));
|
let articles = document.getElementsByTagName("article");
|
||||||
|
|
||||||
articles.forEach(article => article.dataset.title = article.dataset.title.normalize("NFD").replace(/\p{Diacritic}/gu, ""));
|
for (let i=0; i<articles.length; i++) {
|
||||||
|
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) {
|
||||||
articles.forEach(article => article.style.display = "flex");
|
for (let i=0; i<articles.length; i++) {
|
||||||
|
articles[i].style.display = "flex";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
articles.forEach(article => article.style.display = article.dataset.title.indexOf(str.toLowerCase()) === -1 ? "none" : "flex");
|
for (let i=0; i<articles.length; i++) {
|
||||||
|
articles[i].style.display = !articles[i].dataset.title.includes(str) ? "none" : "flex";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user