MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 2: Line 2:
     console.log('JavaScript is working!');
     console.log('JavaScript is working!');


    var communityFeatured = $('#community-featured');
     var cards = $('.card');
     var cards = $('.card');
     var showArticleWrapper = $('#show-article-wrapper');
     var showArticleWrapper = $('#show-article-wrapper');


    // Check if the community featured and cards are present
     if (communityFeatured.length && cards.length >= 2) {
     if ($('#community-featured').length && $('.card').length >= 2) {
         // Detach and insert the community featured element after the second card
         // Select the community featured element
         communityFeatured.detach();
         var communityFeatured = $('#community-featured').detach();
         cards.eq(1).after(communityFeatured);
 
         // Place the community featured after the second card
        $('.card').eq(1).after(communityFeatured);
     }
     }
Line 45: Line 43:
    });
    });
}
}
   
 
     // Delegate the mousedown event to the '.card' elements inside the '#list' container
     // Delegate the mousedown event to the '.card' elements inside the '#list' container
     $('#list').on('mousedown', '.card', function (event) {
     $('#list').on('mousedown', '.card', function (event) {

Navigation menu