<commit_before>window.AutoloadingCompositeView = Backbone.Marionette.CompositeView.extend({
  constructor: function(options){
    Backbone.Marionette.CompositeView.prototype.constructor.apply(this, arguments);
    this.collection.loadMore();
  },


  loadMore: function() {
    if ( this.bottomOfViewReached()) {
      this.collection.loadMore();
    }
  },

  bottomOfViewReached: function() {
    var bottomOfTheViewport = window.pageYOffset + window.innerHeight;
    var bottomOfEl = this.$el.offset().top + this.$el.outerHeight();

    if ( bottomOfEl < bottomOfTheViewport ) {
      return true;
    } else if ($(document).height() - ($(window).scrollTop() + $(window).height()) < 700) {
      return true;
    } else {
      return false;
    }
  },

  bindScroll: function() {
    this.unbindScroll();
    $(window).on('scroll.' + this.cid, _.bind(function MCBiggah() {
      this.loadMore();
    }, this));
  },

  unbindScroll: function() {
    $(window).off('scroll.' + this.cid);
  },

  close: function() {
    Backbone.Marionette.CompositeView.prototype.close.apply(this, arguments);
    this.unbindScroll();
  },


  onRender: function() {
    this.bindScroll();

    if (this.collection.length === 0 && !this.collection._loading) {
      this.showEmpty();
    }
  },


  beforeReset: function(e){
    this.collection.stopLoading();
  },

  afterAdd: function () {
    this.hideEmpty();
  },

  showEmpty: function(){},
  hideEmpty: function(){}

});<commit_msg>proper inheriting for the autoloading composite view<commit_after>window.AutoloadingCompositeView = Backbone.Marionette.CompositeView.extend({
  constructor: function(options){
    Backbone.Marionette.CompositeView.prototype.constructor.apply(this, arguments);
    this.collection.loadMore();
    this.on('add', _.bind(function(){
      this.hideEmpty();
    },this));
  },


  bottomOfViewReached: function() {
    var bottomOfTheViewport = window.pageYOffset + window.innerHeight;
    var bottomOfEl = this.$el.offset().top + this.$el.outerHeight();

    if ( bottomOfEl < bottomOfTheViewport ) {
      return true;
    } else if ($(document).height() - ($(window).scrollTop() + $(window).height()) < 700) {
      return true;
    } else {
      return false;
    }
  },

  bindScroll: function() {
    this.unbindScroll();
    $(window).on('scroll.' + this.cid, _.bind(function MCBiggah() {
      if ( this.bottomOfViewReached()) {
        this.collection.loadMore();
      }
    }, this));
  },

  unbindScroll: function() {
    $(window).off('scroll.' + this.cid);
  },

  close: function() {
    Backbone.Marionette.CompositeView.prototype.close.apply(this, arguments);
    this.unbindScroll();
  },

  render: function() {
    Backbone.Marionette.CompositeView.prototype.render.apply(this, arguments);
    this.bindScroll();

    if (this.collection.length === 0 && !this.collection._loading) {
      this.showEmpty();
    }
  },


  reset: function(e){
    this.collection.stopLoading();
    Backbone.Marionette.CompositeView.prototype.reset.apply(this, arguments);
  },

  showEmpty: function(){},
  hideEmpty: function(){}

});
{'fraction_non_alphanumeric': 0.16286540314808867, 'fraction_numerical': 0.00256986829424992, 'mean_word_length': 3.3983050847457625, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '1886067', 'n_tokens_mistral': 1000, 'n_tokens_neox': 963, 'n_words': 156}