MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 286: Line 286:
     }
     }
      
      
    $(document).on('mousedown', function (event) {
$(document).on('mousedown', function (event) {
    console.log('Document mousedown event triggered');
    console.log('Document mousedown event triggered');
    console.log('Event target:', event.target);
    console.log('Event target:', event.target);
    // Check if the click is outside of the #show-article-wrapper and not on a card
    // Now also checking if it's not on a card within #list-list
    var isOutsideWrapper = !showArticleWrapper.is(event.target) && showArticleWrapper.has(event.target).length === 0;
    var isOutsideWrapper = !showArticleWrapper.is(event.target) && showArticleWrapper.has(event.target).length === 0;
    var isNotOnCard = !$(event.target).closest('#list, #list-list').find('.card, .list-card').length;
    // Check if the click is directly on a .card or .list-card, or inside one of them
    var isOnCard = $(event.target).closest('.card, .list-card').length > 0;
    console.log('Is outside wrapper:', isOutsideWrapper);
    console.log('Is outside wrapper:', isOutsideWrapper);
    console.log('Is not on card:', isNotOnCard);
    console.log('Is on card:', isOnCard);
    if (isOutsideWrapper && isNotOnCard) {
    if (isOutsideWrapper && !isOnCard) {
        console.log('Hiding fixed column');
        console.log('Hiding fixed column');
        // Remove the fade-out class when hiding the fixed column
        $('#list, #list-list').removeClass('fade-out');
        $('#list, #list-list').removeClass('fade-out');
        showArticleWrapper.css('display', 'none');
        showArticleWrapper.css('display', 'none');
Line 307: Line 305:
    }
    }
});
});


     $('#close-button').on('click', function () {
     $('#close-button').on('click', function () {

Navigation menu