<commit_before>'use strict';

////////////////////////////////////////////////////////////////////////////////////////////////////
function QForms(data) {
    if (data) {
        QForms.env = data.env;
    }
    window.onerror = QForms.errorHandler;
    //window.onbeforeunload = QForms.exit;
};

////////////////////////////////////////////////////////////////////////////////////////////////////
QForms.exit = function (evt) {
    var message = 'After refreshing or closing of page, all opened pages and unsaved data will be lost.';
    if (typeof evt === 'undefined') {
        evt = window.event;
    }
    if (evt) {
        evt.returnValue = message;
    }
    return message;
};

////////////////////////////////////////////////////////////////////////////////////////////////////
QForms.errorHandler = function(errorMsg) {
    var msg;
    if (QForms.env === 'development') {
        msg = 'QForms Error Handler:\n' + errorMsg;
        if (arguments[4] !== undefined && arguments[4].stack !== undefined) {
            msg += '\n\nstack:\n' + arguments[4].stack;
        }
    } else {
        msg = errorMsg;
    }
    alert(msg);
};

////////////////////////////////////////////////////////////////////////////////////////////////////
QForms.doHttpRequest = function(self, data, callback) {
    var contentType = data instanceof FormData ? false : 'application/json; charset=UTF-8';
    var _data       = data instanceof FormData ? data  : JSON.stringify(data);
    $.ajax({
        url        : window.location.href,
        type       : 'POST',
        data       : _data,
        contentType: contentType,
        processData: false,
        cache      : false,
        success: function(data, textStatus, jqXHR) {
            callback.call(self, data);
        },
        error: function(jqXHR, textStatus, errorThrown) {
            if (QForms.env === 'development') {
                throw new Error(jqXHR.statusText + ', ' + jqXHR.responseText);
            } else {
                throw new Error(jqXHR.responseText);
            }
        }
    });
};

////////////////////////////////////////////////////////////////////////////////////////////////////
QForms.go = function(url, method, params) {<commit_msg>wait cursor on http request<commit_after>'use strict';

////////////////////////////////////////////////////////////////////////////////////////////////////
function QForms(data) {
    if (data) {
        QForms.env = data.env;
    }
    window.onerror = QForms.errorHandler;
    //window.onbeforeunload = QForms.exit;
};

////////////////////////////////////////////////////////////////////////////////////////////////////
QForms.exit = function (evt) {
    var message = 'After refreshing or closing of page, all opened pages and unsaved data will be lost.';
    if (typeof evt === 'undefined') {
        evt = window.event;
    }
    if (evt) {
        evt.returnValue = message;
    }
    return message;
};

////////////////////////////////////////////////////////////////////////////////////////////////////
QForms.errorHandler = function(errorMsg) {
    var msg;
    if (QForms.env === 'development') {
        msg = 'QForms Error Handler:\n' + errorMsg;
        if (arguments[4] !== undefined && arguments[4].stack !== undefined) {
            msg += '\n\nstack:\n' + arguments[4].stack;
        }
    } else {
        msg = errorMsg;
    }
    alert(msg);
};

////////////////////////////////////////////////////////////////////////////////////////////////////
QForms.doHttpRequest = function(self, data, callback) {
    var contentType = data instanceof FormData ? false : 'application/json; charset=UTF-8';
    var _data       = data instanceof FormData ? data  : JSON.stringify(data);
    $('#client').css('cursor', 'wait');
    $.ajax({
        url        : window.location.href,
        type       : 'POST',
        data       : _data,
        contentType: contentType,
        processData: false,
        cache      : false,
        success: function(data, textStatus, jqXHR) {
            $('#client').css('cursor', 'default');
            callback.call(self, data);
        },
        error: function(jqXHR, textStatus, errorThrown) {
            $('#client').css('cursor', 'default');
            if (QForms.env === 'development') {
                throw new Error(jqXHR.statusText + ', ' + jqXHR.responseText);
            } else {
                throw new Error(jqXHR.responseText);
            }
        }
    });
};

////////////////////////////////////////////////////////////////////////////////////////////////////
QForms.go = function(url, method, params) {
{'fraction_non_alphanumeric': 0.3245880312228968, 'fraction_numerical': 0.0017346053772766695, 'mean_word_length': 1.1199448529411764, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6434762', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1105, 'n_words': 260}