MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 5: Line 5:
     var showArticleWrapper = $('#show-article-wrapper');
     var showArticleWrapper = $('#show-article-wrapper');


function formatParagraphs(text) {
    // Check if the community featured and cards are present
    if ($('#community-featured').length && $('.card').length >= 2) {
        // Select the community featured element
        var communityFeatured = $('#community-featured').detach();
 
        // Place the community featured after the second card
        $('.card').eq(1).after(communityFeatured);
    }
// Check if we are on a page that requires community card formatting
if ($('.community-card').length) {
    formatCommunityCardDescriptions();
}
 
    function formatParagraphs(text) {
    var paragraphs = text.split('\n').filter(function (p) { return p.trim() !== '' });
    var paragraphs = text.split('\n').filter(function (p) { return p.trim() !== '' });
    return paragraphs.map(function (p) { return '<p>' + p.trim() + '</p>'; }).join('');
    return paragraphs.map(function (p) { return '<p>' + p.trim() + '</p>'; }).join('');
Line 31: Line 45:
    });
    });
}
}
 
      
     // Check if the community featured and cards are present
    if ($('#community-featured').length && $('.card').length >= 2) {
        // Select the community featured element
        var communityFeatured = $('#community-featured').detach();
 
        // Place the community featured after the second card
        $('.card').eq(1).after(communityFeatured);
    }
// Check if we are on a page that requires community card formatting
if ($('.community-card').length) {
    formatCommunityCardDescriptions();
}
 
     // 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