<commit_before>angular.module('voxityChromeApp', [
    'ngRoute',
    'ui.bootstrap',
    'ui.bootstrap.tpls',
    'angular.filter',
    'voxity.core',
    'voxity.users',
    'voxity.channels',
    'voxity.devices',
    'voxity.contacts',
]);

angular.module('voxityChromeApp').factory('authInterceptorService', [
    '$q','$rootScope',
    function ($q, $rootScope){
        return {
            responseError: function (rejection) {
                if (rejection.status === 401) {$rootScope.$broadcast("API:err.401");}
                return $q.reject(rejection);
            }
        };
    }
]);

angular.module('voxityChromeApp').controller('sideBarCtrl', [
    '$scope', '$location', 'vxtApiUsers',
    function ($scope, $location, apiUsers) {
        $scope.activeItem = null;
        $scope.logOutProcess = false;
        $scope.user = {};
        $scope.initialized = false;


        function getMainEndpoint(uri){
            var hashTab = uri.split('#');
            if (hashTab.length == 2) {
                var main = hashTab[1];
                if (main[0] === '/'){
                    main = main.substring(1);
                }
                return main.split('/')[0];
            } else {
                return null;
            }
        }

        $scope.change = function(item){$scope.activeItem = item;}

        $scope.open = function(link){
            chrome.tabs.create({url: link});
            window.close();
        }

        $scope.logout = function(){
            this.logOutProcess = true;
            apiUsers.logout(function(err){
                if(err) {
                    this.logOutProcess = false;
                } else {
                    $location.path('/logout');
                }
            })
        }

        $scope.$on('api:user.updated', function(evt, usr){$scope.user = usr;});
        $scope.$on('api:users.userInitialised', function(){$scope.initialized = true;});

        $scope.$on('$locationChangeStart', function(e, next, curent){
            if (next.indexOf('#') > -1) {
                var nextAng = next.split('#')[1].split("/");                
                var curentAng = curent.split('#')[1].split("/");
                if (nextAng.length > 2) {
                    $scope.goBackPage = '#' + curentAng.join('/');
                } else {
                    $scope.goBackPage = undefined;
                }
            } else { $scope.goBackPage = undefined;}

            var main = getMainEndpoint(next);
            $scope.change(main);

        })

    }
]);

angular.module('voxityChromeApp').controller('viewCtrl', [
    '$scope', '$location', 'vxtApiUsers',
    function($scope, $location, apiUsers){
    var sideClass = "col-xs-2";
    var mainBodyClass = "col-xs-10 col-xs-offset-2";
    var bannerCallClass = "";
    var containerClass = "";
    var lockedScreen = false;

    $scope.signin = function(){
        apiUsers.init(function(err,usr){<commit_msg>hide sidebar on loanding app<commit_after>angular.module('voxityChromeApp', [
    'ngRoute',
    'ui.bootstrap',
    'ui.bootstrap.tpls',
    'angular.filter',
    'voxity.core',
    'voxity.users',
    'voxity.channels',
    'voxity.devices',
    'voxity.contacts',
]);

angular.module('voxityChromeApp').factory('authInterceptorService', [
    '$q','$rootScope',
    function ($q, $rootScope){
        return {
            responseError: function (rejection) {
                if (rejection.status === 401) {$rootScope.$broadcast("API:err.401");}
                return $q.reject(rejection);
            }
        };
    }
]);

angular.module('voxityChromeApp').controller('sideBarCtrl', [
    '$scope', '$location', 'vxtApiUsers',
    function ($scope, $location, apiUsers) {
        $scope.activeItem = null;
        $scope.logOutProcess = false;
        $scope.user = {};
        $scope.initialized = false;


        function getMainEndpoint(uri){
            var hashTab = uri.split('#');
            if (hashTab.length == 2) {
                var main = hashTab[1];
                if (main[0] === '/'){
                    main = main.substring(1);
                }
                return main.split('/')[0];
            } else {
                return null;
            }
        }

        $scope.change = function(item){$scope.activeItem = item;}

        $scope.open = function(link){
            chrome.tabs.create({url: link});
            window.close();
        }

        $scope.logout = function(){
            this.logOutProcess = true;
            apiUsers.logout(function(err){
                if(err) {
                    this.logOutProcess = false;
                } else {
                    $location.path('/logout');
                }
            })
        }

        $scope.$on('api:user.updated', function(evt, usr){$scope.user = usr;});
        $scope.$on('api:users.userInitialised', function(){$scope.initialized = true;});

        $scope.$on('$locationChangeStart', function(e, next, curent){
            if (next.indexOf('#') > -1) {
                var nextAng = next.split('#')[1].split("/");                
                var curentAng = curent.split('#')[1].split("/");
                if (nextAng.length > 2) {
                    $scope.goBackPage = '#' + curentAng.join('/');
                } else {
                    $scope.goBackPage = undefined;
                }
            } else { $scope.goBackPage = undefined;}

            var main = getMainEndpoint(next);
            $scope.change(main);

        })

    }
]);

angular.module('voxityChromeApp').controller('viewCtrl', [
    '$scope', '$location', 'vxtApiUsers',
    function($scope, $location, apiUsers){
    var sideClass = "hidden";
    var mainBodyClass = "col-xs-10 col-xs-offset-2";
    var bannerCallClass = "";
    var containerClass = "";
    var lockedScreen = false;

    $scope.signin = function(){
        apiUsers.init(function(err,usr){
{'fraction_non_alphanumeric': 0.16196111580726966, 'fraction_numerical': 0.006255283178360101, 'mean_word_length': 1.7657784011220197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4919729', 'n_tokens_mistral': 1778, 'n_tokens_neox': 1701, 'n_words': 277}