4,114
edits
No edit summary Tag: Reverted |
No edit summary Tag: Manual revert |
||
Line 159: | Line 159: | ||
}); | }); | ||
} | } | ||
// Function to check if filters are cleared and update visibility of community elements | // Function to check if filters are cleared and update visibility of community elements | ||
function checkFiltersCleared(selector, communityElement) { | |||
var checkedFilters = $(selector + ' .filtered-value-option input[type="checkbox"]:checked'); | |||
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); | |||
communityElement.hide(); // Hide the element if any filters are active | |||
} | |||
} | |||
// Event delegation for filter changes in block, list views, and their variations | // Event delegation for filter changes in block, list views, and their variations | ||
Line 184: | Line 185: | ||
checkFiltersCleared('#' + contextId, communityFeatured); | checkFiltersCleared('#' + contextId, communityFeatured); | ||
}); | }); | ||
// Initial checks | // Initial checks | ||
var selectors = ['#list', '#list-list | var selectors = ['#list', '#list-list']; | ||
// | // Iterate over the selectors and perform initial checks | ||
selectors.forEach( | selectors.forEach(function(selector) { | ||
checkFiltersCleared(selector, communityFeatured); | |||
}); | }); | ||
// Function to check if all filters are cleared and return boolean | // Function to check if all filters are cleared and return boolean | ||
function areFiltersCleared( | function areFiltersCleared(selector) { | ||
var checkedFilters = $(selector + ' .filtered-value-option input[type="checkbox"]:checked'); | |||
return checkedFilters.length === 0; | |||
} | |||
// Function to open the modal and adjust the list | // Function to open the modal and adjust the list | ||
function openModal(cardElement, event) { | function openModal(cardElement, event) { |