take search from query params, add lucky parameter
This commit is contained in:
parent
6d10130155
commit
b9404c206c
12
search.js
12
search.js
@ -97,7 +97,17 @@ searchBar.addEventListener('keyup', e => {
|
|||||||
}
|
}
|
||||||
updateResults()
|
updateResults()
|
||||||
})
|
})
|
||||||
|
|
||||||
searchBar.addEventListener('change', updateResults)
|
searchBar.addEventListener('change', updateResults)
|
||||||
resultsMax.addEventListener('keyup', updateResults)
|
resultsMax.addEventListener('keyup', updateResults)
|
||||||
resultsMax.addEventListener('change', updateResults)
|
resultsMax.addEventListener('change', updateResults)
|
||||||
updateResults()
|
|
||||||
|
const searchParams = new URL(window.location.href).searchParams;
|
||||||
|
searchBar.value = searchParams.get('q');
|
||||||
|
updateResults();
|
||||||
|
|
||||||
|
console.log(results)
|
||||||
|
|
||||||
|
if (searchParams.has('lucky')) {
|
||||||
|
window.location.href = results[0].item.path;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user