MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 108: Line 108:
             return paragraphs.map(function (p) { return '<span>' + p.trim() + '</span>'; }).join('');
             return paragraphs.map(function (p) { return '<span>' + p.trim() + '</span>'; }).join('');
         }
         }
       
        // Description formatting for Community Cards
    function formatCommunityCardDescriptions() {
        console.log("Formatting community card descriptions");
        $('.community-card').each(function() {
            console.log("Processing a community card");
            var descriptionContainer = $(this).find('.community-description');
            var rawDescription = descriptionContainer.text();
            console.log("Raw Description:", rawDescription);
            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();
    }
          
          
         function formatSimpleDate(inputDate) {
         function formatSimpleDate(inputDate) {

Navigation menu