take search from query params, add lucky parameter

This commit is contained in:
Akbar Rahman 2021-12-03 20:22:39 +00:00
parent 6d10130155
commit b9404c206c
Signed by: alvierahman90
GPG Key ID: 20609519444A1269

View File

@ -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;
}