<commit_before>'use strict';

/* Controllers */

angular.module('myApp.controllers', []).
controller('MainCtrl', function($scope, $http) {
    $scope.parseOriginalUrlStatus = 'waiting';
    $scope.done_scraping_original_url = false;

    $scope.statusCodeResult = function(statusCode) {
        if (statusCode === undefined) {
            return undefined;
        }
        if (statusCode === 200) {
            return true;
        }
        return false;
    };

    $scope.startRunningTest = function() {
        $scope.linksInfo = [];
        $scope.parseOriginalUrlStatus = 'calling';
        $http.get('/slurp', {
            params: {
                url_to_scrape: $scope.url_to_scrape
            }
        })
            .success(function(data) {
                console.log(data);
                if (!data.success) {
                    console.log('no success');
                    $scope.parseOriginalUrlStatus = 'invalid';
                } else {
                    $scope.parseOriginalUrlStatus = 'waiting';
                    $scope.done_scraping_original_url = true;
                    $scope.externalWebSiteJSON = angular.toJson(data, true);
                    if (data.success) {
                        var links = data.links;
                        var linksInfo = [];
                        for (var i = 0; i < links.length; i++) {
                            linksInfo.push({
                                href: links[i],
                                checkResult: undefined,
                            });
                        }
                        $scope.retrieved_urls = linksInfo;
                        for (var i = 0; i < linksInfo.length; i++) {
                            $scope.checkUrl(i);
                        }
                    }
                }

            });
    };
    $scope.checkUrl = function(url_to_check_index) {
        console.log("checking ", $scope.retrieved_urls[url_to_check_index].href);
        $http.get('/check', {
            params: {
                url_to_check: $scope.retrieved_urls[url_to_check_index].href
            }
        })
            .success(function(data) {
                $scope.retrieved_urls[url_to_check_index].checkResult = data;
            })
    }
});<commit_msg>hide stuff when calling server<commit_after>'use strict';

/* Controllers */

angular.module('myApp.controllers', []).
controller('MainCtrl', function($scope, $http) {
    $scope.parseOriginalUrlStatus = 'waiting';
    $scope.done_scraping_original_url = false;

    $scope.statusCodeResult = function(statusCode) {
        if (statusCode === undefined) {
            return undefined;
        }
        if (statusCode === 200) {
            return true;
        }
        return false;
    };

    $scope.startRunningTest = function() {
		$scope.done_scraping_original_url = false;
        $scope.linksInfo = [];
        $scope.parseOriginalUrlStatus = 'calling';
        $http.get('/slurp', {
            params: {
                url_to_scrape: $scope.url_to_scrape
            }
        })
            .success(function(data) {
                console.log(data);
                if (!data.success) {
                    console.log('no success');
                    $scope.parseOriginalUrlStatus = 'invalid';
                } else {
                    $scope.parseOriginalUrlStatus = 'waiting';
                    $scope.done_scraping_original_url = true;
                    $scope.externalWebSiteJSON = angular.toJson(data, true);
                    if (data.success) {
                        var links = data.links;
                        var linksInfo = [];
                        for (var i = 0; i < links.length; i++) {
                            linksInfo.push({
                                href: links[i],
                                checkResult: undefined,
                            });
                        }
                        $scope.retrieved_urls = linksInfo;
                        for (var i = 0; i < linksInfo.length; i++) {
                            $scope.checkUrl(i);
                        }
                    }
                }

            });
    };
    $scope.checkUrl = function(url_to_check_index) {
        console.log("checking ", $scope.retrieved_urls[url_to_check_index].href);
        $http.get('/check', {
            params: {
                url_to_check: $scope.retrieved_urls[url_to_check_index].href
            }
        })
            .success(function(data) {
                $scope.retrieved_urls[url_to_check_index].checkResult = data;
            })
    }
});

{'fraction_non_alphanumeric': 0.11387746265425416, 'fraction_numerical': 0.002164970772894566, 'mean_word_length': 1.266928361138371, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1639646', 'n_tokens_mistral': 1260, 'n_tokens_neox': 1192, 'n_words': 186}