<commit_before>/*!
 * @license MIT
 * @author <NAME>
 * @copyright (c) M<NAME>
 */
;(function ($, document)
{
    "use strict";

    $.fn.MDMImageViewport = function (images, settings)
    {
        if (!$.isArray(images) || images.length === 0)
        {
            throw "MDMImageViewport: You need to pass an non-empty array of image paths to viewport on instantiation";
        }

        return this.each(function ()
        {
            var container = $(this),
                config = $.extend({}, settings),

                props = {
                    loaded:false,
                    images:[],
                    current:0,
                    nbImages:0
                },

                methods = {
                    construct:function ()
                    {
                        $(document).bind('mdm-animation.beat', methods.eventChangeImage);
                        container.addClass('mdm-image-viewport');

                        if (config.width)
                        {
                            methods.setWidth(config.width);
                        }

                        if (config.height)
                        {
                            methods.setHeight(config.height);
                        }

                        methods.loadImages(images);
                        container.data('maxImages', props.nbImages);
                    },
                    loadImages:function (images)
                    {
                        var image = new Image(), i, len;

                        props.loaded = false;
                        props.images = images;

                        image.src = images[0];

                        image.onload = function ()
                        {
                            if (typeof config.width === 'undefined')
                            {
                                methods.setWidth(this.width);
                            }
                            if (typeof config.height === 'undefined')
                            {
                                methods.setHeight(this.height);
                            }
                        };

                        for (i = 1, len = images.length; i < len; i++)
                        {
                            image.src = images[i];
                        }

                        props.nbImages = len;<commit_msg>Try to fix caching<commit_after>/*!
 * @license MIT
 * @author <NAME>
 * @copyright (c) Maisons du Monde
 */
;(function ($, document)
{
    "use strict";

    $.fn.MDMImageViewport = function (images, settings)
    {
        if (!$.isArray(images) || images.length === 0)
        {
            throw "MDMImageViewport: You need to pass an non-empty array of image paths to viewport on instantiation";
        }

        return this.each(function ()
        {
            var container = $(this),
                config = $.extend({}, settings),
                cache,

                props = {
                    loaded:false,
                    images:[],
                    current:0,
                    nbImages:0
                },

                methods = {
                    construct:function ()
                    {
                        $(document).bind('mdm-animation.beat', methods.eventChangeImage);
                        container.addClass('mdm-image-viewport');
                        container.append('<div class="cache"></div>');
                        cache = container.children('.cache');
                        cache.hide();

                        if (config.width)
                        {
                            methods.setWidth(config.width);
                        }

                        if (config.height)
                        {
                            methods.setHeight(config.height);
                        }

                        methods.loadImages(images);
                        container.data('maxImages', props.nbImages);
                    },
                    loadImages:function (images)
                    {
                        var image = new Image(), i, len;

                        props.loaded = false;
                        props.images = images;

                        image.src = images[0];

                        image.onload = function ()
                        {
                            if (typeof config.width === 'undefined')
                            {
                                methods.setWidth(this.width);
                            }
                            if (typeof config.height === 'undefined')
                            {
                                methods.setHeight(this.height);
                            }
                        };
                        //cache.append(image);

                        for (i = 1, len = images.length; i < len; i++)
                        {
                            image = new Image();
                            image.src = images[i];
                         //   cache.append(image);
                        }

                        props.nbImages = len;
{'fraction_non_alphanumeric': 0.09748978400467016, 'fraction_numerical': 0.001945903872348706, 'mean_word_length': 0.781011781011781, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '738173', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1032, 'n_words': 217}