MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Tag: Manual revert
No edit summary
Line 153: Line 153:
     });
     });


/* // Initial checks
    // Initial checks
checkFiltersCleared('#list', communityFeatured);
checkFiltersCleared('#list-list', communityFeatured); */
 
    // Array of selectors
     var selectors = ['#list', '#list-list'];
     var selectors = ['#list', '#list-list'];


Line 164: Line 160:
         checkFiltersCleared(selector, communityFeatured);
         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
Line 409: Line 404:
}
}
// Function to update the visibility of featured elements based on filters
function updateFeaturedVisibility() {
function updateFeaturedVisibility() {
    if ($('#list .filtered-value-option input[type="checkbox"]:checked').length === 0) {
        var selectors = ['#list', '#list-list'];
        communityFeatured.show();
        var allFiltersCleared = true; 
    } else {
        selectors.forEach(function(selector) {
        communityFeatured.hide();
            if ($(selector + ' .filtered-value-option input[type="checkbox"]:checked').length > 0) {
    }
                allFiltersCleared = false; // If any filter is checked, set to false
            }
    if ($('#list-list .filtered-value-option input[type="checkbox"]:checked').length === 0) {
        });
        communityFeatured.show();
   
    } else {
        if (allFiltersCleared) {
        communityFeatured.hide();
            communityFeatured.show();
    }
        } else {
}
            communityFeatured.hide();
 
        }
    }
   
// closeModal function
// closeModal function
function closeModal() {
function closeModal() {

Navigation menu