4,554
edits
No edit summary Tags: Manual revert Reverted |
No edit summary Tag: Manual revert |
||
Line 13: | Line 13: | ||
// Initial check to set the visibility based on the current state of filters | // Initial check to set the visibility based on the current state of filters | ||
updateFeaturedVisibility(); | updateFeaturedVisibility(); | ||
if (communityFeatured.length && filteredCards.length >= 2) { | if (communityFeatured.length && filteredCards.length >= 2) { | ||
Line 112: | Line 108: | ||
} | } | ||
// Function to check if filters are cleared and update visibility of community elements | |||
function checkFiltersCleared(selector, communityElement) { | function checkFiltersCleared(selector, communityElement) { | ||
var checkedFilters = $(selector + ' .filtered-value-option input[type="checkbox"]:checked'); | var checkedFilters = $(selector + ' .filtered-value-option input[type="checkbox"]:checked'); | ||
console.log("Checked filters count in " + selector + ":", checkedFilters.length); | |||
if (checkedFilters.length === 0) { | if (checkedFilters.length === 0) { | ||
console.log("All filters are cleared in " + selector); | |||
communityElement.show(); | |||
} else { | } else { | ||
console.log("Some filters are still active in " + selector); | |||
communityElement.hide(); // Hide the element if any filters are active | |||
} | } | ||
} | } | ||
Line 132: | Line 132: | ||
checkFiltersCleared('#list-list', communityListFeatured); // Call the function directly without delay | checkFiltersCleared('#list-list', communityListFeatured); // Call the function directly without delay | ||
}); | }); | ||
// Initial checks | |||
checkFiltersCleared('#list', communityFeatured); | |||
checkFiltersCleared('#list-list', communityListFeatured); | |||
// Function to check if all filters are cleared and return boolean | // Function to check if all filters are cleared and return boolean |