MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 26: Line 26:
    }
    }
}
}


     // Check if the specific element exists on the page
     // Check if the specific element exists on the page
Line 51: Line 50:
     }
     }
      
      
     // Using delegated event handling for both #list and #list-list
     // Using delegated event handling for both #list, #list-list and their variations
$('#list, #list-list').on('mousedown', '.filtered-value-option', function(event) {
    $('#list, #list-list, #list-block-1, #list-block-2, #list-block-3, #list-list-1, #list-list-2, #list-list-3').on('mousedown', '.filtered-value-option', function(event) {
    console.log("Filter clicked within context:", this);
        console.log("Filter clicked within context:", this);
 
    if ($(this).closest('#list').length) {
        // Check context for #list and its block variations
        console.log("Context: #list");
        if ($(this).closest('#list, #list-block-1, #list-block-2, #list-block-3').length) {
        console.log("Before hiding, Community Featured display:", communityFeatured.css('display'));
            console.log("Context: #list or one of its block variations");
        console.log("After hiding, Community Featured display:", communityFeatured.css('display'));
            console.log("Before hiding, Community Featured display:", communityFeatured.css('display'));
    } else if ($(this).closest('#list-list').length) {
            communityFeatured.hide(); // Assuming you want to hide communityFeatured in this context
        console.log("Context: #list-list");
            console.log("After hiding, Community Featured display:", communityFeatured.css('display'));
        console.log("Before hiding, Community List Featured display:", communityFeatured.css('display'));
        }  
        console.log("After hiding, Community List Featured display:", communityFeatured.css('display'));
        // Check context for #list-list and its list variations
    }
        else if ($(this).closest('#list-list, #list-list-1, #list-list-2, #list-list-3').length) {
            console.log("Context: #list-list or one of its list variations");
    // Additional debugging: Check the event target and its parents
            console.log("Before hiding, Community List Featured display:", communityFeatured.css('display'));
    console.log("Event target:", event.target);
            communityFeatured.hide(); // Assuming you want to hide communityFeatured in this context
    console.log("Parents of event target:", $(event.target).parents());
            console.log("After hiding, Community List Featured display:", communityFeatured.css('display'));
});
        }
 
        // Additional debugging: Check the event target and its parents
        console.log("Event target:", event.target);
        console.log("Parents of event target:", $(event.target).parents());
    });
 


     // Format paragraphs
     // Format paragraphs

Navigation menu