<commit_before>var app = angular.module('alexChrome', ['ngRoute', 'ngCookies']);

app.factory('Lessons', function ($http) {
    return {
        findLessons: function () {
            return $http({
                url: 'http://cnu247br3h.nsn-intra.net:3000/lessons',
                data: {},
                method: 'POST'
            });
        },
        findWords: function (lessonId) {
            return $http({
                url: 'http://cnu247br3h.nsn-intra.net:3000/words',
                data: {
                    lessonId: lessonId
                },
                method: 'POST'
            });
        }
    };
});

app.factory('Auth', function ($cookies) {
    return {
        isLoggedIn: function () {
            console.log($cookies);
            return 0;
        }
    };
});

app.directive('lessons', function (Lessons, Auth) {
    return {
        restrict: 'E',
        scope: {
            lesson: "="
        },
        template: '<div class="row"><div class="col-md-2">Select lesson:<select ng-model="lesson" class="lesson-selector col-md-12" ng-options="l as l for l in lessons" ></select></div>',
        link: function (scope) {
            Auth.isLoggedIn();
            Lessons.findLessons().then(function (res) {
                scope.lessons = res.data;
                scope.lesson = scope.lessons[0];
            });
        }
    };
});

app.controller('MainCtrl', function ($scope, Lessons) {
    $scope.lesson = '';
    $scope.getWords = function () {
        Lessons.findWords($scope.lesson).then(function (res) {
            chrome.tabs.getSelected(null, function (tab) {
                chrome.tabs.sendMessage(tab.id, {words: res.data });
            });
        });
    };
});

app.config(['$routeProvider', '$httpProvider', function ($routeProvider, $httpProvider) {

    $routeProvider
        .when('/', {
            controller: 'MainCtrl',
            templateUrl: 'main.html'
        }).
        when('/login', {
            controller: 'LoginCtrl',<commit_msg>[alex-chrome] JSHint fixes<commit_after>var app = angular.module('alexChrome', ['ngRoute', 'ngCookies']);

app.factory('Lessons', function ($http) {
    return {
        findLessons: function () {
            return $http({
                url: 'http://cnu247br3h.nsn-intra.net:3000/lessons',
                data: {},
                method: 'POST'
            });
        },
        findWords: function (lessonId) {
            return $http({
                url: 'http://cnu247br3h.nsn-intra.net:3000/words',
                data: {
                    lessonId: lessonId
                },
                method: 'POST'
            });
        }
    };
});

app.directive('lessons', function (Lessons) {
    return {
        restrict: 'E',
        scope: {
            lesson: "="
        },
        template: '<div class="row"><div class="col-md-2">Select lesson:<select ng-model="lesson" class="lesson-selector col-md-12" ng-options="l as l for l in lessons" ></select></div>',
        link: function (scope) {
            Lessons.findLessons().then(function (res) {
                scope.lessons = res.data;
                scope.lesson = scope.lessons[0];
            });
        }
    };
});

app.controller('MainCtrl', function ($scope, Lessons) {
    $scope.lesson = '';
    $scope.getWords = function () {
        Lessons.findWords($scope.lesson).then(function (res) {
            chrome.tabs.getSelected(null, function (tab) {
                chrome.tabs.sendMessage(tab.id, {words: res.data });
            });
        });
    };
});

app.config(['$routeProvider', '$httpProvider', function ($routeProvider, $httpProvider) {

    $routeProvider
        .when('/', {
            controller: 'MainCtrl',
            templateUrl: 'main.html'
        }).
        when('/login', {
            controller: 'LoginCtrl',
{'fraction_non_alphanumeric': 0.16120644825793032, 'fraction_numerical': 0.010660426417056681, 'mean_word_length': 1.7168079096045197, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '6517476', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1120, 'n_words': 196}