<commit_before>window.AppView = Backbone.View.extend({
  el: $('#container'),
  
  initialize: function() {
    this.channelCollectionView = new ChannelCollectionView({
      collection: Channels
    }).render();
    
    this.relatedUsersView = new RelatedUsersView();
    this.channelView = new ChannelView();
    
    this.setupChannelReloading();
    
    if ( typeof currentChannel !== "undefined" ) {
      this.changeUser(currentChannel.user);
    } else {
      this.changeUser(currentUser);
    }
  },
  
  // TODO: This function needs to wait for loading (Of channel contents in main column)
  setupChannelReloading: function(){
    var args = arguments;
    setTimeout(function(){
      Channels.fetch({
        success: args.callee
      });
    }, 7000);
  },
  
  openChannel: function(channel) {
    var oldChannel = currentChannel;
    
    window.currentChannel = channel;
    
    if ( channel.user.id !== oldChannel.user.id ) {
      this.changeUser(channel.user);
      
      this.channelCollectionView.reload(currentChannel.id);
    }
    
    this.channelView = this.channelView.reInit({model: channel}).render();
    
    this.relatedUsersView
          .reInit({model:channel})
          .render();
    
    return this;
  },<commit_msg>start of generalization<commit_after>window.AppView = Backbone.View.extend({
  el: $('#container'),
  
  initialize: function() {
    this.channelCollectionView = new ChannelCollectionView({
      collection: Channels
    }).render();
    
    this.channelView = new ChannelView();
    this.views = [new RelatedUsersView()];
    
    this.setupChannelReloading();
    
    if ( typeof currentChannel !== "undefined" ) {
      this.changeUser(currentChannel.user);
    } else {
      this.changeUser(currentUser);
    }
  },
  
  // TODO: This function needs to wait for loading (Of channel contents in main column)
  setupChannelReloading: function(){
    var args = arguments;
    setTimeout(function(){
      Channels.fetch({
        success: args.callee
      });
    }, 7000);
  },
  
  openChannel: function(channel) {
    var oldChannel = currentChannel;
    
    window.currentChannel = channel;
    
    if ( channel.user.id !== oldChannel.user.id ) {
      this.changeUser(channel.user);
      
      this.channelCollectionView.reload(currentChannel.id);
    }
    
    for(var i = 0; i < this.views.length; i++){
      this.views[i] = this.views[i].reInit({model: channel});
      this.views[i].render();
    }
    
    this.channelView = this.channelView.reInit({model: channel}).render();
    
    return this;
  },
{'fraction_non_alphanumeric': 0.12900733874082657, 'fraction_numerical': 0.0034762456546929316, 'mean_word_length': 2.7, 'pattern_counts': {'":': 0, '<': 4, '<?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': '6815051', 'n_tokens_mistral': 759, 'n_tokens_neox': 752, 'n_words': 149}