MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 180: Line 180:


     // Description formatting for Community Cards
     // Description formatting for Community Cards
    function formatCommunityCardDescriptions() {
function formatCommunityCardDescriptions() {
    console.log("Formatting community card descriptions");
    console.log("Formatting community card descriptions");
        $('.community-card').each(function() {
    $('.community-card').each(function() {
        console.log("Processing a community card");
        console.log("Processing a community card");
            var descriptionContainer = $(this).find('.community-description');
        var descriptionContainer = $(this).find('.community-description');
            var rawDescription = descriptionContainer.text();
        var rawDescription = descriptionContainer.text();
            console.log("Raw Description:", rawDescription);
        console.log("Raw Description:", rawDescription);
            descriptionContainer.html(rawDescription);
            console.log("Formatted Description HTML:", descriptionContainer.html());
        var formattedDescription = formatParagraphs(rawDescription);
        });
        descriptionContainer.html(formattedDescription);
    }
        console.log("Formatted Description HTML:", descriptionContainer.html());
 
    });
    // Check if we are on a page that requires community card formatting
}
    if ($('.community-card').length) {
        formatCommunityCardDescriptions();
// Check if we are on a page that requires community card formatting
    }
if ($('.community-card').length) {
    formatCommunityCardDescriptions();
}
});
});

Navigation menu