MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 34: Line 34:


             // Store image information in an array
             // Store image information in an array
var images = [];
// Store image information in an array
            var images = [];


for (var i = 1; i <= imageCount; i++) {
            // Loop through possible image containers
    var image = {
            for (var i = 1; i <= imageCount; i++) {
        link: $(this).find('.image' + i + ' a').attr('href'),
                var imageContainer = $(this).find('.image' + i);
        src: $(this).find('.image' + i + ' img').attr('src'),
        alt: $(this).find('.image' + i + ' img').attr('alt'),
        caption: $(this).find('.caption-image' + i).text() // Assuming caption is stored in a separate element
    };


    console.log('Image ' + i + ' link:', image.link);
                // Check if the image container exists
    console.log('Image ' + i + ' src:', image.src);
                if (imageContainer.length > 0) {
    console.log('Image ' + i + ' alt:', image.alt);
                    var image = {
    console.log('Image ' + i + ' caption:', image.caption);
                        link: imageContainer.find('a').attr('href'),
                        src: imageContainer.find('img').attr('src'),
    images.push(image);
                        alt: imageContainer.find('img').attr('alt'),
}
                        caption: imageContainer.find('.caption-image' + i).text()
                    };


console.log('Number of images:', images.length);
                    // Add the image to the array
for (var i = 0; i < images.length; i++) {
                    images.push(image);
    console.log('Image ' + i + ':', images[i]);
                } else {
}
                    // Break the loop if no more images are found
                    break;
                }
            }
 
            // Now images array contains the information of available images
            console.log('Number of images:', images.length);
            for (var i = 0; i < images.length; i++) {
                console.log('Image ' + i + ':', images[i]);
            }


             // Initial image to display
             // Initial image to display

Navigation menu