75 lines
2.3 KiB
JavaScript
75 lines
2.3 KiB
JavaScript
// SEARCH
|
|
var searchNav = false;
|
|
var searchList = false;
|
|
|
|
$(document).ready( function() {
|
|
searchNav = $("div.search-container > div.leftCol");
|
|
searchList = $("div.search-list");
|
|
if(searchNav.length>0 && searchList.length>0) initSearch();
|
|
})
|
|
|
|
function initSearch() {
|
|
// console.log("INIT SEARCH !");
|
|
|
|
// FILTRE UNIVERS
|
|
var filtreUnivers = searchNav.find("select[name=univers]");
|
|
if(filtreUnivers.length>0) filtreUnivers.change(function(e) {
|
|
$(this).blur();
|
|
document.location = "?filtre_univers="+$(this).val();
|
|
});
|
|
|
|
// FILTRE CATEGORY
|
|
var filtreCategory = searchNav.find("select[name=category]");
|
|
if(filtreCategory.length>0) filtreCategory.change(function(e) {
|
|
$(this).blur();
|
|
document.location = "?filtre_category="+$(this).val();
|
|
});
|
|
|
|
// FILTRE FAMILY
|
|
var filtreFamily = searchNav.find("select[name=family]");
|
|
if(filtreFamily.length>0) filtreFamily.change(function(e) {
|
|
$(this).blur();
|
|
document.location = "?filtre_family="+$(this).val();
|
|
});
|
|
|
|
// FILTRE GROUP
|
|
var filtreGroup = searchNav.find("select[name=group]");
|
|
if(filtreGroup.length>0) filtreGroup.change(function(e) {
|
|
$(this).blur();
|
|
document.location = "?filtre_group="+$(this).val();
|
|
});
|
|
|
|
// FILTRE TYPE
|
|
var filtreType = searchNav.find("select[name=type]");
|
|
if(filtreType.length>0) filtreType.change(function(e) {
|
|
$(this).blur();
|
|
document.location = "?filtre_type="+$(this).val();
|
|
});
|
|
|
|
// FILTRE ORIGIN
|
|
var filtreOrigin = searchNav.find("select[name=origin]");
|
|
if(filtreOrigin.length>0) filtreOrigin.change(function(e) {
|
|
$(this).blur();
|
|
document.location = "?filtre_origin="+$(this).val();
|
|
});
|
|
|
|
// FILTRE PRODUCER
|
|
var filtreProducer = searchNav.find("select[name=producer]");
|
|
if(filtreProducer.length>0) filtreProducer.change(function(e) {
|
|
$(this).blur();
|
|
document.location = "?filtre_producer="+$(this).val();
|
|
});
|
|
|
|
// AUTO-RESIZE SEARCH
|
|
$(window).on("resize", function(e) { resizeSearch(); });
|
|
resizeSearch();
|
|
}
|
|
|
|
function resizeSearch() {
|
|
var h = $(window).height();
|
|
if($(window).width()>1260) h -= 78;
|
|
else h -= 78;
|
|
// console.log("RESIZE SEARCH !", h);
|
|
searchNav.css("height", h+"px");
|
|
searchList.css("height", h+"px");
|
|
} |