MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Tag: Reverted
Line 1: Line 1:
$(document).ready(function () {
$(document).ready(function () {
     var communityFeatured = $('#community-featured');
     var communityFeatured = $('.community-featured');
     var filteredCards = $('.filtered-list-item');
     var filteredCards = $('.filtered-list-item');
     var showArticleWrapper = $('#show-article-wrapper');
     var showArticleWrapper = $('#show-article-wrapper');
Line 12: Line 12:
      
      
     // Insert the community featured element after the second card
     // Insert the community featured element after the second card
if (communityFeatured.length && filteredCards.length >= 2) {
    if (communityFeatured.length && filteredCards.length >= 2) {
    console.log("Community Featured element and at least two filtered cards found.");
        console.log("Community Featured element and at least two filtered cards found.");
    communityFeatured.detach();
        communityFeatured.detach();
    filteredCards.eq(1).after(communityFeatured);
        filteredCards.eq(1).after(communityFeatured);
    communityFeatured.show();
        communityFeatured.show();
    console.log("Community Featured element has been moved after the second filtered card.");
        console.log("Community Featured element has been moved after the second filtered card.");
} else {
    } else {
    if (!communityFeatured.length) {
        if (!communityFeatured.length) {
        console.log("No Community Featured element found.");
            console.log("No Community Featured element found.");
    }
        }
    if (filteredCards.length < 2) {
        if (filteredCards.length < 2) {
        console.log("Less than two filtered cards found. Found: ", filteredCards.length);
            console.log("Less than two filtered cards found. Found: ", filteredCards.length);
    }
        }
}
    }


     // Check if the specific element exists on the page
     // Check if the specific element exists on the page

Navigation menu