MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 119: Line 119:


function positionAndShowCommunityElement(communityElement, positionSelector, positionIndex) {
function positionAndShowCommunityElement(communityElement, positionSelector, positionIndex) {
    console.log("Positioning community element");
    communityElement.detach();
    communityElement.detach();
    var targetPosition = $(positionSelector + ' .card').eq(positionIndex);
    var targetPosition = $(positionSelector + ' .filtered-list-item').eq(positionIndex);
    if(targetPosition.length === 0) {
    if(targetPosition.length === 0) {
        console.log("Target position not found. Selector or index might be incorrect.");
        console.log("Target position not found. Selector or index might be incorrect.");
Line 133: Line 132:
    console.log("Community element should now be visible after", targetPosition);
    console.log("Community element should now be visible after", targetPosition);
}
}
// Event delegation for filter changes in block view
// Event delegation for filter changes in block view
$('#list').on('change', '.filtered-value-option input[type="checkbox"]', function() {
$('#list').on('change', '.filtered-value-option input[type="checkbox"]', function() {
    checkFiltersCleared('#list', communityFeatured); // Call the function directly without delay
    checkFiltersCleared('#list', communityFeatured, '#list', 1); // Position after 2nd filtered card
});
});
// Event delegation for filter changes in list view
// Event delegation for filter changes in list view
$('#list-list').on('change', '.filtered-value-option input[type="checkbox"]', function() {
$('#list-list').on('change', '.filtered-value-option input[type="checkbox"]', function() {
    checkFiltersCleared('#list-list', communityListFeatured); // Call the function directly without delay
    checkFiltersCleared('#list-list', communityListFeatured, '#list-list', 3); // Position after 4th filtered card
});
});


Navigation menu