<commit_before>$(document).ready(function() {
    x = $('.slider').rslider();
});

(function($) {
    RSlider = (function() {
        function RSlider(element, options) {
            _ = this;
            _.width =  options && options.width ? options.width : 500;
            _.element = element;
            _.slider = null;
            _.slidesCount = null;
            _.sliderMask = null;
            _.sliderBox = null;
            _.initialSlide = options && options.initialSlide ? options.initialSlide : null;
            _.currentSlide = null;
            _.currentClass = options && options.currentClass ? options.currentClass :  '';
            _.slidesPositions = [];
            _.centerPoint = _.width / 2;
            _.animTime = options && options.animationTime ? options.animationTime : 200;
            _.prevArrow = null;
            _.nextArrow = null;
            _.init();
        };
        return RSlider;
    }());

    RSlider.prototype.init = function() {
        /* Initialize variables */
        _.slides = $(_.element).children();
        _.slider = _.slides.wrapAll('<div class="rs-track" />').parent();
        _.sliderMask = _.slider.wrap('<div class="rs-mask" />').parent();
        _.sliderMask.css('width', _.width+'px');
        _.sliderBox = _.sliderMask.parent().addClass('rs');
        _.slidesCount = _.slides.length;
        if (!_.initialSlide) { _.initialSlide = Math.ceil(_.slidesCount / 2); }

        /* Initialize positions vector */
        for (var i = 0; i < _.slidesCount; i++) {
            var element = $(_.slides[i]);
            if (_.currentClass) { element.addClass(_.currentClass); }
            _.slidesPositions.push(
                element.position().left + 
                element.width()/2 + 
                parseInt(element.css('margin-left'), 10) + 
                parseInt(element.css('padding-left'), 10) + 
                parseInt(element.css('border-left-width'), 10)
            );
            if (_.currentClass) { $this.removeClass(_.currentClass); }
        };

        /* Center initial element */
        _.centerInitial();
        _.buildArrows();
    };

    /* Method for centering the wanted initial slide if specified or th default one if not */
    RSlider.prototype.centerInitial = function() {
        if (_.initialSlide) {
            var newOffset = _.centerPoint - _.slidesPositions[_.initialSlide];
            // _.slider.css('transform', 'translate3d('+newOffset+'px , 0px, 0px)');
            _.slider.css('margin-left', newOffset+'px');
            if (_.currentClass) { _.slides.eq(_.initialSlide).addClass(_.currentClass) }
            _.currentSlide = _.initialSlide;
        };
    };

    /* Method for moving to the next slide */
    RSlider.prototype.next = function() {
        if (_.currentSlide + 1 <= _.slidesCount - 1) {
            var newOffset = _.centerPoint - _.slidesPositions[++_.currentSlide];
            _.slider.animate({'margin-left': newOffset+'px'}, _.animTime, function() {});
            if (_.currentClass) { 
                _.slider.find('.'+_.currentClass).removeClass(_.currentClass);
                _.slider.eq(_.currentSlide).addClass(_.currentClass);
            };
        };
    };

    /* Method for moving to the previous slide */
    RSlider.prototype.prev = function() {
        if (_.currentSlide - 1 >= 0) {
            var newOffset = _.centerPoint - _.slidesPositions[--_.currentSlide];
            _.slider.animate({'margin-left': newOffset+'px'}, _.animTime, function() {});
            if (_.currentClass) { 
                _.slider.find('.'+_.currentClass).removeClass(_.currentClass);
                _.slider.eq(_.currentSlide).addClass(_.currentClass);
            };
        };
    };

    RSlider.prototype.buildArrows = function() {
        var arrows = $('<div class="rs-arrows" />');
        _.prevArrow = $('<a class="rs-arrow-left" />');
        _.nextArrow = $('<a class="rs-arrow-right" />');
        arrows.append(_.prevArrow);
        arrows.append(_.nextArrow);
        _.prevArrow.on('click', function(event) {
            event.preventDefault();
            _.prev();
        });<commit_msg>Changed css property: from margin-left to translate3d.<commit_after>$(document).ready(function() {
    x = $('.slider').rslider();
});

(function($) {
    RSlider = (function() {
        function RSlider(element, options) {
            _ = this;
            _.width =  options && options.width ? options.width : 500;
            _.element = element;
            _.slider = null;
            _.slidesCount = null;
            _.sliderMask = null;
            _.sliderBox = null;
            _.initialSlide = options && options.initialSlide ? options.initialSlide : null;
            _.currentSlide = null;
            _.currentClass = options && options.currentClass ? options.currentClass :  '';
            _.slidesPositions = [];
            _.centerPoint = _.width / 2;
            _.animTime = options && options.animationTime ? options.animationTime : 200;
            _.prevArrow = null;
            _.nextArrow = null;
            _.transitionType = null;
            _.init();
        };
        return RSlider;
    }());

    RSlider.prototype.init = function() {
        /* Initialize variables */
        _.slides = $(_.element).children();
        _.slider = _.slides.wrapAll('<div class="rs-track" />').parent();
        _.sliderMask = _.slider.wrap('<div class="rs-mask" />').parent();
        _.sliderMask.css('width', _.width+'px');
        _.sliderBox = _.sliderMask.parent().addClass('rs');
        _.slidesCount = _.slides.length;
        if (!_.initialSlide) { _.initialSlide = Math.ceil(_.slidesCount / 2); }

        if (document.body.style.MozTransform !== undefined) {
            _.transitionType = "-moz-transform";
        } else if (document.body.style.webkitTransform !== undefined) {
            _.transitionType = "-webkit-transform";
        } else if (document.body.style.msTransform !== undefined) {
            _.transitionType = "-ms-transform";
        } else {
            _.transitionType = "transform";
        }

        /* Initialize positions vector */
        for (var i = 0; i < _.slidesCount; i++) {
            var element = $(_.slides[i]);
            if (_.currentClass) { element.addClass(_.currentClass); }
            _.slidesPositions.push(
                element.position().left + 
                element.width()/2 + 
                parseInt(element.css('margin-left'), 10) + 
                parseInt(element.css('padding-left'), 10) + 
                parseInt(element.css('border-left-width'), 10)
            );
            if (_.currentClass) { $this.removeClass(_.currentClass); }
        };

        /* Center initial element */
        _.centerInitial();
        _.buildArrows();
    };

    /* Method for centering the wanted initial slide if specified or th default one if not */
    RSlider.prototype.centerInitial = function() {
        if (_.initialSlide) {
            var newOffset = _.centerPoint - _.slidesPositions[_.initialSlide];
            // _.slider.css(_.transitionType, 'translate3d('+newOffset+'px, 0px, 0px)');
            _.slider.animate({ whyNotToUseANonExistingProperty: newOffset }, { 
                step: function(now) {
                    $(this).css(_.transitionType, 'translate3d('+now+'px, 0px, 0px)')
                },
                duration: 0
            }, 'linear');
            if (_.currentClass) { _.slides.eq(_.initialSlide).addClass(_.currentClass) }
            _.currentSlide = _.initialSlide;
        };
    };

    /* Method for moving to the next slide */
    RSlider.prototype.next = function() {
        if (_.currentSlide + 1 < _.slidesCount) {
            var newOffset = _.centerPoint - _.slidesPositions[++_.currentSlide];
            _.slider.animate({ whyNotToUseANonExistingProperty: newOffset }, { 
                step: function(now) {
                    $(this).css(_.transitionType, 'translate3d('+now+'px, 0px, 0px)')
                },
                duration: _.animTime
            }, 'linear');
            if (_.currentClass) { 
                _.slider.find('.'+_.currentClass).removeClass(_.currentClass);
                _.slider.eq(_.currentSlide).addClass(_.currentClass);
            };
        };
    };

    /* Method for moving to the previous slide */
    RSlider.prototype.prev = function() {
        if (_.currentSlide - 1 >= 0) {
            var newOffset = _.centerPoint - _.slidesPositions[--_.currentSlide];
            _.slider.animate({ whyNotToUseANonExistingProperty: newOffset }, { 
                step: function(now) {
                    $(this).css(_.transitionType, 'translate3d('+now+'px, 0px, 0px)')
                },
                duration: _.animTime
            }, 'linear');
            if (_.currentClass) { 
                _.slider.find('.'+_.currentClass).removeClass(_.currentClass);
                _.slider.eq(_.currentSlide).addClass(_.currentClass);
            };
        };
    };

    RSlider.prototype.buildArrows = function() {
        var arrows = $('<div class="rs-arrows" />');
        _.prevArrow = $('<a class="rs-arrow-left" />');
        _.nextArrow = $('<a class="rs-arrow-right" />');
        arrows.append(_.prevArrow);
        arrows.append(_.nextArrow);
        _.prevArrow.on('click', function(event) {
            event.preventDefault();
            _.prev();
        });
{'fraction_non_alphanumeric': 0.152067868504772, 'fraction_numerical': 0.005938494167550371, 'mean_word_length': 1.8718026796589524, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, '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': '7328421', 'n_tokens_mistral': 2642, 'n_tokens_neox': 2574, 'n_words': 479}