<commit_before>// Import libraries
require('babel-polyfill');
const ng = require('angular');
require('angular-material');
require('angular-messages');
require('angular-route');
require('ng-file-upload');
require('angular-sortable-views');
require('angular-marked');
const Promise = require('bluebird');
Promise.config({warnings: false});
import {unescape as unescapeHTML} from 'lodash';

const CSRF_TOKEN = document.getElementById('csrf-token').innerHTML;
const APP_VERSION = document.getElementById('app-version').innerHTML;
const userData = JSON.parse(unescapeHTML(document.getElementById('user-data').innerHTML));

// Import modules
require('./login/login.module.js');
require('./home/home.module.js');
require('./box/box.module.js');
require('./pokemon/pokemon.module.js');
require('./add/add.module.js');
require('./userMenu/user.module.js');
require('./profile/profile.module.js');
require('./account/account.module.js');
require('./static/static.module.js');
require('./passwordReset/passwordReset.module.js');
require('./forgotPassword/forgotPassword.module.js');
require('./cloneList/cloneList.module.js');

const porybox = ng.module('porybox', [
  // Porybox modules
  'porybox.login',
  'porybox.home',
  'porybox.add',
  'porybox.profile',
  'porybox.account',
  'porybox.userMenu',
  'porybox.static',
  'porybox.passwordReset',
  'porybox.forgotPassword',
  'porybox.cloneList',

  // Third party
  'ngMaterial',
  'ngRoute',
  'angular-sortable-view',
  'hc.marked'
]);

porybox.controller('MainCtrl', function () {
  this.selected = {};
  Object.assign(this, userData);
  // TODO: Figure out a better way to do this
  const LOGGED_IN_ONLY_ROUTES = ['#/prefs', '', '#/'];
  const LOGGED_OUT_ONLY_ROUTES = ['#/login'];
  if (!this.user && location.pathname === '/' && LOGGED_IN_ONLY_ROUTES.includes(location.hash)) {
    location.hash = 'home';
  }
  if (this.user && location.pathname === '/' && LOGGED_OUT_ONLY_ROUTES.includes(location.hash)) {
    location.hash = '/';
  }
});

// Add a ?v=1.0.0 (e.g.) query to all requests for templates
// This avoids browser cache issues when the version number is bumped<commit_msg>Don't display the account settings page if the user isn't logged in<commit_after>// Import libraries
require('babel-polyfill');
const ng = require('angular');
require('angular-material');
require('angular-messages');
require('angular-route');
require('ng-file-upload');
require('angular-sortable-views');
require('angular-marked');
const Promise = require('bluebird');
Promise.config({warnings: false});
import {unescape as unescapeHTML} from 'lodash';

const CSRF_TOKEN = document.getElementById('csrf-token').innerHTML;
const APP_VERSION = document.getElementById('app-version').innerHTML;
const userData = JSON.parse(unescapeHTML(document.getElementById('user-data').innerHTML));

// Import modules
require('./login/login.module.js');
require('./home/home.module.js');
require('./box/box.module.js');
require('./pokemon/pokemon.module.js');
require('./add/add.module.js');
require('./userMenu/user.module.js');
require('./profile/profile.module.js');
require('./account/account.module.js');
require('./static/static.module.js');
require('./passwordReset/passwordReset.module.js');
require('./forgotPassword/forgotPassword.module.js');
require('./cloneList/cloneList.module.js');

const porybox = ng.module('porybox', [
  // Porybox modules
  'porybox.login',
  'porybox.home',
  'porybox.add',
  'porybox.profile',
  'porybox.account',
  'porybox.userMenu',
  'porybox.static',
  'porybox.passwordReset',
  'porybox.forgotPassword',
  'porybox.cloneList',

  // Third party
  'ngMaterial',
  'ngRoute',
  'angular-sortable-view',
  'hc.marked'
]);

porybox.controller('MainCtrl', function () {
  this.selected = {};
  Object.assign(this, userData);
  // TODO: Figure out a better way to do this
  const LOGGED_IN_ONLY_ROUTES = ['#/prefs', '#/account', '', '#/'];
  const LOGGED_OUT_ONLY_ROUTES = ['#/login'];
  if (!this.user && location.pathname === '/' && LOGGED_IN_ONLY_ROUTES.includes(location.hash)) {
    location.hash = 'home';
  }
  if (this.user && location.pathname === '/' && LOGGED_OUT_ONLY_ROUTES.includes(location.hash)) {
    location.hash = '/';
  }
});

// Add a ?v=1.0.0 (e.g.) query to all requests for templates
// This avoids browser cache issues when the version number is bumped
{'fraction_non_alphanumeric': 0.189126929278968, 'fraction_numerical': 0.00138217000691085, 'mean_word_length': 5.047353760445683, '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': '7339052', 'n_tokens_mistral': 1422, 'n_tokens_neox': 1411, 'n_words': 251}