mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +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:
@@ -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 () {
|
window.onload = function () {
|
||||||
// Dynamically populate type dropdown based on enabled search types and type passed as URL query parameter
|
// Dynamically populate type dropdown based on enabled search types and type passed as URL query parameter
|
||||||
populate_type_dropdown();
|
populate_type_dropdown();
|
||||||
@@ -140,7 +146,7 @@
|
|||||||
|
|
||||||
<div id="options">
|
<div id="options">
|
||||||
<!--Add Dropdown to Select Query Type -->
|
<!--Add Dropdown to Select Query Type -->
|
||||||
<select id="type"></select>
|
<select id="type" onchange="setTypeInQueryParam(this)"></select>
|
||||||
|
|
||||||
<!--Add Button To Regenerate -->
|
<!--Add Button To Regenerate -->
|
||||||
<button id="regenerate" onclick="regenerate()">Regenerate</button>
|
<button id="regenerate" onclick="regenerate()">Regenerate</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user