Search: enable click only result
This commit is contained in:
parent
9ddafaacca
commit
5c009d74fe
@ -36,9 +36,12 @@ onMount(() => {
|
|||||||
scroller.parentNode.style.display= 'none'
|
scroller.parentNode.style.display= 'none'
|
||||||
})
|
})
|
||||||
scroll
|
scroll
|
||||||
|
let items = document.querySelectorAll(".matched-recipe");
|
||||||
|
items = [...new Set(items)] // make unique as seasonal mediascroller can lead to duplicates
|
||||||
// if only one result and click_only_result is true, click it
|
// if only one result and click_only_result is true, click it
|
||||||
if(click_only_result && scrollers_with_results.length == 1 && scrollers_with_results[0].querySelector(".matched-recipe").length == 1){
|
if(click_only_result && scrollers_with_results.length == 1 && items.length == 1){
|
||||||
scrollers_with_results[0].querySelector(".matched-recipe").click()
|
// add '/rezepte' to history to not force-redirect back to recipe if going back
|
||||||
|
items[0].click();
|
||||||
}
|
}
|
||||||
// if scrollers with results are presenet scroll first result into view
|
// if scrollers with results are presenet scroll first result into view
|
||||||
/*if(scrollers_with_results.length > 0){
|
/*if(scrollers_with_results.length > 0){
|
||||||
|
Loading…
Reference in New Issue
Block a user