<commit_before>/**
 * @class Denkmal_Page_Events
 * @extends Denkmal_Page_Abstract
 */
var Denkmal_Page_Events = Denkmal_Page_Abstract.extend({

  /** @type String */
  _class: 'Denkmal_Page_Events',

  /** @type Carousel */
  _carousel: null,

  _stateParams: ['date'],

  events: {
    'swipeCarousel-change .swipeCarousel': function(event, data) {
      this._onShowPane($(data.element));
    }
  },

  ready: function() {
    var self = this;
    var $carousel = this.$('.swipeCarousel');
    $carousel.removeClass('beforeload');
    this._carousel = new Carousel(".swipeCarousel");
    this._carousel.init();

    this.bindJquery($(window), 'keydown', function(event) {
      if (event.which === cm.keyCode.LEFT) {
        this._carousel.prev();
      }
      if (event.which === cm.keyCode.RIGHT) {
        this._carousel.next();
      }
    });
  },

  /**
   * @param {String} date
   * @returns Boolean
   */
  showPane: function(date) {
    var $element = this.$('.dateList > .date[data-date="' + date + '"]');
    if ($element.length) {
      this._carousel.showPane($element.index());
      return true;
    } else {
      return false;
    }
  },

  /**
   * @param {jQuery} $element
   */
  _onShowPane: function($element) {
    var title = $element.data('title');
    var url = $element.data('url');
    var menuEntryHash = $element.data('menu-entry-hash');
    var page = cm.findView('CM_Page_Abstract');

    cm.router.pushState(url);
    cm.findView()._onPageSetup(this, title, url, [menuEntryHash]);
    this.trigger('swipe', $element);
  },

  _changeState: function(state) {
    if (state['date']) {
      this.showPane(state['date']);
    }
  }
});<commit_msg>dont push state in swipeCarousel callback, if state didnt change<commit_after>/**
 * @class Denkmal_Page_Events
 * @extends Denkmal_Page_Abstract
 */
var Denkmal_Page_Events = Denkmal_Page_Abstract.extend({

  /** @type String */
  _class: 'Denkmal_Page_Events',

  /** @type Carousel */
  _carousel: null,

  _stateParams: ['date'],

  events: {
    'swipeCarousel-change .swipeCarousel': function(event, data) {
      this._onShowPane($(data.element));
      var nextState = {date: $(data.element).data('date')};
      if (!_.isEqual(nextState, this.getState())) {
        this.setState(nextState);
        cm.router.pushState($(data.element).data('url'));
      }
    }
  },

  ready: function() {
    var self = this;
    var $carousel = this.$('.swipeCarousel');
    $carousel.removeClass('beforeload');
    this._carousel = new Carousel(".swipeCarousel");
    this._carousel.init();

    this.bindJquery($(window), 'keydown', function(event) {
      if (event.which === cm.keyCode.LEFT) {
        this._carousel.prev();
      }
      if (event.which === cm.keyCode.RIGHT) {
        this._carousel.next();
      }
    });
  },

  /**
   * @param {String} date
   * @returns Boolean
   */
  showPane: function(date) {
    var $element = this.$('.dateList > .date[data-date="' + date + '"]');
    if ($element.length) {
      this._carousel.showPane($element.index());
      return true;
    } else {
      return false;
    }
  },

  /**
   * @param {jQuery} $element
   */
  _onShowPane: function($element) {
    var title = $element.data('title');
    var url = $element.data('url');
    var menuEntryHash = $element.data('menu-entry-hash');
    var page = cm.findView('CM_Page_Abstract');

    cm.findView()._onPageSetup(this, title, url, [menuEntryHash]);
    this.trigger('swipe', $element);
  },

  _changeState: function(state) {
    if (state['date']) {
      this.showPane(state['date']);
    }
  }
});
{'fraction_non_alphanumeric': 0.17903808729496803, 'fraction_numerical': 0.0, 'mean_word_length': 2.980088495575221, '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': '3009403', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1207, 'n_words': 211}