<commit_before>(function(config, models, views, routers, utils, templates) {

// This is the top-level piece of UI.

views.Application = Backbone.View.extend({

  // Events
  // ------

  events: {
    'click .toggle-view': 'toggleView'
  },

  toggleView: function (e) {
    e.preventDefault();
    e.stopPropagation();
    
    var link  = $(e.currentTarget),
        route = link.attr('href').replace(/^\//, '');
    
    $('.toggle-view.active').removeClass('active');
    link.addClass('active');
    router.navigate(route, true);
  },


  // Initialize
  // ----------

  initialize: function () {
    _.bindAll(this);
    this.header = new views.Header({model: this.model});
  },

  // Should be rendered just once
  render: function () {
    $(this.header.render().el).prependTo(this.el);
    return this;
  },


  // Helpers
  // -------

  replaceMainView: function (name, view) {
    $('body').removeClass().addClass('current-view '+name);
    if (this.mainView) {
      this.mainView.remove();
    }
    this.mainView = view;
    $(view.el).appendTo(this.$('#main'));
  },


  // Main Views
  // ----------

  posts: function (username, repo, branch, path) {
    loadSite(username, repo, branch, path, _.bind(function (err, data) {
      if (err) return alert('Seems like the chosen repository is not a valid Jekyll site.');
      this.header.render();
      this.replaceMainView("posts", new views.Posts({ model: data, id: 'posts' }).render());
    }, this));
  },

  post: function (username, repo, branch, path, file) {
    loadPost(username, repo, branch, path, file, _.bind(function (err, data) {
      this.header.render();
      this.replaceMainView("posts", new views.Post({ model: data, id: 'post' }).render());
    }, this));
  },

  newPost: function (username, repo, branch, path) {
    this.header.render();
    this.replaceMainView("new_post", new views.NewPost({id: "new_post", model: {repo: repo, path: path}}).render());
  },

  start: function() {
    this.header.render();
    this.replaceMainView("start", new views.Start({id: "start", model: {authenticated: authenticated()}}).render());
  }

});

}).apply(this, window.args);<commit_msg>Update site data when loading a post.<commit_after>(function(config, models, views, routers, utils, templates) {

// This is the top-level piece of UI.

views.Application = Backbone.View.extend({

  // Events
  // ------

  events: {
    'click .toggle-view': 'toggleView'
  },

  toggleView: function (e) {
    e.preventDefault();
    e.stopPropagation();
    
    var link  = $(e.currentTarget),
        route = link.attr('href').replace(/^\//, '');
    
    $('.toggle-view.active').removeClass('active');
    link.addClass('active');
    router.navigate(route, true);
  },


  // Initialize
  // ----------

  initialize: function () {
    _.bindAll(this);
    this.header = new views.Header({model: this.model});
  },

  // Should be rendered just once
  render: function () {
    $(this.header.render().el).prependTo(this.el);
    return this;
  },


  // Helpers
  // -------

  replaceMainView: function (name, view) {
    $('body').removeClass().addClass('current-view '+name);
    if (this.mainView) {
      this.mainView.remove();
    }
    this.mainView = view;
    $(view.el).appendTo(this.$('#main'));
  },


  // Main Views
  // ----------

  posts: function (username, repo, branch, path) {
    loadSite(username, repo, branch, path, _.bind(function (err, data) {
      if (err) return alert('Seems like the chosen repository is not a valid Jekyll site.');
      this.header.render();
      this.replaceMainView("posts", new views.Posts({ model: data, id: 'posts' }).render());
    }, this));
  },

  post: function (username, repo, branch, path, file) {
    loadSite(username, repo, branch, path, _.bind(function (err, data) {
      if (err) return alert('Seems like the chosen repository is not a valid Jekyll site.');
      loadPost(username, repo, branch, path, file, _.bind(function (err, data) {
        this.header.render();
        this.replaceMainView("posts", new views.Post({ model: data, id: 'post' }).render());
      }, this));
      this.header.render();
    }, this));
  },

  newPost: function (username, repo, branch, path) {
    this.header.render();
    this.replaceMainView("new_post", new views.NewPost({id: "new_post", model: {repo: repo, path: path}}).render());
  },

  start: function() {
    this.header.render();
    this.replaceMainView("start", new views.Start({id: "start", model: {authenticated: authenticated()}}).render());
  }

});

}).apply(this, window.args);
{'fraction_non_alphanumeric': 0.19550512764564695, 'fraction_numerical': 0.0, 'mean_word_length': 2.9483204134366927, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4014681', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1427, 'n_words': 342}