on master help sign in
Merge pull request #2006 from kvch/fix-search-on-category-select-considet-method

Consider HTTP request when running search categories on select is ena…

commitc83007a6bcd2a7f765e7655b91cc6714fbc4ab01 authorAdam Tauber <asciimoo@gmail.com> dateThu 18 Jun 2020, 23:10 (6 years ago) parent08c13da4ec2fab
1 file changed+18
searx/static/plugins/js/search_on_category_select.js+18
searx/static/plugins/js/search_on_category_select.js+18
@@ -6,19 +6,37 @@ $(document).ready(function() {
66 });
77 $(document.getElementById($(this).attr("for"))).prop('checked', true);
88 if($('#q').val()) {
9+ if (getHttpRequest() == "GET") {
10+ $('#search_form').attr('action', $('#search_form').serialize());
11+ }
912 $('#search_form').submit();
1013 }
1114 return false;
1215 });
1316 $('#time-range').change(function(e) {
1417 if($('#q').val()) {
18+ if (getHttpRequest() == "GET") {
19+ $('#search_form').attr('action', $('#search_form').serialize());
20+ }
1521 $('#search_form').submit();
1622 }
1723 });
1824 $('#language').change(function(e) {
1925 if($('#q').val()) {
26+ if (getHttpRequest() == "GET") {
27+ $('#search_form').attr('action', $('#search_form').serialize());
28+ }
2029 $('#search_form').submit();
2130 }
2231 });
2332 }
2433});
34+
35+function getHttpRequest() {
36+ httpRequest = "POST";
37+ urlParams = new URLSearchParams(window.location.search);
38+ if (urlParams.has('method')) {
39+ httpRequest = urlParams.get('method');
40+ }
41+ return httpRequest;
42+}