mirror of
https://github.com/alvierahman90/gronk.git
synced 2024-11-22 07:19:53 +00:00
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()
|
||||
})
|
||||
|
||||
searchBar.addEventListener('change', updateResults)
|
||||
resultsMax.addEventListener('keyup', 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user