<commit_before>// Carrousel --------------------------------------

gfw.ui.model.Carrousel = Backbone.Model.extend({

  defaults: {
    hidden: true
  }

});

gfw.ui.view.Carrousel = gfw.core.View.extend({

  className: "carrousel",

  defaults: {
    speed: 300
  },

  events: {

    "click .previous"  : "onPrevious",
    "click .next" : "onNext"

  },

  initialize: function() {

    _.bindAll( this, "onPrevious", "onNext" );

    this.step = 1;

    this.options = _.extend(this.options, this.defaults);

    this.model = new gfw.ui.model.Carrousel();
    this.add_related_model(this.model);

    this.render();

  },

  onNext: function() {

    this.$carrousel.find("li:nth-child(" + this.step + ")").fadeOut(this.defaults.speed);
    (this.step >= this.$images.length) ?  this.step = 1 : this.step++;
    this.$carrousel.find("li:nth-child(" + this.step + ")").fadeIn(this.defaults.speed);
  },

  onPrevious: function() {

    this.$carrousel.find("li:nth-child(" + this.step + ")").fadeOut(this.defaults.speed);
    (this.step == 1) ? this.step = this.$images.length : this.step--;
    this.$carrousel.find("li:nth-child(" + this.step + ")").fadeIn(this.defaults.speed);

  },

  render: function() {
    var that = this;

    this.$el = $(".carrousel");

    this.$previous = this.$el.find(".previous");
    this.$next     = this.$el.find(".next");

    this.$carrousel = this.$el.find("ul");
    this.$images    = this.$el.find("li");

    this.$carrousel.find("li:nth-child(1)").fadeIn(this.defaults.speed);

    return this.$el;

  }

});
<commit_msg>stops propagation in the gallery<commit_after>// Carrousel --------------------------------------

gfw.ui.model.Carrousel = Backbone.Model.extend({

  defaults: {
    hidden: true
  }

});

gfw.ui.view.Carrousel = gfw.core.View.extend({

  className: "carrousel",

  defaults: {
    speed: 300
  },

  events: {

    "click .previous"  : "onPrevious",
    "click .next" : "onNext"

  },

  initialize: function() {

    _.bindAll( this, "onPrevious", "onNext" );

    this.step = 1;

    this.options = _.extend(this.options, this.defaults);

    this.model = new gfw.ui.model.Carrousel();
    this.add_related_model(this.model);

    this.render();

  },

  onNext: function(e) {
    e.preventDefault();
    e.stopImmediatePropagation();

    this.$carrousel.find("li:nth-child(" + this.step + ")").fadeOut(this.defaults.speed);
    (this.step >= this.$images.length) ?  this.step = 1 : this.step++;
    this.$carrousel.find("li:nth-child(" + this.step + ")").fadeIn(this.defaults.speed);
  },

  onPrevious: function(e) {
    e.preventDefault();
    e.stopImmediatePropagation();

    this.$carrousel.find("li:nth-child(" + this.step + ")").fadeOut(this.defaults.speed);
    (this.step == 1) ? this.step = this.$images.length : this.step--;
    this.$carrousel.find("li:nth-child(" + this.step + ")").fadeIn(this.defaults.speed);

  },

  render: function() {
    var that = this;

    this.$el = $(".carrousel");

    this.$previous = this.$el.find(".previous");
    this.$next     = this.$el.find(".next");

    this.$carrousel = this.$el.find("ul");
    this.$images    = this.$el.find("li");

    this.$carrousel.find("li:nth-child(1)").fadeIn(this.defaults.speed);

    return this.$el;

  }

});

{'fraction_non_alphanumeric': 0.22256190767349435, 'fraction_numerical': 0.004280036686028737, 'mean_word_length': 2.756601607347876, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7382821', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1141, 'n_words': 170}