mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Update URL QueryParam when Type set in Dropdown on Web Interface
- This also pushes the updated URL state to history - Allows jumping back to the web interface after clicking on an image and having the type set to image search - Previously type would get reset to the default search type on jumping back
This commit is contained in:
parent
2eae32d743
commit
d0531c3064
1 changed files with 7 additions and 1 deletions
|
@ -121,6 +121,12 @@
|
|||
});
|
||||
}
|
||||
|
||||
function setTypeInQueryParam(type) {
|
||||
var url = new URL(window.location.href);
|
||||
url.searchParams.set("t", type.value);
|
||||
window.history.pushState({}, "", url.href);
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
// Dynamically populate type dropdown based on enabled search types and type passed as URL query parameter
|
||||
populate_type_dropdown();
|
||||
|
@ -140,7 +146,7 @@
|
|||
|
||||
<div id="options">
|
||||
<!--Add Dropdown to Select Query Type -->
|
||||
<select id="type"></select>
|
||||
<select id="type" onchange="setTypeInQueryParam(this)"></select>
|
||||
|
||||
<!--Add Button To Regenerate -->
|
||||
<button id="regenerate" onclick="regenerate()">Regenerate</button>
|
||||
|
|
Loading…
Add table
Reference in a new issue