<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), true);
    }
  },

  ready: function() {
    this._onShowPaneSetUrlDelayed = _.debounce(this._onShowPaneSetUrl, 2000);

    var $carousel = this.$('.swipeCarousel');
    $carousel.removeClass('beforeload');
    this._carousel = new Carousel('.swipeCarousel');
    this._carousel.init();

    var self = this;
    this.on('destruct', function() {
      self._carousel.destroy();
    });
  },

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

  /**
   * @param {jQuery} $element
   * @param {Boolean} [delaySetUrl]
   */
  _onShowPane: function($element, delaySetUrl) {
    var title = $element.data('title');
    var url = $element.data('url');
    var date = $element.data('date');
    var menuEntryHash = $element.data('menu-hash');

    cm.findView()._onPageSetup(this, title, url, [menuEntryHash]);

    if (delaySetUrl) {
      this._onShowPaneSetUrlDelayed(url, date);
    } else {
      this._onShowPaneSetUrl(url, date);
    }

    this.trigger('swipe', $element);
  },

  /**
   * @param {String} url
   * @param {String} date
   */
  _onShowPaneSetUrl: function(url, date) {
    if (!document.contains(this.el)) {
      return; // View has been destroyed in the meantime
    }
    var nextState = {date: date};
    if (!_.isEqual(nextState, this.getState())) {
      cm.router.pushState(url);
      this.setState(nextState);
    }
  },

  _changeState: function(state) {
    var date = state['date'];
    if (!date) {
      date = this.$('.dateList > .date:first').data('date');
      this.setState({date: date});
    }
    return this.showPane(date);
  }
});
<commit_msg>Close all eventList children of events-page on "swipe"<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), true);
    }
  },

  ready: function() {
    this._onShowPaneSetUrlDelayed = _.debounce(this._onShowPaneSetUrl, 2000);

    var $carousel = this.$('.swipeCarousel');
    $carousel.removeClass('beforeload');
    this._carousel = new Carousel('.swipeCarousel');
    this._carousel.init();

    var self = this;
    this.on('destruct', function() {
      self._carousel.destroy();
    });

    this.on('swipe', function() {
      _.each(this.getChildren('Denkmal_Component_EventList'), function(eventListView) {
        eventListView.closeAllEvents();
      });
    });
  },

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

  /**
   * @param {jQuery} $element
   * @param {Boolean} [delaySetUrl]
   */
  _onShowPane: function($element, delaySetUrl) {
    var title = $element.data('title');
    var url = $element.data('url');
    var date = $element.data('date');
    var menuEntryHash = $element.data('menu-hash');

    cm.findView()._onPageSetup(this, title, url, [menuEntryHash]);

    if (delaySetUrl) {
      this._onShowPaneSetUrlDelayed(url, date);
    } else {
      this._onShowPaneSetUrl(url, date);
    }

    this.trigger('swipe', $element);
  },

  /**
   * @param {String} url
   * @param {String} date
   */
  _onShowPaneSetUrl: function(url, date) {
    if (!document.contains(this.el)) {
      return; // View has been destroyed in the meantime
    }
    var nextState = {date: date};
    if (!_.isEqual(nextState, this.getState())) {
      cm.router.pushState(url);
      this.setState(nextState);
    }
  },

  _changeState: function(state) {
    var date = state['date'];
    if (!date) {
      date = this.$('.dateList > .date:first').data('date');
      this.setState({date: date});
    }
    return this.showPane(date);
  }
});

{'fraction_non_alphanumeric': 0.1695487136229439, 'fraction_numerical': 0.001687051876845213, 'mean_word_length': 3.0229007633587788, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5518084', 'n_tokens_mistral': 1619, 'n_tokens_neox': 1579, 'n_words': 294}