1
4
Fork 1

Vyhledávání nezávislé na diakritice

master
Emil Miler 3 years ago
parent 0f408e2cb9
commit 3f54c2b90a

@ -22,7 +22,7 @@ input.oninput = function() { filter_name(input.value) };
let articles = document.getElementsByTagName("article");
function filter_name(str) {
str = str.toLowerCase();
str = str.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
if (str.length==0) {
for (let i=0; i<articles.length; i++) {
@ -30,7 +30,7 @@ function filter_name(str) {
}
} else {
for (let i=0; i<articles.length; i++) {
let name = articles[i].getElementsByTagName("h3")[0].innerHTML.toLowerCase();
let name = articles[i].getElementsByClassName("title")[0].innerHTML.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
if (!name.includes(str)) {
articles[i].style.display = "none";
} else {

Loading…
Cancel
Save