_search.js
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Search Filter
import jquery from 'jquery';
var Search = (function($) {
function init() {
$(".searchandfilter ul li:contains('hidden')").hide();
$('<li class="sf-field-reset"><input type="submit" class="search-filter-reset-custom" value="CLEAR ALL" "></li>').appendTo( jQuery( '#advance-search-modal .searchandfilter ul:first-child ' ) );
$(document).on("click", ".search-filter-reset-custom", function(e){
e.preventDefault();
$(this).closest('.searchandfilter')[0].reset();
return false;
});
$(document).on("click", ".search-filter-reset", function(e){
e.preventDefault();
$('.searchandfilter')[0].reset();
return false;
});
$(document).on("click", '#advance-search-modal [name="_sf_submit"]', function(e){
$('#advance-search-modal .searchandfilter').hide();
$('[data-sf-form-id="399"]').trigger("submit");
$('.searching-loading').show();
setTimeout(() => {
window.location.href = window.location.href
}, "1000");
});
$(document).on("click", ".advance-search-button", function(e){
$('#search-box-content').addClass('show');
$('.search-box').addClass('show');
$('.badge').hide();
});
var myModal = document.getElementById('advance-search-modal');
myModal.addEventListener('hidden.bs.modal', function () {
$('#search-box-content').removeClass('show');
$('.search-box').removeClass('show');
$('.badge').show();
})
}
return {
init: init
};
}(jquery));
jquery(document).ready(Search.init);
export { Search };