From 95ae0f814ce52b1227c93cf150f61c45ed3cd6ab Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Wed, 10 Jan 2024 10:55:59 +0100 Subject: [PATCH] remove shys from Search --- src/lib/components/Search.svelte | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/components/Search.svelte b/src/lib/components/Search.svelte index cca9d4c..72d450c 100644 --- a/src/lib/components/Search.svelte +++ b/src/lib/components/Search.svelte @@ -2,7 +2,6 @@ import {onMount} from "svelte"; import "$lib/css/nordtheme.css"; - onMount(() => { const recipes = document.querySelectorAll(".search_me"); const search = document.getElementById("search"); @@ -10,7 +9,7 @@ onMount(() => { function do_search(click_only_result=false){ // grab search input value - const searchText = search.value.toLowerCase().trim().normalize('NFD').replace(/\p{Diacritic}/gu, ""); + const searchText = search.value.toLowerCase().trim().normalize('NFD').replace(/\p{Diacritic}/gu, ""); const searchTerms = searchText.split(" "); const hasFilter = searchText.length > 0; @@ -18,7 +17,7 @@ onMount(() => { let scrollers = []; // for each recipe hide all but matched 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)); recipe.style.display = (isMatch ? 'flex' : 'none');