<commit_before>function filterEnvironments(forms) {
    var allopts = $(forms).eq(0).find("select.environments option").clone();

    function doFilter(form) {
        var typeid = $(form).find("select.env_type").val();
        var envselect = $(form).find("select.environments");
        envselect.empty();
        allopts.each(
            function() {
                if ($(this).val().split(":")[0] == typeid) {
                    var newopt = $(this).clone();
                    newopt.appendTo(envselect);
                }
        });
    }
    $(forms).each(
        function() {
            doFilter(this);
        });
    $(forms).find("select.env_type").live(
        "change",
        function() {
            // @@@ this selector should be passed in somehow
            doFilter($(this).closest("li.env-form"));
        });

}

$(document).ready(
    function() {
        filterEnvironments("ul.envlist > li");
    });<commit_msg>js filterEnvironments on empty-form<commit_after>function filterEnvironments(template, forms) {
    var allopts = $(template).find("select.environments option").clone();

    function doFilter(form) {
        var typeid = $(form).find("select.env_type").val();
        var envselect = $(form).find("select.environments");
        envselect.empty();
        allopts.each(
            function() {
                if ($(this).val().split(":")[0] == typeid) {
                    var newopt = $(this).clone()
                    newopt.appendTo(envselect);
                }
        });
    }
    
    doFilter($(template));
    
    $(forms).each(
        function() {
            doFilter(this);
        });
    $(forms).find("select.env_type").live(
        "change",
        function() {
            // @@@ this selector should be passed in somehow
            doFilter($(this).closest("li.env-form"));
        });

}

$(document).ready(
    function() {
        filterEnvironments("div.env ul.empty-form > li", "ul.envlist > li");
    });
{'fraction_non_alphanumeric': 0.17380352644836272, 'fraction_numerical': 0.0015113350125944584, 'mean_word_length': 1.9077598828696924, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 6, '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': '3708366', 'n_tokens_mistral': 573, 'n_tokens_neox': 555, 'n_words': 92}