<commit_before>'use strict';

var Backbone = require('backbone');
var $ =        require('jquery');

var App = require('./app');

Backbone.$ = $;

// Views
var NavView =     require('./views/navigation');
var TitleView =   require('./views/title');
var CurrentView = require('./views/current');
var HistoryView = require('./views/history');

module.exports = Backbone.Router.extend({

  routes: {
    '': 'index',
    title: 'title',
    current: 'current',
    history: 'history'
  },

  index: function() {
    if (!App.nav) {
      App.nav = new NavView({});
      App.showNavigation(App.nav);
    }
  },

  title: function() {
    App.showBody(new TitleView({}));
  },

  current: function() {
    App.showBody(new CurrentView({}));
  },

  history: function() {
    App.showBody(new HistoryView({}));
  }

});
<commit_msg>Ensure navigation continues to display on page refresh.<commit_after>'use strict';

var Backbone = require('backbone');
var $ =        require('jquery');

var App = require('./app');

Backbone.$ = $;

// Views
var NavView =     require('./views/navigation');
var TitleView =   require('./views/title');
var CurrentView = require('./views/current');
var HistoryView = require('./views/history');

module.exports = Backbone.Router.extend({

  routes: {
    '': 'title',
    title: 'title',
    current: 'current',
    history: 'history'
  },

  title: function() {
    this.ensureNav();
    App.showBody(new TitleView({}));
  },

  current: function() {
    this.ensureNav();
    App.showBody(new CurrentView({}));
  },

  history: function() {
    this.ensureNav();
    App.showBody(new HistoryView({}));
  },

  /**
   * Ensure that the navigation view is displayed.
   * This is mostly to ensure that navigation doesn't disappear if a page
   * is manually refreshed (with its '#page' URL)
   */
  ensureNav: function() {
    if (!App.nav) {
      App.nav = new NavView({});
      App.showNavigation(App.nav);
    }
  }

});

{'fraction_non_alphanumeric': 0.18330773169482847, 'fraction_numerical': 0.0, 'mean_word_length': 3.1136842105263156, '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': '1508954', 'n_tokens_mistral': 620, 'n_tokens_neox': 610, 'n_words': 144}