mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Only set query field when appropriate query param passed via URL
- Setting query value to default option when query param wasn't passed via URL was overriding placeholder text in query field - We wanted placeholder text in field, not the query field to actually be populated by placeholder text - This clears field when user starts typing query into the query field, instead of them having to manually delete the default text populated
This commit is contained in:
@@ -85,7 +85,10 @@
|
||||
// Fill search form with values passed in URL query parameters, if any.
|
||||
window.onload = function () {
|
||||
document.getElementById("type").value = new URLSearchParams(window.location.search).get("t") || "org";
|
||||
document.getElementById("query").value = new URLSearchParams(window.location.search).get("q") || "What is the meaning of life?";
|
||||
var query_via_url = new URLSearchParams(window.location.search).get("q");
|
||||
if (query_via_url) {
|
||||
document.getElementById("query").value = query_via_url;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user