MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 129: Line 129:
checkFiltersCleared('#list-list', communityListFeatured);
checkFiltersCleared('#list-list', communityListFeatured);


// Function to check if all filters are cleared and return boolean
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
Line 252: Line 257:
     }
     }


     // Function to close the modal and revert the list changes
     // Modified closeModal function
    function closeModal() {
function closeModal() {
    showArticleWrapper.hide();
    showArticleWrapper.hide();
    list.width(originalListWidth).css('margin-right', '0');
    list.width(originalListWidth).css('margin-right', '0');
Line 260: Line 265:
    // Revert width of filtered-list-items in #list
    // Revert width of filtered-list-items in #list
    filteredListItems.css('width', 'calc(20% - 2px)');
    filteredListItems.css('width', 'calc(20% - 2px)');
   
    // Check if any filters are active
  // var areFiltersActive = $('#list-list .filtered-value-option input[type="checkbox"]:checked').length > 0;
    // Show communityFeatured only if no filters are active
    // Check if filters are cleared before showing community elements
    //if (!areFiltersActive) {
    if (areFiltersCleared('#list')) {
        //communityFeatured.show();
        communityFeatured.show();
        //communityListFeatured.show();
    }
    //}
    if (areFiltersCleared('#list-list')) {
        communityListFeatured.show();
    }
}
}


Navigation menu