remove shys from Search
This commit is contained in:
parent
c616c9d798
commit
95ae0f814c
@ -2,7 +2,6 @@
|
|||||||
import {onMount} from "svelte";
|
import {onMount} from "svelte";
|
||||||
import "$lib/css/nordtheme.css";
|
import "$lib/css/nordtheme.css";
|
||||||
|
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const recipes = document.querySelectorAll(".search_me");
|
const recipes = document.querySelectorAll(".search_me");
|
||||||
const search = document.getElementById("search");
|
const search = document.getElementById("search");
|
||||||
@ -18,7 +17,7 @@ onMount(() => {
|
|||||||
let scrollers = [];
|
let scrollers = [];
|
||||||
// for each recipe hide all but matched
|
// for each recipe hide all but matched
|
||||||
recipes.forEach(recipe => {
|
recipes.forEach(recipe => {
|
||||||
const searchString = `${recipe.textContent} ${recipe.dataset.tags}`.toLowerCase().normalize('NFD').replace(/\p{Diacritic}/gu, "");
|
const searchString = `${recipe.textContent} ${recipe.dataset.tags}`.toLowerCase().normalize('NFD').replace(/\p{Diacritic}/gu, "").replace(/­|/g, '');
|
||||||
const isMatch = searchTerms.every(term => searchString.includes(term));
|
const isMatch = searchTerms.every(term => searchString.includes(term));
|
||||||
|
|
||||||
recipe.style.display = (isMatch ? 'flex' : 'none');
|
recipe.style.display = (isMatch ? 'flex' : 'none');
|
||||||
|
Loading…
Reference in New Issue
Block a user