MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Tag: Manual revert
No edit summary
Tag: Reverted
Line 108: Line 108:
     }
     }
      
      
// Function to check if filters are cleared and update visibility of community elements
    function checkFiltersCleared(selector, communityElement, positionSelector, positionIndex) {
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);
        positionAndShowCommunityElement(communityElement, positionSelector, positionIndex);
        communityElement.show();
    } else {
    } else {
        console.log("Some filters are still active in " + selector);
        communityElement.hide();
        communityElement.hide(); // Hide the element if any filters are active
    }
    }
}
}


function positionAndShowCommunityElement(communityElement, positionSelector, positionIndex) {
    // Detach the element first
    communityElement.detach();
    // Find the target position and insert the community element
    var targetPosition = $(positionSelector + ' .card').eq(positionIndex);
    communityElement.insertAfter(targetPosition);
    // Use fadeIn for a smooth appearance
    communityElement.hide().fadeIn();
}
// Event delegation for filter changes in block view
// Event delegation for filter changes in block view

Navigation menu