4,554
edits
No edit summary |
No edit summary |
||
Line 108: | Line 108: | ||
} | } | ||
// | // Function to check if all filters are cleared | ||
function checkFiltersCleared(selector, communityElement) { | |||
var checkedFilters = $(selector + ' .filtered-value-option input[type="checkbox"]:checked'); | |||
console.log(" | console.log("Checked filters count in " + selector + ":", checkedFilters.length); | ||
} | |||
if (checkedFilters.length === 0) { | |||
console.log("All filters are cleared in " + selector); | |||
communityElement.show(); | |||
} else { | |||
console.log("Some filters are still active in " + selector); | |||
} | |||
} | |||
// Event delegation for filter changes in block view | // Event delegation for filter changes in block view | ||
$('#list').on('change', '.filtered-value-option input[type="checkbox"]', function() { | $('#list').on('change', '.filtered-value-option input[type="checkbox"]', function() { | ||
setTimeout(function() { checkFiltersCleared('#list', communityFeatured); }, 100 | setTimeout(function() { checkFiltersCleared('#list', communityFeatured); }, 100); | ||
}); | }); | ||
// Event delegation for filter changes in list view | // Event delegation for filter changes in list view | ||
$('#list-list').on('change', '.filtered-value-option input[type="checkbox"]', function() { | $('#list-list').on('change', '.filtered-value-option input[type="checkbox"]', function() { | ||
setTimeout(function() { checkFiltersCleared('#list-list', communityListFeatured); }, 100 | setTimeout(function() { checkFiltersCleared('#list-list', communityListFeatured); }, 100); | ||
}); | }); | ||