Compare commits
2 Commits
c8df9a3301
...
e3c620edc9
Author | SHA1 | Date | |
---|---|---|---|
e3c620edc9 | |||
5da3e67a42 |
@ -148,6 +148,7 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% macro print_recipe(recipe) %}
|
{% macro print_recipe(recipe) %}
|
||||||
<article
|
<article data-title="{{ recipe.title | lower }}"
|
||||||
{% if recipe.taxonomies.tagy %}
|
{% if recipe.taxonomies.tagy %}
|
||||||
{% for tag in recipe.taxonomies.tagy %}
|
{% for tag in recipe.taxonomies.tagy %}
|
||||||
{% if tag == "pikantní" %}
|
{% if tag == "pikantní" %}
|
||||||
|
@ -21,6 +21,10 @@ 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 = 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, "");
|
||||||
|
}
|
||||||
|
|
||||||
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, "");
|
||||||
|
|
||||||
@ -30,12 +34,7 @@ function filter_name(str) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (let i=0; i<articles.length; i++) {
|
for (let i=0; i<articles.length; i++) {
|
||||||
let name = articles[i].getElementsByClassName("title")[0].innerHTML.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
articles[i].style.display = !articles[i].dataset.title.includes(str) ? "none" : "flex";
|
||||||
if (!name.includes(str)) {
|
|
||||||
articles[i].style.display = "none";
|
|
||||||
} else {
|
|
||||||
articles[i].style.display = "flex";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user