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