<commit_before>'use strict';

var loMod = angular.module('loApp.controllers.global', []);

loMod.controller('GlobalCtrl', function($log, $rootScope, $scope, $location, $route, LiveOak) {

  $log.debug('GlobalCtrl' + LiveOak);

  $rootScope.$on('$routeChangeError',
    /* Following function can get use of 'event, current, previous, rejection' arguments to specify the error */
    function () {
      $log.error('failed to change routes');
      $location.path('/error');
    });

  $rootScope.$on('$locationChangeSuccess', function() {
    $rootScope.oPath = $route.current.$$route.originalPath;
  });

  $rootScope.$on('$routeChangeSuccess', function() {
    delete $rootScope.hideSidebar;
  });
<commit_msg>LIVEOAK-511: Remove initial flashing of sidebar when first page has no sidebar<commit_after>'use strict';

var loMod = angular.module('loApp.controllers.global', []);

loMod.controller('GlobalCtrl', function($log, $rootScope, $scope, $location, $route, LiveOak) {

  $log.debug('GlobalCtrl' + LiveOak);

  $rootScope.$on('$routeChangeError',
    /* Following function can get use of 'event, current, previous, rejection' arguments to specify the error */
    function () {
      $log.error('failed to change routes');
      $location.path('/error');
    });

  // to avoid initial flashing of sidebar on non-sidebar pages
  $rootScope.hideSidebar = true;

  // originalPath is used to calculate the sidebar active element
  $rootScope.$on('$locationChangeSuccess', function() {
    $rootScope.oPath = $route.current.$$route.originalPath;
  });

  // so that it shows back when switching from non-sidebar to sidebar pages
  $rootScope.$on('$routeChangeSuccess', function() {
    delete $rootScope.hideSidebar;
  });

{'fraction_non_alphanumeric': 0.15063731170336037, 'fraction_numerical': 0.0017381228273464658, 'mean_word_length': 4.413793103448276, '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': '2399566', 'n_tokens_mistral': 522, 'n_tokens_neox': 499, 'n_words': 131}