mirror of
https://github.com/searxng/searxng.git
synced 2024-09-19 19:50:19 +02:00
4ec2fab583
Closes #1138
43 lines
1.4 KiB
JavaScript
43 lines
1.4 KiB
JavaScript
$(document).ready(function() {
|
|
if($('#q').length) {
|
|
$('#categories label').click(function(e) {
|
|
$('#categories input[type="checkbox"]').each(function(i, checkbox) {
|
|
$(checkbox).prop('checked', false);
|
|
});
|
|
$(document.getElementById($(this).attr("for"))).prop('checked', true);
|
|
if($('#q').val()) {
|
|
if (getHttpRequest() == "GET") {
|
|
$('#search_form').attr('action', $('#search_form').serialize());
|
|
}
|
|
$('#search_form').submit();
|
|
}
|
|
return false;
|
|
});
|
|
$('#time-range').change(function(e) {
|
|
if($('#q').val()) {
|
|
if (getHttpRequest() == "GET") {
|
|
$('#search_form').attr('action', $('#search_form').serialize());
|
|
}
|
|
$('#search_form').submit();
|
|
}
|
|
});
|
|
$('#language').change(function(e) {
|
|
if($('#q').val()) {
|
|
if (getHttpRequest() == "GET") {
|
|
$('#search_form').attr('action', $('#search_form').serialize());
|
|
}
|
|
$('#search_form').submit();
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
function getHttpRequest() {
|
|
httpRequest = "POST";
|
|
urlParams = new URLSearchParams(window.location.search);
|
|
if (urlParams.has('method')) {
|
|
httpRequest = urlParams.get('method');
|
|
}
|
|
return httpRequest;
|
|
}
|