<commit_before>angular
    .module('loadingOnAJAX', [])
    .config(function($httpProvider) {
        var numLoadings = 0;
        var loadingScreen = $('<div style="position:fixed;top:0;left:0;right:0;bottom:0;z-index:10000;background-color:gray;background-color:rgba(70,70,70,0.2);"><img style="position:absolute;top:50%;left:50%;" alt="" src="/img/fbLoading.gif" /></div>')
            .appendTo($('body')).hide();
        $httpProvider.responseInterceptors.push(function($q) {
            return function(promise) {
                numLoadings++;
                loadingScreen.show();
                function hideLoadingScreen() {
                    if (!(--numLoadings)) loadingScreen.hide();
                }
                return promise.then(function(response) {
                    hideLoadingScreen();
                    return response;
                }, function(response) {
                    hideLoadingScreen();
                    return $q.reject(response);
                });
            };
        });
    });

angular.module('globalErrors', []).config(function($provide, $httpProvider, $compileProvider) {
    $httpProvider.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
    $httpProvider.defaults.transformRequest.push(function(data, headersGetter) {
        // console.log(angular.toJson(headersGetter()));
        // Check if it is a post request. Mutations require authentication.
        if ((headersGetter()["Content-Type"] != null) && !isLoggedIn()) {
            // Temporarily disabling until this functionality is completed to allow for login.
            // alert("login required");
        }
        return data;
    });
    $httpProvider.responseInterceptors.push(function($rootScope, $timeout, $q) {
        return function(promise) {
            return promise.then(function(successResponse) {
                if (successResponse.config.method.toUpperCase() != 'GET' && !isExternal(successResponse.config.url)) {
                    $rootScope.showAlert("Saved successfully!", "success");
                }
                return successResponse;
            }, function(errorResponse) {
                if (!isExternal(errorResponse.config.url)) {
                    switch (errorResponse.status) {
                    case 400:
                        $rootScope.showAlert(errorResponse.data.error.message, "danger");
                        break;
                    case 401:
                        $rootScope.showAlert('Wrong usename or password', "danger");
                        break;
                    case 403:
                        $rootScope.showAlert('Permission denied', "danger");
                        break;
                    case 404:
                        $rootScope.showAlert('Failed to find resource: ' + errorResponse.data, "danger");
                        break;
                    case 500:
                        $rootScope.showAlert('Server internal error: ' + errorResponse.data, "danger");
                        break;
                    default:
                        $rootScope.showAlert('Error ' + errorResponse.status + ': ' + errorResponse.data, "danger");
                    }
                }
                return $q.reject(errorResponse);
            });
        };
    });
});
angular.module('HashBangURLs', []).config(['$locationProvider', function($location) {
  $location.hashPrefix('!');<commit_msg>Get rid of alerts on successful POST requests.<commit_after>angular
    .module('loadingOnAJAX', [])
    .config(function($httpProvider) {
        var numLoadings = 0;
        var loadingScreen = $('<div style="position:fixed;top:0;left:0;right:0;bottom:0;z-index:10000;background-color:gray;background-color:rgba(70,70,70,0.2);"><img style="position:absolute;top:50%;left:50%;" alt="" src="/img/fbLoading.gif" /></div>')
            .appendTo($('body')).hide();
        $httpProvider.responseInterceptors.push(function($q) {
            return function(promise) {
                numLoadings++;
                loadingScreen.show();
                function hideLoadingScreen() {
                    if (!(--numLoadings)) loadingScreen.hide();
                }
                return promise.then(function(response) {
                    hideLoadingScreen();
                    return response;
                }, function(response) {
                    hideLoadingScreen();
                    return $q.reject(response);
                });
            };
        });
    });

angular.module('globalErrors', []).config(function($provide, $httpProvider, $compileProvider) {
    $httpProvider.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
    $httpProvider.defaults.transformRequest.push(function(data, headersGetter) {
        // console.log(angular.toJson(headersGetter()));
        // Check if it is a post request. Mutations require authentication.
        if ((headersGetter()["Content-Type"] != null) && !isLoggedIn()) {
            // Temporarily disabling until this functionality is completed to allow for login.
            // alert("login required");
        }
        return data;
    });
    $httpProvider.responseInterceptors.push(function($rootScope, $timeout, $q) {
        return function(promise) {
            return promise.then(function(successResponse) {
                if (successResponse.config.method.toUpperCase() != 'GET' && !isExternal(successResponse.config.url)) {
                    // $rootScope.showAlert("Saved successfully!", "success");
                }
                return successResponse;
            }, function(errorResponse) {
                if (!isExternal(errorResponse.config.url)) {
                    switch (errorResponse.status) {
                    case 400:
                        $rootScope.showAlert(errorResponse.data.error.message, "danger");
                        break;
                    case 401:
                        $rootScope.showAlert('Wrong usename or password', "danger");
                        break;
                    case 403:
                        $rootScope.showAlert('Permission denied', "danger");
                        break;
                    case 404:
                        $rootScope.showAlert('Failed to find resource: ' + errorResponse.data, "danger");
                        break;
                    case 500:
                        $rootScope.showAlert('Server internal error: ' + errorResponse.data, "danger");
                        break;
                    default:
                        $rootScope.showAlert('Error ' + errorResponse.status + ': ' + errorResponse.data, "danger");
                    }
                }
                return $q.reject(errorResponse);
            });
        };
    });
});
angular.module('HashBangURLs', []).config(['$locationProvider', function($location) {
  $location.hashPrefix('!');
{'fraction_non_alphanumeric': 0.13122106481481483, 'fraction_numerical': 0.01099537037037037, 'mean_word_length': 1.7740770465489566, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2196168', 'n_tokens_mistral': 1787, 'n_tokens_neox': 1638, 'n_words': 286}