Vyhledávání nezávislé na diakritice
This commit is contained in:
parent
0f408e2cb9
commit
3f54c2b90a
@ -22,7 +22,7 @@ input.oninput = function() { filter_name(input.value) };
|
|||||||
let articles = document.getElementsByTagName("article");
|
let articles = document.getElementsByTagName("article");
|
||||||
|
|
||||||
function filter_name(str) {
|
function filter_name(str) {
|
||||||
str = str.toLowerCase();
|
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++) {
|
for (let i=0; i<articles.length; i++) {
|
||||||
@ -30,7 +30,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].getElementsByTagName("h3")[0].innerHTML.toLowerCase();
|
let name = articles[i].getElementsByClassName("title")[0].innerHTML.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
||||||
if (!name.includes(str)) {
|
if (!name.includes(str)) {
|
||||||
articles[i].style.display = "none";
|
articles[i].style.display = "none";
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user