<commit_before>'use strict';

angular.module('gonawingApp', [
  'ngSanitize',
  'ngRoute',
  'ngResource',
  'ngCookies',
  /* directives */
  'directive.googleplussignin',
  'directive.twittersignin',
  'directive.googlesignin',
  'directive.facebooksignin',
  'directive.formValidation',
  'directive.formFocus',
  'directive.joinButton',
  'directive.addButton',
  'directive.activities',
  'mgcrea.ngStrap',
  /* filters */
  'filter.fromNow',
  'filter.moment',
  'filter.reverse',
  /* controllers */
  'rootControllers',
  'navigationControllers',
  'dashboardControllers',
  'activitiesControllers',
  'userControllers',
  'teamControllers',
  'tournamentControllers',
  'inviteControllers',
  'searchControllers',
  /* services */
  'userService',
  'authService',
  'sessionService',
  'activitiesService',
  'inviteService',
  'teamService',
  'tournamentService'
]);

angular.module('gonawingApp').factory('notFoundInterceptor', ['$q', '$location', function($q, $location) {
  return {
    response: function(response) {
      return response || $q.when(response);
    },

    responseError: function(response) {
      if (response && response.status === 404) {
        $location.path('/404');
      }
      return $q.reject(response);
    }
  };
}]);

angular.module('gonawingApp').config(['$routeProvider', '$httpProvider',
  function($routeProvider, $httpProvider) {
    $routeProvider.
      when('/welcome', { templateUrl: 'components/home/welcome.html', requireLogin: false }).
      when('/getting-started', { templateUrl: 'components/home/getting-started.html', requireLogin: false }).
      when('/', { templateUrl:  'components/home/home.html', controller: 'RootCtrl', requireLogin: true }).
      when('/about', { templateUrl: 'shared/about.html', requireLogin: false }).
      when('/search', { templateUrl: 'components/search/search.html', controller: 'SearchCtrl', requireLogin: true }).

      when('/users/', { templateUrl: 'components/user/index.html', controller: 'UserListCtrl', requireLogin: true }).
      when('/users/:id', { templateUrl: 'components/user/show.html', controller: 'UserShowCtrl', requireLogin: true }).

      when('/teams', { templateUrl: 'components/team/index.html', controller: 'TeamListCtrl', requireLogin: true }).
      when('/teams/new', { templateUrl: 'components/team/new.html', controller: 'TeamNewCtrl', requireLogin: true }).
      when('/teams/:id', { templateUrl: 'components/team/show.html', controller: 'TeamShowCtrl', requireLogin: true }).
      when('/teams/edit/:id', { templateUrl: 'components/team/edit.html', controller: 'TeamEditCtrl', requireLogin: true }).
      when('/teams/invite/:id', { templateUrl: 'components/team/invite.html', controller: 'TeamInviteCtrl', requireLogin: true }).

      when('/tournaments', { templateUrl: 'components/tournament/index.html', controller: 'TournamentListCtrl', requireLogin: true }).
      when('/tournaments/new', { templateUrl: 'components/tournament/new.html', controller: 'TournamentNewCtrl', requireLogin: true }).
      when('/tournaments/:id', { templateUrl: 'components/tournament/show.html', controller: 'TournamentShowCtrl', requireLogin: true, reloadOnSearch: false }).
      when('/tournaments/edit/:id', { templateUrl: 'components/tournament/edit.html', controller: 'TournamentEditCtrl', requireLogin: true }).

      when('/settings/edit-profile', { templateUrl: 'components/user/edit.html', controller: 'UserEditCtrl', requireLogin: true }).
      when('/settings/networks', { templateUrl: 'components/settings/networks.html', requireLogin: true }).
      when('/settings/email', { templateUrl: 'components/settings/email.html', requireLogin: true }).
      when('/invite', { templateUrl: 'components/invite/invite.html', controller: 'InviteCtrl', requireLogin: true }).
      when('/404', { templateUrl: 'shared/404.html' }).
      otherwise( {redirectTo: '/'});

    $httpProvider.interceptors.push('notFoundInterceptor');
}]);

