Commit 52adeff1 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fixed csp error in filter change events

parent 7cb95e73
......@@ -15,6 +15,7 @@ document.addEventListener("DOMContentLoaded", (event) => {
});
function initialize() {
submitFilterOnChange();
botProtection();
enableFormResetter();
loadMoreResults();
......@@ -25,6 +26,29 @@ function initialize() {
let link, newtab, top;
let verifying = false;
function submitFilterOnChange() {
// All normal select fields
document.querySelectorAll("#options #options-box select").forEach((value, index) => {
value.addEventListener("change", e => e.target.form.submit());
});
// Custom date picker
document.querySelector("#options #options-box input[name=fc]").addEventListener("change", e => {
if (!e.target.checked) {
e.target.form.submit();
}
})
// Custom date selected
document.querySelectorAll("#options #options-box input[name=ff], #options #options-box input[name=ft]").forEach((value, index) => {
value.addEventListener("change", e => {
let ff_value = document.querySelector("#options #options-box input[name=ff]").value;
let ft_value = document.querySelector("#options #options-box input[name=ft]").value;
if (ff_value != '' && ft_value != '') {
e.target.form.submit();
}
});
});
}
function botProtection() {
document.querySelectorAll(".result a").forEach((element) => {
element.addEventListener("click", verify_link);
......
......@@ -44,11 +44,11 @@
<img src="/img/icon-settings.svg"alt="" aria-hidden="true"id="result-img-settings">
</label>
</div>
<input id="custom-date" type="checkbox" form="searchForm" @if(Request::input('fc', "off") === "on")checked @endif name="fc" onchange="if(!this.checked){this.form.submit()}"/>
<input id="custom-date" type="checkbox" form="searchForm" @if(Request::input('fc', "off") === "on")checked @endif name="fc"/>
@else
</div>
@endif
<select name="{{$filter->{'get-parameter'} }}" class="custom-select custom-select-sm" form="searchForm" onchange="this.form.submit()">
<select name="{{$filter->{'get-parameter'} }}" class="custom-select custom-select-sm" form="searchForm">
@foreach($filter->values as $value => $text)
@if($value === "nofilter" && Cookie::get($metager->getFokus() . "_setting_" . $filter->{"get-parameter"}) !== null)
<option value="off" @if(empty($filter->value) || $filter->value === "off")selected @endif>{{trans($text)}}</option>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment