<commit_before>/**
 * Novo SGA - Main script
 * @author <NAME> <<EMAIL>>
 */
var App = {
    
    version: 0,
    module: '',
    paused: false,
    updateInterval: 6000,
    dateFormat: '',
    baseUrl: '/',
    
    Storage: {
        
        set: function(name, value) {
            if (localStorage) {
                localStorage.setItem(name, value);
            } else {
                // cookie
                var expires = "";
                document.cookie = name + "=" + value + expires + "; path=/";
            }
        },
                
        get: function(name) {
            if (localStorage) {
                return localStorage.getItem(name);
            } else {
                // cookie
                var nameEQ = name + "=";
                var ca = document.cookie.split(';');
                for(var i = 0; i < ca.length; i++) {
                    var c = ca[i];
                    while (c.charAt(0) === ' ') {
                        c = c.substring(1,c.length);
                    }
                    if (c.indexOf(nameEQ) === 0) {
                        return c.substring(nameEQ.length, c.length);
                    }
                }
            }
            return null;
        }
    },
    
    dialogs: {
        
        opened: 0,
        
    },
    
    url: function(url) {    
        return App.baseUrl + url;
    },
        
    reload: function() {
        window.location = window.location;
    },
    
    showErrorDialog: function (response) {
        $('#error-modal')
            .data('sessionStatus', response.sessionStatus)
            .modal('show')
            .find('.modal-body>p')
                .text(response.message);
    },
    
    /* jQuery ajax wrapper */
    ajax: function(arg) {
        $('#ajax-loading').show();
        var data = arg.data || {},
            method = arg.type || 'get';
        
        if (method != 'get') {
            data = JSON.stringify(data);
        }
        
        $.ajax({
            url: arg.url,
            data: data,
            type: method,
            dataType: arg.dataType || 'json',
            contentType: "application/json",
            cache: false,
            success: function(response) {
                if (response && response.success) {
                    var fn = arg.success;
                    if (fn && typeof(fn) === 'function') {
                        fn(response);
                    }
                } else {
                    App.showErrorDialog(response);
                }
                if (response.time) {
                    App.Clock.update(response.time);
                }
            },
            error: function(jqXHR, textStatus, errorThrown) {<commit_msg>returning ajax<commit_after>/**
 * Novo SGA - Main script
 * @author <NAME> <<EMAIL>>
 */
var App = {
    
    version: 0,
    module: '',
    paused: false,
    updateInterval: 6000,
    dateFormat: '',
    baseUrl: '/',
    
    Storage: {
        
        set: function(name, value) {
            if (localStorage) {
                localStorage.setItem(name, value);
            } else {
                // cookie
                var expires = "";
                document.cookie = name + "=" + value + expires + "; path=/";
            }
        },
                
        get: function(name) {
            if (localStorage) {
                return localStorage.getItem(name);
            } else {
                // cookie
                var nameEQ = name + "=";
                var ca = document.cookie.split(';');
                for(var i = 0; i < ca.length; i++) {
                    var c = ca[i];
                    while (c.charAt(0) === ' ') {
                        c = c.substring(1,c.length);
                    }
                    if (c.indexOf(nameEQ) === 0) {
                        return c.substring(nameEQ.length, c.length);
                    }
                }
            }
            return null;
        }
    },
    
    dialogs: {
        
        opened: 0,
        
    },
    
    url: function(url) {    
        return App.baseUrl + url;
    },
        
    reload: function() {
        window.location = window.location;
    },
    
    showErrorDialog: function (response) {
        $('#error-modal')
            .data('sessionStatus', response.sessionStatus)
            .modal('show')
            .find('.modal-body>p')
                .text(response.message);
    },
    
    /* jQuery ajax wrapper */
    ajax: function(arg) {
        $('#ajax-loading').show();
        var data = arg.data || {},
            method = arg.type || 'get';
        
        if (method != 'get') {
            data = JSON.stringify(data);
        }
        
        return $.ajax({
            url: arg.url,
            data: data,
            type: method,
            dataType: arg.dataType || 'json',
            contentType: "application/json",
            cache: false,
            success: function(response) {
                if (response && response.success) {
                    var fn = arg.success;
                    if (fn && typeof(fn) === 'function') {
                        fn(response);
                    }
                } else {
                    App.showErrorDialog(response);
                }
                if (response.time) {
                    App.Clock.update(response.time);
                }
            },
            error: function(jqXHR, textStatus, errorThrown) {
{'fraction_non_alphanumeric': 0.12970405553525757, 'fraction_numerical': 0.003653635367190354, 'mean_word_length': 1.025527192008879, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6491947', 'n_tokens_mistral': 1499, 'n_tokens_neox': 1419, 'n_words': 292}