<commit_before><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="popup_setup.jsp"/>

<script type="text/javascript">
    function getSelectedFileValue() {
        return $('#selectFile').val();
    }

    function notAllFilesDownloaded() {
        return $(".not-downloaded:visible").length > 0;
    }

    function hideNotDownloadedNote(prefix) {
        $("#" + prefix + "not-downloaded").hide();
        $("#" + prefix + "downloaded").text("Changed file downloaded.");
        showWarningIfNotAllFilesDownloaded();
    }

    function showWarningIfNotAllFilesDownloaded() {
        var warningElement = $("#not-downloaded-files-present");
        if (notAllFilesDownloaded()) {
            warningElement.show();
        } else {
            warningElement.hide();
        }
    }

    function anyFileSelected() {
        return $('input[name=selectedUserFile]:checked').length > 0;
    }
    function anyTwoFilesSelected() {
        return $('input[name=selectedUserFile]:checked').length > 1;
    }

    function showStartWebformArea() {
        $("#startWebformArea").show();
    }

    function hideFilesTableIfNoFilesPresent() {
        if (!$("tr.user_file").length) {
            $("div.files").hide();
        }
    }

    function disableActionButtonsIfNoFilesSelected() {
        $("#removeButton").prop('disabled', !anyFileSelected());
    }

    function disableMergeButtonIfNoFilesSelected() {
        $("#mergeButton").prop('disabled', !anyTwoFilesSelected());
    }

    var init = function() {
        $("#uploadButton").click(function () {
            $("#startWebformArea").hide();
            $("#userFile").click().change(function () {
                $("#newFileSubmit").click();
            });
        });
        hideFilesTableIfNoFilesPresent();
        $("#startWebformArea").hide();
        showWarningIfNotAllFilesDownloaded();
        $("#mergeButton").click(function () {
            var actionForm = $("form#actionForm");
            actionForm.attr("action", "<c:url value="/download/merge/files"/>");
            actionForm.submit();
        });
        disableActionButtonsIfNoFilesSelected();
        disableMergeButtonIfNoFilesSelected();

        var onSelectFile = function() {
            disableActionButtonsIfNoFilesSelected();
            disableMergeButtonIfNoFilesSelected();
        }
        $('input[name=selectedUserFile]').change(onSelectFile);
    };

    $(init);

    function showJson(downloadLink) {
        viewFileSource(downloadLink, {headers: {Accept: "application/json"}});
    }

    function showJsonToXml(downloadLink) {<commit_msg>Refs #17488. Added termination to statement<commit_after><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="popup_setup.jsp"/>

<script type="text/javascript">
    function getSelectedFileValue() {
        return $('#selectFile').val();
    }

    function notAllFilesDownloaded() {
        return $(".not-downloaded:visible").length > 0;
    }

    function hideNotDownloadedNote(prefix) {
        $("#" + prefix + "not-downloaded").hide();
        $("#" + prefix + "downloaded").text("Changed file downloaded.");
        showWarningIfNotAllFilesDownloaded();
    }

    function showWarningIfNotAllFilesDownloaded() {
        var warningElement = $("#not-downloaded-files-present");
        if (notAllFilesDownloaded()) {
            warningElement.show();
        } else {
            warningElement.hide();
        }
    }

    function anyFileSelected() {
        return $('input[name=selectedUserFile]:checked').length > 0;
    }
    function anyTwoFilesSelected() {
        return $('input[name=selectedUserFile]:checked').length > 1;
    }

    function showStartWebformArea() {
        $("#startWebformArea").show();
    }

    function hideFilesTableIfNoFilesPresent() {
        if (!$("tr.user_file").length) {
            $("div.files").hide();
        }
    }

    function disableActionButtonsIfNoFilesSelected() {
        $("#removeButton").prop('disabled', !anyFileSelected());
    }

    function disableMergeButtonIfNoFilesSelected() {
        $("#mergeButton").prop('disabled', !anyTwoFilesSelected());
    }

    var init = function() {
        $("#uploadButton").click(function () {
            $("#startWebformArea").hide();
            $("#userFile").click().change(function () {
                $("#newFileSubmit").click();
            });
        });
        hideFilesTableIfNoFilesPresent();
        $("#startWebformArea").hide();
        showWarningIfNotAllFilesDownloaded();
        $("#mergeButton").click(function () {
            var actionForm = $("form#actionForm");
            actionForm.attr("action", "<c:url value="/download/merge/files"/>");
            actionForm.submit();
        });
        disableActionButtonsIfNoFilesSelected();
        disableMergeButtonIfNoFilesSelected();

        var onSelectFile = function() {
            disableActionButtonsIfNoFilesSelected();
            disableMergeButtonIfNoFilesSelected();
        };
        $('input[name=selectedUserFile]').change(onSelectFile);
    };

    $(init);

    function showJson(downloadLink) {
        viewFileSource(downloadLink, {headers: {Accept: "application/json"}});
    }

    function showJsonToXml(downloadLink) {
{'fraction_non_alphanumeric': 0.15845136921624173, 'fraction_numerical': 0.0020774315391879133, 'mean_word_length': 2.7801570306923624, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4895199', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1413, 'n_words': 199}