Optimalizace vyhledávání

This commit is contained in:
Emil Miler 2021-12-07 18:17:40 +01:00
parent 73e50a719c
commit fb740e8639

View File

@ -4,7 +4,7 @@
<main>
<h2>Hledání a filtry</h2>
<div class="filters">
<input type="text" placeholder="Název" oninput="filter_name(this.value)">
<input type="text" placeholder="Název" id="input">
</div>
<section class="list">
{% set section = get_section(path="_index.md") %}
@ -17,8 +17,11 @@
{% block script %}
<script>
function filter_name(str) {
let input = document.getElementById("input");
input.oninput = function() { filter_name(input.value) };
let articles = document.getElementsByTagName("article");
function filter_name(str) {
str = str.toLowerCase();
if (str.length==0) {