<commit_before>$(window).ready(
    function () {
        $("#json-input").linedtextarea();

        $("#json-input").bind('paste', function() {
            // Need a timeout since paste event does not give the content
            // of the clipboard.
            setTimeout(function(){
                validate_input($("#json-input").val());
            },100);
        });

        $("#json-input").blur(function() {
            validate_input($("#json-input").val());
        });

        $("#submit").attr("disabled", "disabled");

        validate_input($("#json-input").val());
    });

validate_input = function(json_input) {

    if ($("#json-input").val() != "") {
        if (is_url($("#json-input").val().split("\n"))) {
            load_url();
        } else {
            $("#json-input").val(js_beautify(json_input));
            validate_job_data(json_input);
        }
    }
}

load_url = function() {
    // Loads JSON content if URL is provided in the json text area.
    if ($("#json-input").val().split("\n").length == 1) {
        $.ajax({
            type: "POST",
            url: remote_json_url,
            data: {
                "url": $("#json-input").val().trim(),
                "csrfmiddlewaretoken": $("[name='csrfmiddlewaretoken']").val()
            },
            success: function(data) {
                try {
                    $.parseJSON(data);
                    $("#json-input").val(js_beautify(data));
                    validate_job_data(data);
                } catch (e) {
                    $("#json-valid-container").html("Invalid JSON: " + data);
                    valid_json_css(false);
                    $("#submit").attr("disabled", "disabled");
                }
            }});
    }
}

validate_job_data = function(data) {
    $.post(window.location.pathname,
           {"json-input": data,
            "csrfmiddlewaretoken": $("[name='csrfmiddlewaretoken']").val()},<commit_msg>Set beautify library options to expand braces.<commit_after>beautify_options = {
    "brace_style": "expand"
}

$(window).ready(
    function () {
        $("#json-input").linedtextarea();

        $("#json-input").bind('paste', function() {
            // Need a timeout since paste event does not give the content
            // of the clipboard.
            setTimeout(function(){
                validate_input($("#json-input").val());
            },100);
        });

        $("#json-input").blur(function() {
            validate_input($("#json-input").val());
        });

        $("#submit").attr("disabled", "disabled");

        validate_input($("#json-input").val());
    });

validate_input = function(json_input) {

    if ($("#json-input").val() != "") {
        if (is_url($("#json-input").val().split("\n"))) {
            load_url();
        } else {
            $("#json-input").val(js_beautify(json_input, beautify_options));
            validate_job_data(json_input);
        }
    }
}

load_url = function() {
    // Loads JSON content if URL is provided in the json text area.
    if ($("#json-input").val().split("\n").length == 1) {
        $.ajax({
            type: "POST",
            url: remote_json_url,
            data: {
                "url": $("#json-input").val().trim(),
                "csrfmiddlewaretoken": $("[name='csrfmiddlewaretoken']").val()
            },
            success: function(data) {
                try {
                    $.parseJSON(data);
                    $("#json-input").val(js_beautify(data, beautify_options));
                    validate_job_data(data);
                } catch (e) {
                    $("#json-valid-container").html("Invalid JSON: " + data);
                    valid_json_css(false);
                    $("#submit").attr("disabled", "disabled");
                }
            }});
    }
}

validate_job_data = function(data) {
    $.post(window.location.pathname,
           {"json-input": data,
            "csrfmiddlewaretoken": $("[name='csrfmiddlewaretoken']").val()},
{'fraction_non_alphanumeric': 0.18813854971343136, 'fraction_numerical': 0.00199352105656616, 'mean_word_length': 1.7855655794587093, 'pattern_counts': {'":': 9, '<': 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': '5394532', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1105, 'n_words': 180}