Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit c83007a6 authored by Adam Tauber's avatar Adam Tauber Committed by GitHub
Browse files

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

Consider HTTP request when running search categories on select is ena…
parents 08c13daf 4ec2fab5
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -6,19 +6,37 @@ $(document).ready(function() {
            });
            $(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;
}