mirror of
https://github.com/searxng/searxng.git
synced 2024-12-22 17:26:30 +00:00
[fix] settings: javascript crash when entering due to missing search form
This commit is contained in:
parent
8d2c01e4ce
commit
c8e932647b
1 changed files with 14 additions and 12 deletions
|
@ -186,20 +186,22 @@
|
||||||
|
|
||||||
// override form submit action to update the actually selected categories
|
// override form submit action to update the actually selected categories
|
||||||
const form = d.querySelector("#search");
|
const form = d.querySelector("#search");
|
||||||
searxng.on(form, 'submit', (event) => {
|
if (form != null) {
|
||||||
event.preventDefault();
|
searxng.on(form, 'submit', (event) => {
|
||||||
const categoryValuesInput = d.querySelector("#selected-categories");
|
event.preventDefault();
|
||||||
if (categoryValuesInput) {
|
const categoryValuesInput = d.querySelector("#selected-categories");
|
||||||
let categoryValues = [];
|
if (categoryValuesInput) {
|
||||||
for (let categoryButton of categoryButtons) {
|
let categoryValues = [];
|
||||||
if (categoryButton.classList.contains("selected")) {
|
for (let categoryButton of categoryButtons) {
|
||||||
categoryValues.push(categoryButton.name.replace("category_", ""));
|
if (categoryButton.classList.contains("selected")) {
|
||||||
|
categoryValues.push(categoryButton.name.replace("category_", ""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
categoryValuesInput.value = categoryValues.join(",");
|
||||||
}
|
}
|
||||||
categoryValuesInput.value = categoryValues.join(",");
|
form.submit();
|
||||||
}
|
});
|
||||||
form.submit();
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})(window, document, window.searxng);
|
})(window, document, window.searxng);
|
||||||
|
|
Loading…
Reference in a new issue