related to #1945 & #1931 Clearer code

This commit is contained in:
MatthieuLP
2023-07-24 11:47:15 +02:00
parent 27217c8c57
commit 01e3bb61ea
+16 -8
View File
@@ -9,14 +9,22 @@ $(document).ready(function () {
$(document).on('click', function (e) {
$(".filter-form").each(function () {
if ($(this).parent().hasClass("show-filter-dropdown") &&
$(this).parent().has(e.target).length === 0 &&
!$(this).parent().is(e.target) &&
!$("#addLinkedAlbum").is(e.target) &&
$("#addLinkedAlbum").has(e.target).length === 0) {
$(this).parent().trigger('click');
if ($(".filter").has(e.target).length !== 0) {
$(e.target).trigger('click');
if ($(this).parent().hasClass("show-filter-dropdown")) {
// Filter is open
if ($(this).parent().has(e.target).length === 0 && !$(this).parent().is(e.target)) {
// We don't click on a filter or filter's form
// $(this).parent().trigger('click');
if ($("#addLinkedAlbum").has(e.target).length === 0 && !$("#addLinkedAlbum").is(e.target)) {
console.log("We don't click in filter manager");
$(this).parent().trigger('click');
}
//if target if a filter, open it
if ($(".filter").has(e.target).length !== 0) {
$(e.target).trigger('click');
}
}
}
});