angular.module('gonawingApp').run(['$rootScope', '$location', '$window', '$cookieStore', 'sAuth', 'Session', 'User', function($rootScope, $location, $window, $cookieStore, sAuth, Session, User) {
    $rootScope.title = 'gonawin';

    $rootScope.currentUser = undefined;
    $rootScope.isLoggedIn = false;
    $rootScope.serviceIds = Session.serviceIds();

    $window.fbAsyncInit = function() {
      // Executed when the SDK is loaded
      $rootScope.serviceIds.$promise.then(function(response){
          FB.init({
        appId: response.FacebookAppId,
        channelUrl: 'app/shared/channel.html',
        status: true, /*Set if you want to check the authentication status at the start up of the app */
        cookie: true,
        xfbml: true<commit_msg>only load FB SDK once<commit_after>'use strict';

angular.module('gonawingApp', [
  'ngSanitize',
  'ngRoute',
  'ngResource',
  'ngCookies',
  /* directives */
  'directive.googleplussignin',
  'directive.twittersignin',
  'directive.googlesignin',
  'directive.facebooksignin',
  'directive.formValidation',
  'directive.formFocus',
  'directive.joinButton',
  'directive.addButton',
  'directive.activities',
  'mgcrea.ngStrap',
  /* filters */
  'filter.fromNow',
  'filter.moment',
  'filter.reverse',
  /* controllers */
  'rootControllers',
  'navigationControllers',
  'dashboardControllers',
  'activitiesControllers',
  'userControllers',
  'teamControllers',
  'tournamentControllers',
  'inviteControllers',
  'searchControllers',
  /* services */
  'userService',
  'authService',
  'sessionService',
  'activitiesService',
  'inviteService',
  'teamService',
  'tournamentService'
]);

angular.module('gonawingApp').factory('notFoundInterceptor', ['$q', '$location', function($q, $location) {
  return {
    response: function(response) {
      return response || $q.when(response);
    },

    responseError: function(response) {
      if (response && response.status === 404) {
        $location.path('/404');
      }
      return $q.reject(response);
    }
  };
}]);

angular.module('gonawingApp').config(['$routeProvider', '$httpProvider',
  function($routeProvider, $httpProvider) {
    $routeProvider.
      when('/welcome', { templateUrl: 'components/home/welcome.html', requireLogin: false }).
      when('/getting-started', { templateUrl: 'components/home/getting-started.html', requireLogin: false }).
      when('/', { templateUrl:  'components/home/home.html', controller: 'RootCtrl', requireLogin: true }).
      when('/about', { templateUrl: 'shared/about.html', requireLogin: false }).
      when('/search', { templateUrl: 'components/search/search.html', controller: 'SearchCtrl', requireLogin: true }).

      when('/users/', { templateUrl: 'components/user/index.html', controller: 'UserListCtrl', requireLogin: true }).
      when('/users/:id', { templateUrl: 'components/user/show.html', controller: 'UserShowCtrl', requireLogin: true }).

      when('/teams', { templateUrl: 'components/team/index.html', controller: 'TeamListCtrl', requireLogin: true }).
      when('/teams/new', { templateUrl: 'components/team/new.html', controller: 'TeamNewCtrl', requireLogin: true }).
      when('/teams/:id', { templateUrl: 'components/team/show.html', controller: 'TeamShowCtrl', requireLogin: true }).
      when('/teams/edit/:id', { templateUrl: 'components/team/edit.html', controller: 'TeamEditCtrl', requireLogin: true }).
      when('/teams/invite/:id', { templateUrl: 'components/team/invite.html', controller: 'TeamInviteCtrl', requireLogin: true }).

      when('/tournaments', { templateUrl: 'components/tournament/index.html', controller: 'TournamentListCtrl', requireLogin: true }).
      when('/tournaments/new', { templateUrl: 'components/tournament/new.html', controller: 'TournamentNewCtrl', requireLogin: true }).
      when('/tournaments/:id', { templateUrl: 'components/tournament/show.html', controller: 'TournamentShowCtrl', requireLogin: true, reloadOnSearch: false }).
      when('/tournaments/edit/:id', { templateUrl: 'components/tournament/edit.html', controller: 'TournamentEditCtrl', requireLogin: true }).

      when('/settings/edit-profile', { templateUrl: 'components/user/edit.html', controller: 'UserEditCtrl', requireLogin: true }).
      when('/settings/networks', { templateUrl: 'components/settings/networks.html', requireLogin: true }).
      when('/settings/email', { templateUrl: 'components/settings/email.html', requireLogin: true }).
      when('/invite', { templateUrl: 'components/invite/invite.html', controller: 'InviteCtrl', requireLogin: true }).
      when('/404', { templateUrl: 'shared/404.html' }).
      otherwise( {redirectTo: '/'});

    $httpProvider.interceptors.push('notFoundInterceptor');
}]);

angular.module('gonawingApp').run(['$rootScope', '$location', '$window', '$cookieStore', 'sAuth', 'Session', 'User', function($rootScope, $location, $window, $cookieStore, sAuth, Session, User) {
    $rootScope.title = 'gonawin';

    $rootScope.currentUser = undefined;
    $rootScope.isLoggedIn = false;
    $rootScope.serviceIds = Session.serviceIds();

    $window.fbAsyncInit = function() {
      // Executed when the SDK is loaded
      $rootScope.serviceIds.$promise.then(function(response){
          FB.init({
        appId: response.FacebookAppId,
        // channelUrl: 'app/shared/channel.html',
        status: true, /*Set if you want to check the authentication status at the start up of the app */
        cookie: true,
        xfbml: true
{'fraction_non_alphanumeric': 0.17034766987213357, 'fraction_numerical': 0.00253619359611117, 'mean_word_length': 4.377272727272727, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4637310', 'n_tokens_mistral': 2846, 'n_tokens_neox': 2793, 'n_words': 525}