4,114
edits
No edit summary |
No edit summary |
||
Line 175: | Line 175: | ||
// Function to check if filters are cleared for given selectors and update visibility of corresponding community elements | // Function to check if filters are cleared for given selectors and update visibility of corresponding community elements | ||
function updateCommunityElementsVisibility(selectors, communityElements) { | function updateCommunityElementsVisibility(selectors, communityElements) { | ||
selectors. | for (var i = 0; i < selectors.length; i++) { | ||
var selector = selectors[i]; | |||
var checkedFilters = $(selector + ' .filtered-value-option input[type="checkbox"]:checked'); | var checkedFilters = $(selector + ' .filtered-value-option input[type="checkbox"]:checked'); | ||
console.log( | console.log('Checked filters count in ' + selector + ':', checkedFilters.length); | ||
// If no filters are checked, show the community element associated with this selector | // If no filters are checked, show the community element associated with this selector | ||
if (checkedFilters.length === 0) { | if (checkedFilters.length === 0) { | ||
console.log( | console.log('All filters are cleared in ' + selector); | ||
communityElements[ | communityElements[i].show(); | ||
} else { | } else { | ||
console.log( | console.log('Some filters are still active in ' + selector); | ||
communityElements[ | communityElements[i].hide(); // Hide the community element if any filters are active | ||
} | } | ||
} | } | ||
} | } | ||
// Initial checks | // Initial checks |