MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
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.forEach((selector, index) => {
         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(`Checked filters count in ${selector}:`, checkedFilters.length);
             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(`All filters are cleared in ${selector}`);
                 console.log('All filters are cleared in ' + selector);
                 communityElements[index].show();
                 communityElements[i].show();
             } else {
             } else {
                 console.log(`Some filters are still active in ${selector}`);
                 console.log('Some filters are still active in ' + selector);
                 communityElements[index].hide(); // Hide the community element if any filters are active
                 communityElements[i].hide(); // Hide the community element if any filters are active
             }
             }
         });
         }
     }
     }


     // Initial checks
     // Initial checks

Navigation menu