MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 39: Line 39:
         // Show the community-featured element after positioning it
         // Show the community-featured element after positioning it
         communityListFeatured.show();
         communityListFeatured.show();
    }
    // Check if the specific element exists on the page
    if ($('#show-article-wrapper-entry').length > 0 || $('#show-article-wrapper').length > 0) {
        // If it exists, run the setupImageToggle function with the images found within the article content
        var images = []; // Initialize an empty array to store the images
        // Find all image containers within the article content and extract the necessary information
        $('.article-images .image-container').each(function() {
            var img = $(this).find('img');
            var captionDiv = $(this).find('div[class^="caption-image"]');
            var image = {
                src: img.attr('src'),
                alt: img.attr('alt'),
                caption: captionDiv.text(),
                captionClass: captionDiv.attr('class')
            };
            images.push(image); // Add the image object to the images array
        });
        if (images.length > 0) {
            setupImageToggle(images); // Call the setupImageToggle function with the images array
        }
     }
     }
      
      

Navigation menu